diff --git a/src/components/SettingsItemMobile.tsx b/src/components/SettingsItemMobile.tsx
new file mode 100644
index 00000000..20c6dcee
--- /dev/null
+++ b/src/components/SettingsItemMobile.tsx
@@ -0,0 +1,43 @@
+import { ChevronRight } from 'lucide-react';
+import { cn } from '@/lib/utils';
+
+interface SettingsItemMobileProps {
+ icon: React.ComponentType<{ className?: string }>;
+ title: string;
+ onClick: () => void;
+ isFirst?: boolean;
+ isLast?: boolean;
+}
+
+export function SettingsItemMobile({
+ icon: Icon,
+ title,
+ onClick,
+ isFirst = false,
+ isLast = false,
+}: SettingsItemMobileProps) {
+ return (
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/components/SettingsLayout.tsx b/src/components/SettingsLayout.tsx
index 48585ad4..c827d567 100644
--- a/src/components/SettingsLayout.tsx
+++ b/src/components/SettingsLayout.tsx
@@ -8,7 +8,7 @@ import { ProjectSidebar } from '@/components/ProjectSidebar';
import { useProjectsManager } from '@/hooks/useProjectsManager';
import { useIsMobile } from '@/hooks/useIsMobile';
import { type Project } from '@/lib/ProjectsManager';
-import { settingsCategories } from '@/lib/settingsItems';
+import { getSettingsCategories } from '@/lib/settingsItems';
import { SettingsItem } from '@/components/SettingsItem';
export function SettingsLayout() {
@@ -60,6 +60,7 @@ export function SettingsLayout() {
};
// Get current settings page
+ const settingsCategories = getSettingsCategories(t);
const currentPath = location.pathname;
const currentSettingsId = settingsCategories
.flatMap(category => category.items)
@@ -151,7 +152,7 @@ export function SettingsLayout() {
{settingsCategories.map((category) => (
- {t(category.titleKey)}
+ {category.title}
{category.items.map((item) => {
@@ -161,7 +162,7 @@ export function SettingsLayout() {
navigate(item.href)}
isActive={isActive}
/>
diff --git a/src/lib/settingsItems.ts b/src/lib/settingsItems.ts
index 799e1758..3995f660 100644
--- a/src/lib/settingsItems.ts
+++ b/src/lib/settingsItems.ts
@@ -1,84 +1,86 @@
import { Bot, GitBranch, Database, Wifi, Settings2, Info, Settings, Rocket } from 'lucide-react';
-export interface SettingsItemConfig {
+export interface SettingsItem {
id: string;
icon: React.ComponentType<{ className?: string }>;
- titleKey: string;
+ title: string;
href: string;
}
-export interface SettingsCategoryConfig {
+export interface SettingsCategory {
id: string;
- titleKey: string;
- items: SettingsItemConfig[];
+ title: string;
+ items: SettingsItem[];
}
/**
- * Settings structure organized by category
+ * Get the categorized list of settings items with translations
+ * @param t - Translation function from useTranslation hook
+ * @returns Array of settings categories with translated items
*/
-export const settingsCategories: SettingsCategoryConfig[] = [
+export const getSettingsCategories = (t: (key: string) => string): SettingsCategory[] => [
{
id: 'general',
- titleKey: 'general',
+ title: t('general'),
items: [
{
id: 'preferences',
icon: Settings2,
- titleKey: 'preferences',
+ title: t('preferences'),
href: '/settings/preferences',
},
],
},
{
id: 'integrations',
- titleKey: 'integrations',
+ title: t('integrations'),
items: [
{
id: 'ai',
icon: Bot,
- titleKey: 'aiSettings',
+ title: t('aiSettings'),
href: '/settings/ai',
},
{
id: 'git',
icon: GitBranch,
- titleKey: 'gitSettings',
+ title: t('gitSettings'),
href: '/settings/git',
},
{
id: 'nostr',
icon: Wifi,
- titleKey: 'nostrSettings',
+ title: t('nostrSettings'),
href: '/settings/nostr',
},
{
id: 'deploy',
icon: Rocket,
- titleKey: 'deploySettings',
+ title: t('deploySettings'),
href: '/settings/deploy',
},
],
},
{
id: 'advanced',
- titleKey: 'advanced',
+ title: t('advanced'),
items: [
{
id: 'storage',
icon: Database,
- titleKey: 'storageSettings',
+ title: t('storageSettings'),
href: '/settings/storage',
},
{
id: 'system',
icon: Settings,
- titleKey: 'systemSettings',
+ title: t('systemSettings'),
href: '/settings/system',
},
{
id: 'about',
icon: Info,
- titleKey: 'aboutShakespeare',
+ title: t('aboutShakespeare'),
href: '/settings/about',
},
],
diff --git a/src/pages/Settings.tsx b/src/pages/Settings.tsx
index 4d5787ef..6c28306f 100644
--- a/src/pages/Settings.tsx
+++ b/src/pages/Settings.tsx
@@ -1,42 +1,38 @@
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { useIsMobile } from '@/hooks/useIsMobile';
-import { getSettingsItems } from '@/lib/settingsItems';
+import { getSettingsCategories } from '@/lib/settingsItems';
+import { SettingsItemMobile } from '@/components/SettingsItemMobile';
export function Settings() {
const { t } = useTranslation();
const navigate = useNavigate();
const isMobile = useIsMobile();
- const settingsItems = getSettingsItems(t);
+ const settingsCategories = getSettingsCategories(t);
if (isMobile) {
return (
-
-
-
{t('settings')}
-
- {t('settingsDescription')}
-
-
-
- {settingsItems.map((item) => {
- const Icon = item.icon;
- return (
-
navigate(item.href)}
- >
-
-
-
{item.title}
-
{item.description}
-
-
- );
- })}
-
+
+ {settingsCategories.map((category) => (
+
+
+ {category.title}
+
+
+ {category.items.map((item, index) => (
+ navigate(item.href)}
+ isFirst={index === 0}
+ isLast={index === category.items.length - 1}
+ />
+ ))}
+
+
+ ))}
{import.meta.env.VERSION && (
v{import.meta.env.VERSION}
@@ -47,4 +43,4 @@ export function Settings() {
}
}
-export default Settings;
\ No newline at end of file
+export default Settings;