diff --git a/packages/react/src/pages/integration-detail.tsx b/packages/react/src/pages/integration-detail.tsx index 0c823b02a..7462543c0 100644 --- a/packages/react/src/pages/integration-detail.tsx +++ b/packages/react/src/pages/integration-detail.tsx @@ -90,6 +90,8 @@ export function IntegrationDetailPage(props: { namespace: string }) { const [refreshing, setRefreshing] = useState(false); const [editSheetOpen, setEditSheetOpen] = useState(false); const [activeTab, setActiveTab] = useState<"accounts" | "tools">("accounts"); + const [manualAccountHandoff, setManualAccountHandoff] = + useState(null); const [locationSearch] = useState(() => typeof window === "undefined" ? "" : window.location.search, ); @@ -105,7 +107,7 @@ export function IntegrationDetailPage(props: { namespace: string }) { const currentTab = isBuiltInIntegration ? "tools" : activeTab; const canRefresh = integrationData?.canRefresh ?? false; const canRemove = integrationData?.canRemove ?? false; - const accountHandoff = useMemo(() => { + const urlAccountHandoff = useMemo(() => { if (locationSearch.length === 0) return null; const search = new URLSearchParams(locationSearch); if (search.get("addAccount") !== "1") return null; @@ -140,6 +142,8 @@ export function IntegrationDetailPage(props: { namespace: string }) { ...(oauthClient !== undefined ? { oauthClient } : {}), }; }, [locationSearch]); + const accountHandoff = manualAccountHandoff ?? urlAccountHandoff; + useEffect(() => { if (accountHandoff && !isBuiltInIntegration) { setActiveTab("accounts"); @@ -338,6 +342,11 @@ export function IntegrationDetailPage(props: { namespace: string }) { setRefreshing(false); }; + const handleOpenAddConnection = () => { + setActiveTab("accounts"); + setManualAccountHandoff({ key: `manual:${String(slug)}:${Date.now()}` }); + }; + return (
{/* Header bar */} @@ -491,6 +500,11 @@ export function IntegrationDetailPage(props: { namespace: string }) { } : {})} /> + ) : !isBuiltInIntegration && integrationConnections.length === 0 ? ( + 0} + /> ) : ( 0} /> )} @@ -514,6 +528,31 @@ export function IntegrationDetailPage(props: { namespace: string }) { ); } +function NoConnectionToolsEmptyState(props: { + readonly onAddConnection: () => void; + readonly canAddConnection: boolean; +}) { + return ( +
+
+

No tools yet

+

+ Add a connection to unlock this integration's tools. +

+ +
+
+ ); +} + function IntegrationDetailSkeleton() { return (