11import { useState , useEffect } from "react" ;
2- import { useFetcher } from "react-router" ;
2+ import { useFetcher , Form } from "react-router" ;
33import { Button } from "../ui/button" ;
44import {
55 Dialog ,
@@ -13,7 +13,8 @@ import {
1313import { Input } from "../ui/input" ;
1414import { Label } from "../ui/label" ;
1515import { RuleList } from "./RuleList" ;
16- import { Settings , Loader2 , CheckCircle2 , XCircle } from "lucide-react" ;
16+ import { Settings , Loader2 , CheckCircle2 , XCircle , Sun , Moon , LogOut } from "lucide-react" ;
17+ import { useTheme } from "../../hooks/useTheme" ;
1718import type { AutoStopRuleData } from "./types" ;
1819
1920type SettingsModalProps = {
@@ -26,6 +27,7 @@ type SettingsModalProps = {
2627export function SettingsModal ( { rules : initialRules , userTimezone, apiKey, googleConnected } : SettingsModalProps ) {
2728 const [ open , setOpen ] = useState ( false ) ;
2829 const fetcher = useFetcher ( ) ;
30+ const { theme, toggle : toggleTheme } = useTheme ( ) ;
2931 const [ localRules , setLocalRules ] = useState < AutoStopRuleData [ ] > ( initialRules ) ;
3032 const isSaving = fetcher . state !== "idle" ;
3133
@@ -126,6 +128,31 @@ export function SettingsModal({ rules: initialRules, userTimezone, apiKey, googl
126128 </ div >
127129 </ div >
128130
131+ < div className = "border-t pt-4" >
132+ < h4 className = "text-sm font-medium mb-3" > Appearance</ h4 >
133+ < div className = "flex items-center justify-between" >
134+ < div >
135+ < p className = "text-sm" > Theme</ p >
136+ < p className = "text-xs text-muted-foreground mt-0.5" >
137+ { theme === "dark" ? "Dark mode" : "Light mode" }
138+ </ p >
139+ </ div >
140+ < Button
141+ type = "button"
142+ variant = "outline"
143+ size = "sm"
144+ onClick = { toggleTheme }
145+ className = "gap-2"
146+ >
147+ { theme === "dark" ? (
148+ < > < Sun className = "size-3.5" /> Light</ >
149+ ) : (
150+ < > < Moon className = "size-3.5" /> Dark</ >
151+ ) }
152+ </ Button >
153+ </ div >
154+ </ div >
155+
129156 < div className = "border-t pt-4" >
130157 < h4 className = "text-sm font-medium mb-3" > Google Integration</ h4 >
131158 < div className = "space-y-3" >
@@ -174,7 +201,18 @@ export function SettingsModal({ rules: initialRules, userTimezone, apiKey, googl
174201 </ div >
175202 </ div >
176203 </ div >
177- < DialogFooter >
204+ < DialogFooter className = "flex-row items-center" >
205+ < Form method = "post" action = "/auth/logout" className = "mr-auto" >
206+ < Button
207+ type = "submit"
208+ variant = "ghost"
209+ size = "sm"
210+ className = "gap-2 text-muted-foreground hover:text-destructive"
211+ >
212+ < LogOut className = "size-3.5" />
213+ Sign out
214+ </ Button >
215+ </ Form >
178216 < Button type = "button" variant = "outline" onClick = { ( ) => setOpen ( false ) } disabled = { isSaving } >
179217 Cancel
180218 </ Button >
0 commit comments