()
| 71 | // --------------------------------------------------------------------------- |
| 72 | |
| 73 | export function IntegrationsPage() { |
| 74 | useExecutorDocumentTitle("Integrations"); |
| 75 | const integrations = useAtomValue(integrationsOptimisticAtom); |
| 76 | const refreshIntegrations = useAtomRefresh(integrationsOptimisticAtom); |
| 77 | const [connectOpen, setConnectOpen] = useState(false); |
| 78 | |
| 79 | return ( |
| 80 | <PageContainer> |
| 81 | <PageHeader |
| 82 | title="Integrations" |
| 83 | description="Tool providers available in this workspace." |
| 84 | actions={ |
| 85 | <Button |
| 86 | onClick={() => { |
| 87 | setConnectOpen(true); |
| 88 | trackEvent("integration_connect_dialog_opened"); |
| 89 | }} |
| 90 | size="sm" |
| 91 | className="gap-1.5" |
| 92 | > |
| 93 | <PlusIcon className="size-4" /> |
| 94 | Connect |
| 95 | </Button> |
| 96 | } |
| 97 | /> |
| 98 | |
| 99 | <div className="mb-8"> |
| 100 | <McpInstallCard /> |
| 101 | </div> |
| 102 | |
| 103 | <div className="mb-8 border-t border-border/50" /> |
| 104 | |
| 105 | {isAsyncResultLoading(integrations) ? ( |
| 106 | <IntegrationsGridSkeleton /> |
| 107 | ) : ( |
| 108 | AsyncResult.match(integrations, { |
| 109 | onInitial: () => <IntegrationsGridSkeleton />, |
| 110 | onFailure: () => ( |
| 111 | <ErrorState message="Failed to load integrations" onRetry={refreshIntegrations} /> |
| 112 | ), |
| 113 | onSuccess: ({ value }) => { |
| 114 | if (value.length === 0) { |
| 115 | return ( |
| 116 | <EmptyIntegrations |
| 117 | onConnect={() => { |
| 118 | setConnectOpen(true); |
| 119 | trackEvent("integration_connect_dialog_opened"); |
| 120 | }} |
| 121 | /> |
| 122 | ); |
| 123 | } |
| 124 | |
| 125 | return ( |
| 126 | <div className="mb-8 space-y-3"> |
| 127 | <IntegrationGrid integrations={value} /> |
| 128 | </div> |
| 129 | ); |
| 130 | }, |
nothing calls this directly
no test coverage detected