(props: { integrations: readonly Integration[] })
| 427 | // --------------------------------------------------------------------------- |
| 428 | |
| 429 | function IntegrationGrid(props: { integrations: readonly Integration[] }) { |
| 430 | const integrationPlugins = useIntegrationPlugins(); |
| 431 | const pluginByKind = useMemo(() => { |
| 432 | const out = new Map<string, IntegrationPlugin>(); |
| 433 | for (const p of integrationPlugins) out.set(p.key, p); |
| 434 | return out; |
| 435 | }, [integrationPlugins]); |
| 436 | |
| 437 | return ( |
| 438 | <CardStack searchable> |
| 439 | <CardStackContent> |
| 440 | {props.integrations.map((integration) => { |
| 441 | const pluginKey = KIND_TO_PLUGIN_KEY[integration.kind] ?? integration.kind; |
| 442 | const plugin = pluginByKind.get(pluginKey); |
| 443 | const SummaryComponent = plugin?.summary; |
| 444 | const slug = String(integration.slug); |
| 445 | const name = integration.name || slug; |
| 446 | return ( |
| 447 | <CardStackEntry key={slug} asChild searchText={`${name} ${slug} ${integration.kind}`}> |
| 448 | <Link to="/{-$orgSlug}/integrations/$namespace" params={{ namespace: slug }}> |
| 449 | <IntegrationIconWithAccount |
| 450 | icon={integrationPresetIconUrl( |
| 451 | { id: slug, kind: integration.kind, name, url: integration.displayUrl }, |
| 452 | integrationPlugins, |
| 453 | )} |
| 454 | sourceId={slug} |
| 455 | url={ |
| 456 | integration.displayUrl ?? |
| 457 | integrationInferredUrl({ id: slug, name }) ?? |
| 458 | undefined |
| 459 | } |
| 460 | /> |
| 461 | <CardStackEntryContent> |
| 462 | <CardStackEntryTitle>{name}</CardStackEntryTitle> |
| 463 | <CardStackEntryDescription>{slug}</CardStackEntryDescription> |
| 464 | </CardStackEntryContent> |
| 465 | <CardStackEntryActions> |
| 466 | {SummaryComponent && ( |
| 467 | <Suspense fallback={null}> |
| 468 | <SummaryComponent sourceId={slug} /> |
| 469 | </Suspense> |
| 470 | )} |
| 471 | <IntegrationHealthSummary integration={integration.slug} /> |
| 472 | </CardStackEntryActions> |
| 473 | </Link> |
| 474 | </CardStackEntry> |
| 475 | ); |
| 476 | })} |
| 477 | </CardStackContent> |
| 478 | </CardStack> |
| 479 | ); |
| 480 | } |
| 481 | |
| 482 | // --------------------------------------------------------------------------- |
| 483 | // Loading skeleton |
nothing calls this directly
no test coverage detected