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

Function ToolkitTile

packages/plugins/toolkits/src/page.tsx:454–510  ·  view source on GitHub ↗
(props: { showOwnerLabels: boolean; toolkit: ToolkitResponse })

Source from the content-addressed store, hash-verified

452 count === 0 ? "No connections" : `${count} ${count === 1 ? "connection" : "connections"}`;
453
454function ToolkitTile(props: { showOwnerLabels: boolean; toolkit: ToolkitResponse }) {
455 const toolkit = props.toolkit;
456 const tools = useAtomValue(toolsAllAtom);
457 const integrations = useAtomValue(integrationsOptimisticAtom);
458 const connections = useAtomValue(toolkitConnectionsAtom(toolkit.id));
459 const integrationPlugins = useIntegrationPlugins();
460 const visibleTools = useMemo(
461 () =>
462 AsyncResult.isSuccess(tools)
463 ? (tools.value as readonly ToolRow[]).filter((tool) =>
464 toolCanAppearInToolkit(toolkit, tool),
465 )
466 : [],
467 [toolkit, tools],
468 );
469 const connectionGroups = useMemo(() => buildConnectionGroups(visibleTools), [visibleTools]);
470 const connectionRows = AsyncResult.isSuccess(connections) ? connections.value.connections : [];
471 const integrationRows = AsyncResult.isSuccess(integrations)
472 ? (integrations.value as readonly Integration[])
473 : [];
474 const tileDataReady =
475 AsyncResult.isSuccess(connections) &&
476 AsyncResult.isSuccess(tools) &&
477 AsyncResult.isSuccess(integrations);
478 const configuredConnections = tileDataReady
479 ? configuredConnectionViews(
480 connectionRows,
481 connectionGroups,
482 integrationRows,
483 integrationPlugins,
484 props.showOwnerLabels,
485 )
486 : [];
487 return (
488 <Link
489 to="/{-$orgSlug}/toolkits/$toolkitSlug"
490 params={{ toolkitSlug: toolkit.slug }}
491 aria-label={`Open toolkit ${toolkit.name}`}
492 className="group flex min-h-36 min-w-0 self-start flex-col justify-between rounded-md border border-border/70 bg-card p-3.5 text-left text-card-foreground shadow-xs transition-[border-color,background-color,box-shadow] hover:border-foreground/25 hover:bg-muted/20 hover:shadow-sm focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:outline-none"
493 style={toolkitCardStyle}
494 >
495 <div className="flex min-w-0 items-start gap-3">
496 {tileDataReady ? (
497 <ToolkitConnectionIconStack connections={configuredConnections} />
498 ) : (
499 <Skeleton className="size-9 shrink-0 rounded-md" />
500 )}
501 <div className="min-w-0 flex-1">
502 <div className="truncate text-sm font-semibold text-foreground">{toolkit.name}</div>
503 <div className="mt-1 truncate text-xs text-muted-foreground">
504 {tileDataReady ? connectionCountLabel(configuredConnections.length) : "Loading"}
505 </div>
506 </div>
507 </div>
508 </Link>
509 );
510}
511

Callers

nothing calls this directly

Calls 5

useIntegrationPluginsFunction · 0.90
toolCanAppearInToolkitFunction · 0.85
buildConnectionGroupsFunction · 0.85
connectionCountLabelFunction · 0.85

Tested by

no test coverage detected