import React from 'react'; import { useSearchParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Button } from '@/components/ui/button'; import { AdminLayout } from '../components/AdminLayout'; import { CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { TenantHeroCard, FrostedCard, FrostedSurface, tenantHeroPrimaryButtonClass, tenantHeroSecondaryButtonClass, } from '../components/tenant'; import { TasksSection } from './TasksPage'; import { TaskCollectionsSection } from './TaskCollectionsPage'; import { EmotionsSection } from './EmotionsPage'; const TAB_KEYS = ['tasks', 'collections', 'emotions'] as const; type EngagementTab = (typeof TAB_KEYS)[number]; function ensureValidTab(value: string | null): EngagementTab { if (value && (TAB_KEYS as readonly string[]).includes(value)) { return value as EngagementTab; } return 'tasks'; } export default function EngagementPage() { const { t } = useTranslation('management'); const { t: tc } = useTranslation('common'); const [searchParams, setSearchParams] = useSearchParams(); const initialTab = React.useMemo(() => ensureValidTab(searchParams.get('tab')), [searchParams]); const [activeTab, setActiveTab] = React.useState(initialTab); const handleTabChange = React.useCallback( (next: string) => { const valid = ensureValidTab(next); setActiveTab(valid); setSearchParams((prev) => { const params = new URLSearchParams(prev); params.set('tab', valid); return params; }); }, [setSearchParams] ); const heading = tc('navigation.engagement'); const heroDescription = t('engagement.hero.description', { defaultValue: 'Kuratiere Aufgaben, Moderationskollektionen und Emotionen als kreative Toolbox für jedes Event.' }); const heroSupporting = [ t('engagement.hero.summary.tasks', { defaultValue: 'Plane Aufgaben, die Gäste motivieren – von Upload-Regeln bis zu Story-Prompts.' }), t('engagement.hero.summary.collections', { defaultValue: 'Sammle Vorlagen und kollektive Inhalte, um Events im Handumdrehen neu zu starten.' }) ]; const heroPrimaryAction = ( ); const heroSecondaryAction = ( ); const heroAside = (

{t('engagement.hero.activeTab', { defaultValue: 'Aktiver Bereich' })}

{t(`engagement.tabs.${activeTab}.title`, { defaultValue: tc(`navigation.${activeTab}`) })}

{t('engagement.hero.tip', 'Wechsle Tabs, um Aufgaben, Kollektionen oder Emotionen zu bearbeiten und direkt in Events einzubinden.')}

); return ( {heading} {(['tasks', 'collections', 'emotions'] as const).map((tab) => ( {tc(`navigation.${tab}`)} ))} handleTabChange('collections')} /> handleTabChange('tasks')} /> ); }