'use client'; import {useState} from 'react'; import {VStack, HStack} from '@astryxdesign/core/Layout'; import {Grid} from '@astryxdesign/core/Grid'; import {Card} from '@astryxdesign/core/Card'; import {Text, Heading} from '@astryxdesign/core/Text'; import {Badge} from '@astryxdesign/core/Badge'; import {Button} from '@astryxdesign/core/Button'; import {TextInput} from '@astryxdesign/core/TextInput'; import {useToast} from '@astryxdesign/core/Toast'; import {StaticPanel} from '@/shared/components/patterns/PanelCard'; import {SAMPLE_INTEGRATIONS} from '@/shared/mocks/sampleData'; export interface IntegrationApp { id: string; name: string; category: string; description: string; status: 'connected' | 'disconnected' | 'syncing'; apiKeyLabel?: string; lastSync?: string; } export function IntegrationsGrid() { const toast = useToast(); const [apps, setApps] = useState(SAMPLE_INTEGRATIONS); const [selectedApp, setSelectedApp] = useState(null); const [apiKeyInput, setApiKeyInput] = useState(''); const toggleConnection = (app: IntegrationApp) => { if (app.status === 'connected') { setApps((prev) => prev.map((a) => a.id === app.id ? {...a, status: 'disconnected', lastSync: undefined} : a, ), ); toast({body: `Disconnected ${app.name}`}); } else { setSelectedApp(app); setApiKeyInput(''); } }; const handleConfirmConnect = () => { if (!selectedApp) return; setApps((prev) => prev.map((a) => a.id === selectedApp.id ? { ...a, status: 'connected', apiKeyLabel: apiKeyInput || 'Configured', lastSync: 'Just now', } : a, ), ); toast({body: `Successfully connected ${selectedApp.name}`}); setSelectedApp(null); }; return ( {selectedApp ? ( Connect {selectedApp.name} {selectedApp.description}