()
| 47 | // --------------------------------------------------------------------------- |
| 48 | |
| 49 | export function IntegrationsPage() { |
| 50 | useExecutorDocumentTitle("Integrations"); |
| 51 | const integrations = useAtomValue(integrationsOptimisticAtom); |
| 52 | const refreshIntegrations = useAtomRefresh(integrationsOptimisticAtom); |
| 53 | const canCreate = useCanCreateWorkspaceConnections(); |
| 54 | |
| 55 | return ( |
| 56 | <PageContainer> |
| 57 | <PageHeader |
| 58 | title="Integrations" |
| 59 | description="Tool providers available in this workspace." |
| 60 | actions={ |
| 61 | canCreate ? ( |
| 62 | <Button asChild size="sm" className="gap-1.5"> |
| 63 | <Link |
| 64 | to="/{-$orgSlug}/integrations/browse" |
| 65 | onClick={() => trackEvent("integration_browse_opened", { via: "header" })} |
| 66 | > |
| 67 | <PlusIcon className="size-4" /> |
| 68 | Add integration |
| 69 | </Link> |
| 70 | </Button> |
| 71 | ) : ( |
| 72 | <WorkspaceAdminHint allowed={false}> |
| 73 | <Button disabled size="sm"> |
| 74 | <PlusIcon className="size-4" /> |
| 75 | Add integration |
| 76 | </Button> |
| 77 | </WorkspaceAdminHint> |
| 78 | ) |
| 79 | } |
| 80 | /> |
| 81 | |
| 82 | <div className="mb-8"> |
| 83 | <McpInstallCard /> |
| 84 | </div> |
| 85 | |
| 86 | <div className="mb-8 border-t border-border/50" /> |
| 87 | |
| 88 | {isAsyncResultLoading(integrations) ? ( |
| 89 | <IntegrationsGridSkeleton /> |
| 90 | ) : ( |
| 91 | AsyncResult.match(integrations, { |
| 92 | onInitial: () => <IntegrationsGridSkeleton />, |
| 93 | onFailure: () => ( |
| 94 | <ErrorState message="Failed to load integrations" onRetry={refreshIntegrations} /> |
| 95 | ), |
| 96 | onSuccess: ({ value }) => { |
| 97 | if (value.length === 0) { |
| 98 | return <EmptyIntegrations canCreate={canCreate} />; |
| 99 | } |
| 100 | |
| 101 | return ( |
| 102 | <div className="mb-8 space-y-3"> |
| 103 | <IntegrationGrid integrations={value} /> |
| 104 | </div> |
| 105 | ); |
| 106 | }, |
nothing calls this directly
no test coverage detected