'use client' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Switch } from '@/components/ui/switch' import { Label } from '@/components/ui/label' import { DynamicTimeNoSSR } from '@/components/DynamicTimeNoSSR' import { useAtom } from 'jotai' import { settingsAtom } from '@/lib/atoms' import { Settings, WeekDay } from '@/lib/types' import { saveSettings, uploadAvatar } from '../actions/data' import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar' import { Button } from '@/components/ui/button' import { User } from 'lucide-react' export default function SettingsPage() { const [settings, setSettings] = useAtom(settingsAtom) const updateSettings = async (newSettings: Settings) => { await saveSettings(newSettings) setSettings(newSettings) } if (!settings) return null return ( <>

Settings

UI Settings
Format large numbers (e.g., 1K, 1M, 1B)
updateSettings({ ...settings, ui: { ...settings.ui, useNumberFormatting: checked } }) } />
Use thousand separators (e.g., 1,000 vs 1000)
updateSettings({ ...settings, ui: { ...settings.ui, useGrouping: checked } }) } />
System Settings
Select your timezone for accurate date tracking
Select your preferred first day of the week
Profile Settings
Customize your profile picture
{ const newSettings = await uploadAvatar(formData) setSettings(newSettings) }}> { const file = e.target.files?.[0] if (file) { if (file.size > 5 * 1024 * 1024) { // 5MB alert('File size must be less than 5MB') e.target.value = '' return } const form = e.target.form if (form) form.requestSubmit() } }} />
) }