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

Function IntegrationGrid

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

Source from the content-addressed store, hash-verified

551// ---------------------------------------------------------------------------
552
553function IntegrationGrid(props: { integrations: readonly Integration[] }) {
554 const integrationPlugins = useIntegrationPlugins();
555 const pluginByKind = useMemo(() => {
556 const out = new Map<string, IntegrationPlugin>();
557 for (const p of integrationPlugins) out.set(p.key, p);
558 return out;
559 }, [integrationPlugins]);
560
561 const items = useMemo(() => groupIntegrations(props.integrations), [props.integrations]);
562
563 const renderEntry = (integration: Integration) => {
564 const pluginKey = KIND_TO_PLUGIN_KEY[integration.kind] ?? integration.kind;
565 const plugin = pluginByKind.get(pluginKey);
566 const SummaryComponent = plugin?.summary;
567 const slug = String(integration.slug);
568 const name = integration.name || slug;
569 return (
570 <CardStackEntry key={slug} asChild searchText={`${name} ${slug} ${integration.kind}`}>
571 <Link
572 to="/{-$orgSlug}/integrations/$namespace"
573 params={{ namespace: slug }}
574 data-testid={`integration-entry-${slug}`}
575 >
576 <IntegrationIconWithAccount
577 icon={integrationPresetIconUrl(
578 { id: slug, kind: integration.kind, name, url: integration.displayUrl },
579 integrationPlugins,
580 )}
581 integrationId={slug}
582 url={integration.displayUrl ?? integrationInferredUrl({ id: slug, name }) ?? undefined}
583 />
584 <CardStackEntryContent>
585 <CardStackEntryTitle>{name}</CardStackEntryTitle>
586 <CardStackEntryDescription>{slug}</CardStackEntryDescription>
587 </CardStackEntryContent>
588 <CardStackEntryActions>
589 {SummaryComponent && (
590 <Suspense fallback={null}>
591 <SummaryComponent integrationId={slug} />
592 </Suspense>
593 )}
594 <IntegrationHealthSummary integration={integration.slug} />
595 </CardStackEntryActions>
596 </Link>
597 </CardStackEntry>
598 );
599 };
600
601 const rendered: ReactNode[] = [];
602 let flatRun: Integration[] = [];
603 const flushFlat = () => {
604 if (flatRun.length === 0) return;
605 const run = flatRun;
606 flatRun = [];
607 rendered.push(
608 <CardStack key={`flat-${String(run[0]!.slug)}`} searchable>
609 <CardStackContent>{run.map(renderEntry)}</CardStackContent>
610 </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