'use client' import { Icons, formatTime, formatDate, type Meeting, type MeetingStats } from './types' interface DashboardTabProps { isDark: boolean loading: boolean stats: MeetingStats activeMeetings: Meeting[] scheduledMeetings: Meeting[] errorMessage: string | null creating: boolean setErrorMessage: (msg: string | null) => void setShowNewMeetingModal: (show: boolean) => void setMeetingType: (type: string) => void startQuickMeeting: () => void joinMeeting: (roomName: string, title: string) => void copyMeetingLink: (roomName: string) => void } export function DashboardTab({ isDark, loading, stats, activeMeetings, scheduledMeetings, errorMessage, creating, setErrorMessage, setShowNewMeetingModal, setMeetingType, startQuickMeeting, joinMeeting, copyMeetingLink, }: DashboardTabProps) { const statsData = [ { label: 'Aktive Meetings', value: loading ? '-' : String(stats.active), icon: Icons.video, color: 'from-green-400 to-emerald-600' }, { label: 'Geplante Termine', value: loading ? '-' : String(stats.scheduled), icon: Icons.calendar, color: 'from-blue-400 to-blue-600' }, { label: 'Aufzeichnungen', value: loading ? '-' : String(stats.recordings), icon: Icons.record, color: 'from-red-400 to-rose-600' }, { label: 'Teilnehmer', value: loading ? '-' : String(stats.participants), icon: Icons.users, color: 'from-amber-400 to-orange-600' }, ] return ( <> {/* Error Banner */} {errorMessage && (
{errorMessage}
)} {/* Quick Actions */}
{ setMeetingType('scheduled'); setShowNewMeetingModal(true) }} /> { setMeetingType('training'); setShowNewMeetingModal(true) }} /> { setMeetingType('parent'); setShowNewMeetingModal(true) }} />
{/* Statistics */}
{statsData.map((stat, index) => (
{stat.icon}

{stat.label}

{stat.value}

))}
{/* Active Meetings */} {activeMeetings.length > 0 && ( )} {/* Scheduled Meetings */} ) } // ============================================ // SUB-COMPONENTS // ============================================ function QuickActionCard({ isDark, icon, color, title, subtitle, onClick, disabled }: { isDark: boolean; icon: React.ReactNode; color: string title: string; subtitle: string; onClick: () => void; disabled?: boolean }) { return ( ) } function ActiveMeetingsList({ isDark, meetings, joinMeeting, copyMeetingLink }: { isDark: boolean; meetings: Meeting[] joinMeeting: (roomName: string, title: string) => void copyMeetingLink: (roomName: string) => void }) { return (

Aktive Meetings

{meetings.length} Live
{meetings.map((meeting) => (
{Icons.video}
{meeting.title}
{Icons.users} {meeting.participants || 0} Teilnehmer {meeting.started_at && ( {Icons.clock} Gestartet {formatTime(meeting.started_at)} )}
))}
) } function ScheduledMeetingsList({ isDark, loading, meetings, joinMeeting, copyMeetingLink, setShowNewMeetingModal }: { isDark: boolean; loading: boolean; meetings: Meeting[] joinMeeting: (roomName: string, title: string) => void copyMeetingLink: (roomName: string) => void setShowNewMeetingModal: (show: boolean) => void }) { return (

Naechste Meetings

{loading ? (
Laet...
) : meetings.length === 0 ? (
{Icons.calendar}

Keine geplanten Meetings

) : (
{meetings.slice(0, 5).map((meeting) => (
{meeting.scheduled_at ? formatTime(meeting.scheduled_at) : '--:--'}
{meeting.scheduled_at ? formatDate(meeting.scheduled_at) : ''}
{meeting.title}
{Icons.clock} {meeting.duration} Min {meeting.type}
Geplant
))}
)}
) }