From 656cce0159be703cd830a6c7b67ab92a5873f6ca Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 19 Sep 2025 12:10:57 -0500 Subject: [PATCH] Add Preferences page to settings --- src/AppRouter.tsx | 2 + src/components/SettingsLayout.tsx | 9 +++- src/components/ThemePicker.tsx | 55 +++++++++++++++++++++++ src/pages/Preferences.tsx | 73 +++++++++++++++++++++++++++++++ src/pages/Settings.tsx | 9 +++- 5 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 src/components/ThemePicker.tsx create mode 100644 src/pages/Preferences.tsx diff --git a/src/AppRouter.tsx b/src/AppRouter.tsx index 848d8385..c78e2a63 100644 --- a/src/AppRouter.tsx +++ b/src/AppRouter.tsx @@ -5,6 +5,7 @@ import { SessionMonitor } from "./components/SessionMonitor"; import Index from "./pages/Index"; import Clone from "./pages/Clone"; import Settings from "./pages/Settings"; +import Preferences from "./pages/Preferences"; import NostrSettings from "./pages/NostrSettings"; import AISettings from "./pages/AISettings"; import GitSettings from "./pages/GitSettings"; @@ -26,6 +27,7 @@ export function AppRouter() { } /> }> } /> + } /> } /> } /> } /> diff --git a/src/components/SettingsLayout.tsx b/src/components/SettingsLayout.tsx index ecac4948..48d6de46 100644 --- a/src/components/SettingsLayout.tsx +++ b/src/components/SettingsLayout.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'; import { useNavigate, useLocation, Outlet } from 'react-router-dom'; import { Button } from '@/components/ui/button'; import { ScrollArea } from '@/components/ui/scroll-area'; -import { Menu, Bot, GitBranch, Database, Wifi } from 'lucide-react'; +import { Menu, Bot, GitBranch, Database, Wifi, Settings2 } from 'lucide-react'; import { ProjectSidebar } from '@/components/ProjectSidebar'; import { useProjectsManager } from '@/hooks/useProjectsManager'; import { useIsMobile } from '@/hooks/useIsMobile'; @@ -19,6 +19,13 @@ interface SettingsItem { } const settingsItems: SettingsItem[] = [ + { + id: 'preferences', + title: 'Preferences', + description: 'General application preferences and appearance', + icon: Settings2, + href: '/settings/preferences', + }, { id: 'ai', title: 'AI Settings', diff --git a/src/components/ThemePicker.tsx b/src/components/ThemePicker.tsx new file mode 100644 index 00000000..3cc806b6 --- /dev/null +++ b/src/components/ThemePicker.tsx @@ -0,0 +1,55 @@ +import { ChevronsUpDown, Monitor, Moon, Sun } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { useTheme } from "@/hooks/useTheme"; +import { type Theme } from "@/contexts/AppContext"; + +export function ThemePicker() { + const { theme, setTheme } = useTheme(); + + const themeOptions: { value: Theme; label: string; icon: React.ComponentType<{ className?: string }> }[] = [ + { value: "system", label: "System", icon: Monitor }, + { value: "light", label: "Light", icon: Sun }, + { value: "dark", label: "Dark", icon: Moon }, + ]; + + const currentTheme = themeOptions.find(option => option.value === theme); + const CurrentIcon = currentTheme?.icon || Monitor; + + return ( + + + + + + {themeOptions.map((option) => { + const Icon = option.icon; + return ( + setTheme(option.value)} + className="flex items-center gap-2" + > + + {option.label} + {theme === option.value && ( +
+ )} + + ); + })} + + + ); +} \ No newline at end of file diff --git a/src/pages/Preferences.tsx b/src/pages/Preferences.tsx new file mode 100644 index 00000000..a99d4e45 --- /dev/null +++ b/src/pages/Preferences.tsx @@ -0,0 +1,73 @@ +import { Settings2, ArrowLeft } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { ThemePicker } from "@/components/ThemePicker"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Label } from "@/components/ui/label"; +import { useIsMobile } from "@/hooks/useIsMobile"; +import { useNavigate } from "react-router-dom"; + +export function Preferences() { + const isMobile = useIsMobile(); + const navigate = useNavigate(); + + return ( +
+ {isMobile && ( +
+ +
+

+ + Preferences +

+

+ Manage your general application preferences and appearance settings. +

+
+
+ )} + + {!isMobile && ( +
+

+ + Preferences +

+

+ Manage your general application preferences and appearance settings. +

+
+ )} + + + + Appearance + + Customize how the application looks and feels. + + + +
+ +
+ +
+

+ Choose between light, dark, or system theme preference. +

+
+
+
+
+ ); +} + +export default Preferences; \ No newline at end of file diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx index cff1c07e..5e9f3431 100644 --- a/src/pages/Settings.tsx +++ b/src/pages/Settings.tsx @@ -1,5 +1,5 @@ import { useNavigate } from 'react-router-dom'; -import { Bot, GitBranch, Database, Wifi } from 'lucide-react'; +import { Bot, GitBranch, Database, Wifi, Settings2 } from 'lucide-react'; import { useIsMobile } from '@/hooks/useIsMobile'; interface SettingsItem { @@ -11,6 +11,13 @@ interface SettingsItem { } const settingsItems: SettingsItem[] = [ + { + id: 'preferences', + title: 'Preferences', + description: 'General application preferences and appearance', + icon: Settings2, + href: '/settings/preferences', + }, { id: 'ai', title: 'AI Settings',