mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Add Preferences page to settings
This commit is contained in:
5 files changed
+146
-2
No files matched your search
@@ -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() {
|
||||
<Route path="/oauth/github" element={<GitHubOAuth />} />
|
||||
<Route path="/settings" element={<SettingsLayout />}>
|
||||
<Route index element={<Settings />} />
|
||||
<Route path="preferences" element={<Preferences />} />
|
||||
<Route path="nostr" element={<NostrSettings />} />
|
||||
<Route path="ai" element={<AISettings />} />
|
||||
<Route path="git" element={<GitSettings />} />
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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 (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="outline" className="w-full justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<CurrentIcon className="h-4 w-4" />
|
||||
<span>{currentTheme?.label || "System"}</span>
|
||||
</div>
|
||||
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-[180px]">
|
||||
{themeOptions.map((option) => {
|
||||
const Icon = option.icon;
|
||||
return (
|
||||
<DropdownMenuItem
|
||||
key={option.value}
|
||||
onClick={() => setTheme(option.value)}
|
||||
className="flex items-center gap-2"
|
||||
>
|
||||
<Icon className="h-4 w-4" />
|
||||
<span>{option.label}</span>
|
||||
{theme === option.value && (
|
||||
<div className="ml-auto h-2 w-2 rounded-full bg-primary" />
|
||||
)}
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
})}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
);
|
||||
}
|
||||
@@ -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 (
|
||||
<div className="p-6 space-y-6">
|
||||
{isMobile && (
|
||||
<div className="space-y-3">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => navigate('/settings')}
|
||||
className="h-8 w-auto px-2 -ml-2"
|
||||
>
|
||||
<ArrowLeft className="h-4 w-4 mr-2" />
|
||||
Back to Settings
|
||||
</Button>
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Settings2 className="h-6 w-6 text-primary" />
|
||||
Preferences
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Manage your general application preferences and appearance settings.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!isMobile && (
|
||||
<div className="space-y-2">
|
||||
<h1 className="text-2xl font-bold flex items-center gap-3">
|
||||
<Settings2 className="h-6 w-6 text-primary" />
|
||||
Preferences
|
||||
</h1>
|
||||
<p className="text-muted-foreground">
|
||||
Manage your general application preferences and appearance settings.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Appearance</CardTitle>
|
||||
<CardDescription>
|
||||
Customize how the application looks and feels.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="theme-picker">Theme</Label>
|
||||
<div className="w-full max-w-xs">
|
||||
<ThemePicker />
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Choose between light, dark, or system theme preference.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Preferences;
|
||||
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user