mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Settings design improvements
This commit is contained in:
11 files changed
+175
-97
No files matched your search
@@ -99,7 +99,7 @@ export function AppLayout({
|
||||
onClick={() => setIsSidebarVisible(false)}
|
||||
/>
|
||||
{/* Sidebar - positioned above the backdrop */}
|
||||
<div className="relative left-0 top-0 h-full w-80 max-w-[80vw] bg-background border-r shadow-lg z-10">
|
||||
<div className="relative left-0 top-0 h-full w-72 max-w-[80vw] bg-background border-r shadow-lg z-10">
|
||||
<ProjectSidebar
|
||||
selectedProject={selectedProject}
|
||||
onSelectProject={(project) => {
|
||||
@@ -123,7 +123,7 @@ export function AppLayout({
|
||||
<div className="min-h-screen flex bg-background">
|
||||
{/* Fixed Sidebar - show if showSidebar is true and sidebar is visible */}
|
||||
{showSidebar && isSidebarVisible && (
|
||||
<div className="w-80 border-r bg-sidebar transition-all duration-300">
|
||||
<div className="w-72 border-r bg-sidebar transition-all duration-300">
|
||||
<ProjectSidebar
|
||||
selectedProject={selectedProject}
|
||||
onSelectProject={handleProjectSelect}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { ChevronRight } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
interface SettingsItemProps {
|
||||
icon: React.ComponentType<{ className?: string }>;
|
||||
title: string;
|
||||
onClick: () => void;
|
||||
isActive?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function SettingsItem({
|
||||
icon: Icon,
|
||||
title,
|
||||
onClick,
|
||||
isActive = false,
|
||||
className,
|
||||
}: SettingsItemProps) {
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
className={cn(
|
||||
'group w-full text-left p-2 rounded-lg transition-colors border',
|
||||
{
|
||||
'bg-primary/10 border-transparent': isActive,
|
||||
'border-transparent hover:bg-muted/50': !isActive,
|
||||
},
|
||||
className
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center gap-2.5">
|
||||
<Icon className={cn('h-4 w-4 flex-shrink-0', {
|
||||
'text-primary': isActive,
|
||||
'text-muted-foreground': !isActive,
|
||||
})} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className={cn('text-sm', {
|
||||
'text-primary': isActive,
|
||||
'text-foreground': !isActive,
|
||||
})}>
|
||||
{title}
|
||||
</div>
|
||||
</div>
|
||||
<ChevronRight className={cn(
|
||||
'h-4 w-4 flex-shrink-0 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity',
|
||||
{
|
||||
'text-primary': isActive,
|
||||
}
|
||||
)} />
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -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)}
|
||||
/>
|
||||
<div className="relative left-0 top-0 h-full w-80 max-w-[80vw] bg-background border-r shadow-lg z-10">
|
||||
<div className="relative left-0 top-0 h-full w-72 max-w-[80vw] bg-background border-r shadow-lg z-10">
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={(project) => {
|
||||
@@ -112,7 +113,7 @@ export function SettingsLayout() {
|
||||
<div className="h-screen flex bg-background overflow-hidden">
|
||||
{/* Left Column - Projects Sidebar (optionally hidden) */}
|
||||
{isSidebarVisible && (
|
||||
<div className="w-80 border-r bg-sidebar flex-shrink-0">
|
||||
<div className="w-72 border-r bg-sidebar flex-shrink-0">
|
||||
<ProjectSidebar
|
||||
selectedProject={null}
|
||||
onSelectProject={handleProjectSelect}
|
||||
@@ -123,7 +124,7 @@ export function SettingsLayout() {
|
||||
)}
|
||||
|
||||
{/* Middle Column - Settings Navigation */}
|
||||
<div className="w-96 border-r bg-background flex flex-col flex-shrink-0">
|
||||
<div className="w-72 border-r bg-background flex flex-col flex-shrink-0">
|
||||
{/* Header with toggle button */}
|
||||
<div className="h-12 px-4 py-2 border-b flex-shrink-0">
|
||||
<div className="flex items-center gap-3">
|
||||
@@ -146,36 +147,29 @@ export function SettingsLayout() {
|
||||
|
||||
{/* Settings Navigation - Scrollable */}
|
||||
<ScrollArea className="flex-1">
|
||||
<div className="p-4">
|
||||
<div className="space-y-2">
|
||||
{settingsItems.map((item) => {
|
||||
const Icon = item.icon;
|
||||
const isActive = currentSettingsId === item.id;
|
||||
<div className="p-4 space-y-6">
|
||||
{settingsCategories.map((category) => (
|
||||
<div key={category.id}>
|
||||
<h3 className="text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2 px-2">
|
||||
{t(category.titleKey)}
|
||||
</h3>
|
||||
<div className="space-y-1">
|
||||
{category.items.map((item) => {
|
||||
const isActive = currentSettingsId === item.id;
|
||||
|
||||
return (
|
||||
<button
|
||||
key={item.id}
|
||||
onClick={() => navigate(item.href)}
|
||||
className={cn('w-full text-left p-3 rounded-lg transition-colors border border-transparent', {
|
||||
'bg-primary/10 border border-primary/20': isActive,
|
||||
'hover:bg-muted/50': !isActive,
|
||||
})}
|
||||
>
|
||||
<div className="flex items-start gap-3">
|
||||
<Icon className={`h-5 w-5 mt-0.5 ${isActive ? 'text-primary' : 'text-muted-foreground'}`} />
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className={`font-medium ${isActive ? 'text-primary' : 'text-foreground'}`}>
|
||||
{item.title}
|
||||
</div>
|
||||
<div className="text-sm text-muted-foreground mt-0.5">
|
||||
{item.description}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
return (
|
||||
<SettingsItem
|
||||
key={item.id}
|
||||
icon={item.icon}
|
||||
title={t(item.titleKey)}
|
||||
onClick={() => navigate(item.href)}
|
||||
isActive={isActive}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
|
||||
+70
-57
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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ẹ",
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"settings": "设置",
|
||||
"backToSettings": "返回设置",
|
||||
"help": "帮助",
|
||||
"general": "常规",
|
||||
"integrations": "集成",
|
||||
"advanced": "高级",
|
||||
"anonymous": "匿名",
|
||||
"logIn": "登录",
|
||||
"signUp": "注册",
|
||||
|
||||
@@ -199,7 +199,7 @@ export function ProjectView() {
|
||||
onClick={() => setIsSidebarVisible(false)}
|
||||
/>
|
||||
{/* Sidebar - positioned above the backdrop */}
|
||||
<div className="relative left-0 top-0 h-full w-80 max-w-[80vw] bg-background border-r shadow-lg z-10">
|
||||
<div className="relative left-0 top-0 h-full w-72 max-w-[80vw] bg-background border-r shadow-lg z-10">
|
||||
<ProjectSidebar
|
||||
selectedProject={project}
|
||||
onSelectProject={(selectedProject) => {
|
||||
@@ -314,7 +314,7 @@ export function ProjectView() {
|
||||
return (
|
||||
<div className="h-screen flex bg-background">
|
||||
{/* Fixed Sidebar */}
|
||||
<div className={`w-80 border-r bg-sidebar duration-300 ${isSidebarVisible ? 'block' : 'hidden'}`}>
|
||||
<div className={`w-72 border-r bg-sidebar duration-300 ${isSidebarVisible ? 'block' : 'hidden'}`}>
|
||||
<ProjectSidebar
|
||||
selectedProject={project}
|
||||
onSelectProject={(selectedProject) => {
|
||||
|
||||
Reference in new issue
Block a user