import { useMemo } from 'react'; import { Puzzle, KeyRound, UserCircle, Globe, Wrench, Mail, CalendarDays } from 'lucide-react'; import type { LayoutNode, PanelComponents } from 'officerdev'; import { WorkspaceLayout } from 'officerdev'; import { useAuth } from 'hooks/useAuth'; import { useGlobal } from 'hooks/useGlobal'; import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { SettingsSidebar, SettingsContent, type SettingsSection } from '../SettingsPanel'; import { GoogleOAuthConfig } from './GoogleOAuthConfig'; // import { GoogleAccount } from './GoogleAccount'; // hidden — email uses IMAP app password now import { BrowserRelay } from './BrowserRelay'; import { ApifyConfig } from './ApifyConfig'; import { EmailAccounts } from './EmailAccounts'; import { DavAppPasswords } from './DavAppPasswords'; const GLOBAL_KEY = 'INTEGRATIONS_SETTINGS_SELECTED'; const TAB_KEY = 'INTEGRATIONS_SETTINGS_TAB'; const enterpriseSections: SettingsSection[] = [ { key: 'google-oauth', icon: KeyRound, title: 'Google OAuth', description: 'Client ID and secret for Google APIs', content: , }, { key: 'apify', icon: Wrench, title: 'Apify', description: 'API token for web scraping actors', content: , }, ]; const personalSections: SettingsSection[] = [ { key: 'email-accounts', icon: Mail, title: 'Email', description: 'Connect email accounts for inbox sync', content: , }, // Google OAuth is left in place (code + DB) but hidden — email now uses an app password over IMAP, // so there's no reason to reconnect Google here. Re-enable this section to bring it back. // { // key: 'google-account', // icon: UserCircle, // title: 'Google Account', // description: 'Connect your Google account', // content: , // }, { key: 'dav-app-passwords', icon: CalendarDays, title: 'Calendar & Contacts sync', description: 'Per-device passwords for CalDAV/CardDAV clients', content: , }, { key: 'browser-relay', icon: Globe, title: 'Browser Relay', description: 'Connect your Chrome browser', content: , }, ]; const IntegrationsSidebar = () => { const [tab, setTab] = useGlobal(TAB_KEY, 'enterprise'); const sections = tab === 'enterprise' ? enterpriseSections : personalSections; return (
Integrations
Enterprise Personal
); }; const IntegrationsContent = () => { const [tab] = useGlobal(TAB_KEY, 'enterprise'); const sections = tab === 'enterprise' ? enterpriseSections : personalSections; return ; }; const layout: LayoutNode = { type: 'group', id: 'integrations-root', direction: 'horizontal', children: [ { node: { type: 'panel', id: 'integrations-left', appType: null }, size: 20 }, { node: { type: 'panel', id: 'integrations-right', appType: null }, size: 80 }, ], }; export const IntegrationsSettings = () => { const panelComponents: PanelComponents = useMemo( () => ({ 'integrations-left': IntegrationsSidebar, 'integrations-right': IntegrationsContent, }), [], ); return (
{}} components={panelComponents} />
); };