MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / IntegrationGrid

Function IntegrationGrid

packages/react/src/pages/integrations.tsx:132–211  ·  view source on GitHub ↗
(props: { integrations: readonly Integration[] })

Source from the content-addressed store, hash-verified

130// ---------------------------------------------------------------------------
131
132function IntegrationGrid(props: { integrations: readonly Integration[] }) {
133 const integrationPlugins = useIntegrationPlugins();
134 const pluginByKind = useMemo(() => {
135 const out = new Map<string, IntegrationPlugin>();
136 for (const p of integrationPlugins) out.set(p.key, p);
137 return out;
138 }, [integrationPlugins]);
139
140 const items = useMemo(() => groupIntegrations(props.integrations), [props.integrations]);
141
142 const renderEntry = (integration: Integration) => {
143 const pluginKey = KIND_TO_PLUGIN_KEY[integration.kind] ?? integration.kind;
144 const plugin = pluginByKind.get(pluginKey);
145 const SummaryComponent = plugin?.summary;
146 const slug = String(integration.slug);
147 const name = integration.name || slug;
148 return (
149 <CardStackEntry key={slug} asChild searchText={`${name} ${slug} ${integration.kind}`}>
150 <Link
151 to="/{-$orgSlug}/integrations/$namespace"
152 params={{ namespace: slug }}
153 data-testid={`integration-entry-${slug}`}
154 >
155 <IntegrationIconWithAccount
156 icon={integrationPresetIconUrl(
157 { id: slug, kind: integration.kind, name, url: integration.displayUrl },
158 integrationPlugins,
159 )}
160 integrationId={slug}
161 url={integration.displayUrl ?? integrationInferredUrl({ id: slug, name }) ?? undefined}
162 />
163 <CardStackEntryContent>
164 <CardStackEntryTitle>{name}</CardStackEntryTitle>
165 <CardStackEntryDescription>{slug}</CardStackEntryDescription>
166 </CardStackEntryContent>
167 <CardStackEntryActions>
168 {SummaryComponent && (
169 <Suspense fallback={null}>
170 <SummaryComponent integrationId={slug} />
171 </Suspense>
172 )}
173 <IntegrationHealthSummary integration={integration.slug} />
174 </CardStackEntryActions>
175 </Link>
176 </CardStackEntry>
177 );
178 };
179
180 const rendered: ReactNode[] = [];
181 let flatRun: Integration[] = [];
182 const flushFlat = () => {
183 if (flatRun.length === 0) return;
184 const run = flatRun;
185 flatRun = [];
186 rendered.push(
187 <CardStack key={`flat-${String(run[0]!.slug)}`} searchable>
188 <CardStackContent>{run.map(renderEntry)}</CardStackContent>
189 </CardStack>,

Callers

nothing calls this directly

Calls 6

useIntegrationPluginsFunction · 0.90
groupIntegrationsFunction · 0.90
flushFlatFunction · 0.85
pushMethod · 0.80
setMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected