From 07d594a373cc3f16e03b767e86032a77ef349c15 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 28 Nov 2025 14:28:36 -0600 Subject: [PATCH] Settings design improvements --- src/components/AppLayout.tsx | 4 +- src/components/SettingsItem.tsx | 53 +++++++++++++ src/components/SettingsLayout.tsx | 66 +++++++--------- src/lib/settingsItems.ts | 127 ++++++++++++++++-------------- src/locales/en.json | 3 + src/locales/ha.json | 3 + src/locales/ig.json | 3 + src/locales/pt.json | 3 + src/locales/yo.json | 3 + src/locales/zh.json | 3 + src/pages/ProjectView.tsx | 4 +- 11 files changed, 175 insertions(+), 97 deletions(-) create mode 100644 src/components/SettingsItem.tsx diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx index 69311d9a..99f4ae5f 100644 --- a/src/components/AppLayout.tsx +++ b/src/components/AppLayout.tsx @@ -99,7 +99,7 @@ export function AppLayout({ onClick={() => setIsSidebarVisible(false)} /> {/* Sidebar - positioned above the backdrop */} -
+
{ @@ -123,7 +123,7 @@ export function AppLayout({
{/* Fixed Sidebar - show if showSidebar is true and sidebar is visible */} {showSidebar && isSidebarVisible && ( -
+
; + title: string; + onClick: () => void; + isActive?: boolean; + className?: string; +} + +export function SettingsItem({ + icon: Icon, + title, + onClick, + isActive = false, + className, +}: SettingsItemProps) { + return ( + + ); +} diff --git a/src/components/SettingsLayout.tsx b/src/components/SettingsLayout.tsx index 636e7ce0..48585ad4 100644 --- a/src/components/SettingsLayout.tsx +++ b/src/components/SettingsLayout.tsx @@ -8,8 +8,8 @@ import { ProjectSidebar } from '@/components/ProjectSidebar'; import { useProjectsManager } from '@/hooks/useProjectsManager'; import { useIsMobile } from '@/hooks/useIsMobile'; import { type Project } from '@/lib/ProjectsManager'; -import { cn } from '@/lib/utils'; -import { getSettingsItems } from '@/lib/settingsItems'; +import { settingsCategories } from '@/lib/settingsItems'; +import { SettingsItem } from '@/components/SettingsItem'; export function SettingsLayout() { const { t } = useTranslation(); @@ -60,9 +60,10 @@ export function SettingsLayout() { }; // Get current settings page - const settingsItems = getSettingsItems(t); const currentPath = location.pathname; - const currentSettingsId = settingsItems.find(item => item.href === currentPath)?.id; + const currentSettingsId = settingsCategories + .flatMap(category => category.items) + .find(item => item.href === currentPath)?.id; if (isMobile) { return ( @@ -89,7 +90,7 @@ export function SettingsLayout() { className="absolute inset-0" onClick={() => setIsSidebarVisible(false)} /> -
+
{ @@ -112,7 +113,7 @@ export function SettingsLayout() {
{/* Left Column - Projects Sidebar (optionally hidden) */} {isSidebarVisible && ( -
+
+
{/* Header with toggle button */}
@@ -146,36 +147,29 @@ export function SettingsLayout() { {/* Settings Navigation - Scrollable */} -
-
- {settingsItems.map((item) => { - const Icon = item.icon; - const isActive = currentSettingsId === item.id; +
+ {settingsCategories.map((category) => ( +
+

+ {t(category.titleKey)} +

+
+ {category.items.map((item) => { + const isActive = currentSettingsId === item.id; - return ( - - ); - })} -
+ return ( + navigate(item.href)} + isActive={isActive} + /> + ); + })} +
+
+ ))}
diff --git a/src/lib/settingsItems.ts b/src/lib/settingsItems.ts index c116a6c1..799e1758 100644 --- a/src/lib/settingsItems.ts +++ b/src/lib/settingsItems.ts @@ -1,73 +1,86 @@ import { Bot, GitBranch, Database, Wifi, Settings2, Info, Settings, Rocket } from 'lucide-react'; -export interface SettingsItem { +export interface SettingsItemConfig { id: string; - title: string; - description: string; icon: React.ComponentType<{ className?: string }>; + titleKey: string; href: string; } +export interface SettingsCategoryConfig { + id: string; + titleKey: string; + items: SettingsItemConfig[]; +} + /** - * Get the list of settings items with translations - * @param t - Translation function from useTranslation hook - * @returns Array of settings items + * Settings structure organized by category */ -export const getSettingsItems = (t: (key: string) => string): SettingsItem[] => [ +export const settingsCategories: SettingsCategoryConfig[] = [ { - id: 'preferences', - title: t('preferences'), - description: t('preferencesDescription'), - icon: Settings2, - href: '/settings/preferences', + id: 'general', + titleKey: 'general', + items: [ + { + id: 'preferences', + icon: Settings2, + titleKey: 'preferences', + href: '/settings/preferences', + }, + ], }, { - id: 'ai', - title: t('aiSettings'), - description: t('aiSettingsDescription'), - icon: Bot, - href: '/settings/ai', + id: 'integrations', + titleKey: 'integrations', + items: [ + { + id: 'ai', + icon: Bot, + titleKey: 'aiSettings', + href: '/settings/ai', + }, + { + id: 'git', + icon: GitBranch, + titleKey: 'gitSettings', + href: '/settings/git', + }, + { + id: 'nostr', + icon: Wifi, + titleKey: 'nostrSettings', + href: '/settings/nostr', + }, + { + id: 'deploy', + icon: Rocket, + titleKey: 'deploySettings', + href: '/settings/deploy', + }, + ], }, { - id: 'git', - title: t('gitSettings'), - description: t('gitSettingsDescription'), - icon: GitBranch, - href: '/settings/git', - }, - { - id: 'deploy', - title: t('deploySettings'), - description: t('deploySettingsDescription'), - icon: Rocket, - href: '/settings/deploy', - }, - { - id: 'nostr', - title: t('nostrSettings'), - description: t('nostrSettingsDescription'), - icon: Wifi, - href: '/settings/nostr', - }, - { - id: 'storage', - title: t('storageSettings'), - description: t('storageSettingsDescription'), - icon: Database, - href: '/settings/storage', - }, - { - id: 'system', - title: t('systemSettings'), - description: t('systemSettingsDescription'), - icon: Settings, - href: '/settings/system', - }, - { - id: 'about', - title: t('aboutShakespeare'), - description: t('aboutShakespeareDescription'), - icon: Info, - href: '/settings/about', + id: 'advanced', + titleKey: 'advanced', + items: [ + { + id: 'storage', + icon: Database, + titleKey: 'storageSettings', + href: '/settings/storage', + }, + { + id: 'system', + icon: Settings, + titleKey: 'systemSettings', + href: '/settings/system', + }, + { + id: 'about', + icon: Info, + titleKey: 'aboutShakespeare', + href: '/settings/about', + }, + ], }, ]; diff --git a/src/locales/en.json b/src/locales/en.json index d1846ce4..53227d9a 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -3,6 +3,9 @@ "settings": "Settings", "backToSettings": "Back to Settings", "help": "Help", + "general": "General", + "integrations": "Integrations", + "advanced": "Advanced", "anonymous": "Anonymous", "logIn": "Log in", "signUp": "Sign up", diff --git a/src/locales/ha.json b/src/locales/ha.json index e7417980..965fd044 100644 --- a/src/locales/ha.json +++ b/src/locales/ha.json @@ -3,6 +3,9 @@ "settings": "Saitunan", "backToSettings": "Koma zuwa Saitunan", "help": "Taimako", + "general": "Gabaɗaya", + "integrations": "Haɗin Kai", + "advanced": "Ci Gaba", "anonymous": "Maras Suna", "logIn": "Shiga", "signUp": "Yi Rajista", diff --git a/src/locales/ig.json b/src/locales/ig.json index 1bab6623..d8deaaa9 100644 --- a/src/locales/ig.json +++ b/src/locales/ig.json @@ -3,6 +3,9 @@ "settings": "Ntọala", "backToSettings": "Laghachi na Ntọala", "help": "Enyemaka", + "general": "Izugbe", + "integrations": "Njikọta", + "advanced": "Dị elu", "anonymous": "Onye na-amaghị aha", "logIn": "Banye", "signUp": "Debanye aha", diff --git a/src/locales/pt.json b/src/locales/pt.json index 9001b49f..97228feb 100644 --- a/src/locales/pt.json +++ b/src/locales/pt.json @@ -3,6 +3,9 @@ "settings": "Configurações", "backToSettings": "Voltar às Configurações", "help": "Ajuda", + "general": "Geral", + "integrations": "Integrações", + "advanced": "Avançado", "anonymous": "Anônimo", "logIn": "Entrar", "signUp": "Cadastrar", diff --git a/src/locales/yo.json b/src/locales/yo.json index f0ee7f49..c55d8b88 100644 --- a/src/locales/yo.json +++ b/src/locales/yo.json @@ -3,6 +3,9 @@ "settings": "Awọn eto", "backToSettings": "Pada si Awọn eto", "help": "Iranlọwọ", + "general": "Gbogbogbo", + "integrations": "Awọn isopọ", + "advanced": "To siwaju", "anonymous": "Alainidamọ", "logIn": "Wọle", "signUp": "Forukọsilẹ", diff --git a/src/locales/zh.json b/src/locales/zh.json index 12485f3c..eb78a3e9 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -3,6 +3,9 @@ "settings": "设置", "backToSettings": "返回设置", "help": "帮助", + "general": "常规", + "integrations": "集成", + "advanced": "高级", "anonymous": "匿名", "logIn": "登录", "signUp": "注册", diff --git a/src/pages/ProjectView.tsx b/src/pages/ProjectView.tsx index 7f7b00ed..3abc4939 100644 --- a/src/pages/ProjectView.tsx +++ b/src/pages/ProjectView.tsx @@ -199,7 +199,7 @@ export function ProjectView() { onClick={() => setIsSidebarVisible(false)} /> {/* Sidebar - positioned above the backdrop */} -
+
{ @@ -314,7 +314,7 @@ export function ProjectView() { return (
{/* Fixed Sidebar */} -
+
{