'use client' import { useState, useEffect, useCallback } from 'react' import { useRouter } from 'next/navigation' // Spatial UI System import { PerformanceProvider, usePerformance } from '@/lib/spatial-ui/PerformanceContext' import { FocusProvider } from '@/lib/spatial-ui/FocusContext' import { FloatingMessage } from '@/components/spatial-ui/FloatingMessage' /** * Apple Weather Style Dashboard - Refined Version * * Design principles: * - Photo/gradient background that sets the mood * - Ultra-translucent cards (~8% opacity) * - Cards blend INTO the background * - White text, monochrome palette * - Subtle blur, minimal shadows * - Useful info: time, weather, compass */ // ============================================================================= // GLASS CARD - Ultra Transparent // ============================================================================= interface GlassCardProps { children: React.ReactNode className?: string onClick?: () => void size?: 'sm' | 'md' | 'lg' delay?: number } function GlassCard({ children, className = '', onClick, size = 'md', delay = 0 }: GlassCardProps) { const { settings } = usePerformance() const [isVisible, setIsVisible] = useState(false) const [isHovered, setIsHovered] = useState(false) useEffect(() => { const timer = setTimeout(() => setIsVisible(true), delay) return () => clearTimeout(timer) }, [delay]) const sizeClasses = { sm: 'p-4', md: 'p-5', lg: 'p-6', } const blur = settings.enableBlur ? 24 * settings.blurIntensity : 0 return (
0 ? `blur(${blur}px) saturate(180%)` : 'none', WebkitBackdropFilter: blur > 0 ? `blur(${blur}px) saturate(180%)` : 'none', border: '1px solid rgba(255, 255, 255, 0.1)', boxShadow: '0 4px 24px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.05)', opacity: isVisible ? 1 : 0, transform: isVisible ? `translateY(0) scale(${isHovered ? 1.01 : 1})` : 'translateY(20px)', transition: 'all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)', }} onMouseEnter={() => setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={onClick} > {children}
) } // ============================================================================= // ANALOG CLOCK - Apple Style // ============================================================================= function AnalogClock() { const [time, setTime] = useState(new Date()) useEffect(() => { const timer = setInterval(() => setTime(new Date()), 1000) return () => clearInterval(timer) }, []) const hours = time.getHours() % 12 const minutes = time.getMinutes() const seconds = time.getSeconds() const hourDeg = (hours * 30) + (minutes * 0.5) const minuteDeg = minutes * 6 const secondDeg = seconds * 6 return (
{/* Clock face */}
{/* Hour markers */} {[...Array(12)].map((_, i) => (
))} {/* Hour hand */}
{/* Minute hand */}
{/* Second hand */}
{/* Center dot */}
) } // ============================================================================= // COMPASS - Apple Weather Style // ============================================================================= function Compass({ direction = 225 }: { direction?: number }) { return (
{/* Compass face */}
{/* Cardinal directions */} N S W O {/* Needle */}
{/* North (red) */}
{/* South (white) */}
{/* Center */}
) } // ============================================================================= // BAR CHART - Apple Weather Hourly Style // ============================================================================= interface BarChartProps { data: { label: string; value: number; highlight?: boolean }[] maxValue?: number } function BarChart({ data, maxValue }: BarChartProps) { const max = maxValue || Math.max(...data.map((d) => d.value)) return (
{data.map((item, index) => { const height = (item.value / max) * 100 return (
{item.value}
{item.label}
) })}
) } // ============================================================================= // TEMPERATURE DISPLAY // ============================================================================= function TemperatureDisplay({ temp, condition }: { temp: number; condition: string }) { const conditionIcons: Record = { sunny: '☀️', cloudy: '☁️', rainy: '🌧️', snowy: '🌨️', partly_cloudy: '⛅', } return (
{conditionIcons[condition] || '☀️'}
{temp} °C

{condition.replace('_', ' ')}

) } // ============================================================================= // PROGRESS RING // ============================================================================= interface ProgressRingProps { progress: number size?: number strokeWidth?: number label: string value: string color?: string } function ProgressRing({ progress, size = 80, strokeWidth = 6, label, value, color = '#a78bfa' }: ProgressRingProps) { const radius = (size - strokeWidth) / 2 const circumference = radius * 2 * Math.PI const offset = circumference - (progress / 100) * circumference return (
{value}

{label}

) } // ============================================================================= // STAT DISPLAY // ============================================================================= function StatDisplay({ value, unit, label, icon }: { value: string; unit?: string; label: string; icon?: string }) { return (
{icon &&
{icon}
}
{value} {unit && {unit}}

{label}

) } // ============================================================================= // LIST ITEM // ============================================================================= function ListItem({ icon, title, subtitle, value, delay = 0 }: { icon: string; title: string; subtitle?: string; value?: string; delay?: number }) { const [isVisible, setIsVisible] = useState(false) const [isHovered, setIsHovered] = useState(false) useEffect(() => { const timer = setTimeout(() => setIsVisible(true), delay) return () => clearTimeout(timer) }, [delay]) return (
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} >
{icon}

{title}

{subtitle &&

{subtitle}

}
{value && {value}}
) } // ============================================================================= // ACTION BUTTON // ============================================================================= function ActionButton({ icon, label, primary = false, onClick, delay = 0 }: { icon: string; label: string; primary?: boolean; onClick?: () => void; delay?: number }) { const [isVisible, setIsVisible] = useState(false) const [isPressed, setIsPressed] = useState(false) useEffect(() => { const timer = setTimeout(() => setIsVisible(true), delay) return () => clearTimeout(timer) }, [delay]) return ( ) } // ============================================================================= // QUALITY INDICATOR // ============================================================================= function QualityIndicator() { const { metrics, settings, forceQuality } = usePerformance() const [isExpanded, setIsExpanded] = useState(false) return (
{isExpanded && (
{(['high', 'medium', 'low'] as const).map((level) => ( ))}
)}
) } // ============================================================================= // MAIN DASHBOARD // ============================================================================= function DashboardContent() { const router = useRouter() const { settings } = usePerformance() const [mousePos, setMousePos] = useState({ x: 0, y: 0 }) const [time, setTime] = useState(new Date()) useEffect(() => { const timer = setInterval(() => setTime(new Date()), 1000) return () => clearInterval(timer) }, []) useEffect(() => { if (!settings.enableParallax) return const handleMouseMove = (e: MouseEvent) => setMousePos({ x: e.clientX, y: e.clientY }) window.addEventListener('mousemove', handleMouseMove) return () => window.removeEventListener('mousemove', handleMouseMove) }, [settings.enableParallax]) const windowWidth = typeof window !== 'undefined' ? window.innerWidth : 1920 const windowHeight = typeof window !== 'undefined' ? window.innerHeight : 1080 const parallax = settings.enableParallax ? { x: (mousePos.x / windowWidth - 0.5) * 15, y: (mousePos.y / windowHeight - 0.5) * 15 } : { x: 0, y: 0 } const greeting = time.getHours() < 12 ? 'Guten Morgen' : time.getHours() < 18 ? 'Guten Tag' : 'Guten Abend' // Weekly correction data const weeklyData = [ { label: 'Mo', value: 4, highlight: false }, { label: 'Di', value: 7, highlight: false }, { label: 'Mi', value: 3, highlight: false }, { label: 'Do', value: 8, highlight: false }, { label: 'Fr', value: 6, highlight: true }, { label: 'Sa', value: 2, highlight: false }, { label: 'So', value: 0, highlight: false }, ] return (
{/* Background */}
{/* Stars */}
{/* Ambient glows */}
{/* Content */}
{/* Header */}

{time.toLocaleDateString('de-DE', { weekday: 'long', day: 'numeric', month: 'long' })}

{greeting}

🔔 3
{/* Main Grid */}
{/* Clock & Weather Row */}

{time.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' })}

SW Wind

12 km/h

28

Diese Woche

156

Gesamt

{/* Bar Chart */}

Korrekturen diese Woche

30 gesamt
{/* Progress Rings */}
{/* Time Saved */}

durch KI-Unterstuetzung

{/* Klausuren List */}

Aktuelle Klausuren

{/* Quick Actions */}

Schnellaktionen

router.push('/worksheet-editor')} delay={600} />
{/* Floating Messages */} {/* Quality Indicator */}
) } // ============================================================================= // MAIN PAGE // ============================================================================= export default function ExperimentalDashboard() { return ( ) }