import { useEffect, useState } from 'react'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { Save, Folder, Clock, Image, Cloud, Users } from 'lucide-react'; import { api, type AppSettings } from '@/lib/api'; import { Button } from '@/components/ui/Button'; import { Input } from '@/components/ui/Input'; import { ThemeToggle } from '@/components/ui/ThemeToggle'; import { useThemeStore, ACCENT_TOKENS, type AccentColor } from '@/store/themeStore'; import { clsx } from 'clsx'; import { Link } from 'react-router-dom'; function Section({ title, icon, children }: { title: string; icon: React.ReactNode; children: React.ReactNode }) { return (
{icon}

{title}

{children}
); } export default function SettingsPage() { const qc = useQueryClient(); const { accent, setAccent } = useThemeStore(); const { data: settings } = useQuery({ queryKey: ['settings'], queryFn: () => api.get('/settings').then((r) => r.data), }); const [form, setForm] = useState>({}); useEffect(() => { if (settings) setForm(settings); }, [settings]); const mutation = useMutation({ mutationFn: (patch: Partial) => api.patch('/settings', patch).then((r) => r.data), onSuccess: () => qc.invalidateQueries({ queryKey: ['settings'] }), }); const set = (key: keyof AppSettings, value: string) => setForm((f) => ({ ...f, [key]: value })); const save = () => mutation.mutate(form as AppSettings); return (

Settings

Configure your family dashboard

{/* ── Appearance ─────────────────────────────────────────────── */}
}>

Theme Mode

Accent Color

{(Object.keys(ACCENT_TOKENS) as AccentColor[]).map((key) => { const { base, label } = ACCENT_TOKENS[key]; return ( ); })}
{/* ── Family Members ─────────────────────────────────────────── */}
}>

Add, edit, or remove family members. Members are used throughout the app to assign chores, events, and shopping items.

{/* ── Photo Slideshow ────────────────────────────────────────── */}
}> set('photo_folder', e.target.value)} placeholder="C:\Users\YourName\Pictures\Family" hint="Absolute path to the folder containing your photos. Subfolders are included." />
{/* ── Date & Time ────────────────────────────────────────────── */}
}>
{/* ── Weather ────────────────────────────────────────────────── */}
}> set('weather_api_key', e.target.value)} placeholder="Your free API key from openweathermap.org" type="password" autoComplete="new-password" /> set('weather_location', e.target.value)} placeholder="New York, US" autoComplete="off" />
); }