From 7808cf53c24a2277b3e53a4bec18d34ffde5c23d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 4 Jan 2026 17:12:49 +0000 Subject: [PATCH] fix: Persist Settings Panel preferences using Zustand store Connect SettingsPanel form inputs to useSettingsStore hook so that user preferences (weekly hours target, notifications) are saved to localStorage and persist across sessions. Fixes #10 --- src/components/settings/SettingsPanel.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/settings/SettingsPanel.tsx b/src/components/settings/SettingsPanel.tsx index 99b241f..7e0d5d3 100644 --- a/src/components/settings/SettingsPanel.tsx +++ b/src/components/settings/SettingsPanel.tsx @@ -4,6 +4,7 @@ import { useState, useEffect } from 'react'; import { Card } from '@/components/ui'; import { bcClient } from '@/services/bc/bcClient'; import { useAuth } from '@/services/auth'; +import { useSettingsStore } from '@/hooks/useSettingsStore'; import { BuildingOffice2Icon, EnvelopeIcon, @@ -26,6 +27,7 @@ interface CompanyInfo { export function SettingsPanel() { const { account } = useAuth(); + const { weeklyHoursTarget, notificationsEnabled, updateSettings } = useSettingsStore(); const [companyInfo, setCompanyInfo] = useState(null); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); @@ -136,7 +138,15 @@ export function SettingsPanel() { { + const value = parseInt(e.target.value, 10); + if (!isNaN(value) && value >= 1 && value <= 168) { + updateSettings({ weeklyHoursTarget: value }); + } + }} className="w-20 rounded-lg border border-dark-600 bg-dark-800 px-3 py-2 text-dark-100 focus:outline-none focus:ring-2 focus:ring-thyme-500" /> @@ -146,7 +156,12 @@ export function SettingsPanel() {

Get reminded to fill in your timesheet