// Global preferences, and only the ones that genuinely are global. Everything else about this app // is a key away, which is the point of it, so there is nothing here to pad the panel with. import { useState } from "react"; import { useAccounts } from "../store/useAccounts"; import { useCalendarView } from "../store/useCalendarView"; import { useOverlays } from "../store/useOverlays"; import { useTheme } from "../store/useTheme"; import { setWeekStartDay, weekStartDay } from "../time"; import { Sheet } from "./overlayShell"; export function Settings() { const open = useOverlays((s) => s.open); const close = useOverlays((s) => s.close); const push = useOverlays((s) => s.push); const theme = useTheme((s) => s.theme); const toggleTheme = useTheme((s) => s.toggle); const accounts = useAccounts((s) => s.accounts); const [start, setStart] = useState<0 | 1>(() => (weekStartDay() === 0 ? 0 : 1)); const chooseTheme = (next: "light" | "dark") => { if (next !== theme) toggleTheme(); }; const chooseStart = (day: 0 | 1) => { if (day === start) return; setWeekStartDay(day); setStart(day); // The week span is derived from this on every read, so nudge the view into recomputing it. useCalendarView.getState().setAnchor(useCalendarView.getState().anchor); }; return ( Done } >
Theme
Week starts on Week view begins on this day rather than on today. The arrows and h and l still slide it a day at a time when you want a look either side.
Google accounts {accounts.length === 0 ? "No Google account connected yet." : `${accounts.length} connected.`}
); } export default Settings;