feat(settings): add category icons

This commit is contained in:
mesalogo
2026-10-09 20:54:23 +08:00
parent 8f1b600798
commit 4205ad6317
4 changed files with 49 additions and 12 deletions
+1
View File
@@ -2181,6 +2181,7 @@ function SettingsPanelView({
tabIndex={activeTab === category.id ? 0 : -1} tabIndex={activeTab === category.id ? 0 : -1}
type="button" type="button"
> >
<category.icon aria-hidden="true" size={16} strokeWidth={1.8} />
<strong> <strong>
{t(`categories.${category.translationKey}.label`)} {t(`categories.${category.translationKey}.label`)}
</strong> </strong>
@@ -2,6 +2,12 @@ import { describe, expect, it } from 'vitest'
import { getSettingsCategoryList } from './settings-categories' import { getSettingsCategoryList } from './settings-categories'
describe('getSettingsCategoryList', () => { describe('getSettingsCategoryList', () => {
it('defines an icon for every settings category', () => {
expect(
getSettingsCategoryList(true).every(({ icon }) => icon != null)
).toBe(true)
})
it('hides SSH hosts while Remote Projects is disabled', () => { it('hides SSH hosts while Remote Projects is disabled', () => {
expect( expect(
getSettingsCategoryList(false).map(({ id }) => id) getSettingsCategoryList(false).map(({ id }) => id)
+35 -11
View File
@@ -1,60 +1,84 @@
import i18n from './i18n' import i18n from './i18n'
import {
Bot,
FileText,
Gauge,
Info,
Palette,
Radio,
Server,
SlidersHorizontal,
Terminal,
Users,
Wrench
} from 'lucide-react'
export const settingsCategoryList = [ export const settingsCategoryList = [
{ {
id: 'appearance', id: 'appearance',
group: 'general', group: 'general',
translationKey: 'appearance' translationKey: 'appearance',
icon: Palette
}, },
{ {
id: 'platform-features', id: 'platform-features',
group: 'general', group: 'general',
translationKey: 'platformFeatures' translationKey: 'platformFeatures',
icon: SlidersHorizontal
}, },
{ {
id: 'model', id: 'model',
group: 'execution', group: 'execution',
translationKey: 'model' translationKey: 'model',
icon: Bot
}, },
{ {
id: 'context-control', id: 'context-control',
group: 'execution', group: 'execution',
translationKey: 'contextControl' translationKey: 'contextControl',
icon: Gauge
}, },
{ {
id: 'runtime', id: 'runtime',
group: 'execution', group: 'execution',
translationKey: 'runtime' translationKey: 'runtime',
icon: Terminal
}, },
{ {
id: 'ssh-hosts', id: 'ssh-hosts',
group: 'execution', group: 'execution',
translationKey: 'sshHosts' translationKey: 'sshHosts',
icon: Server
}, },
{ {
id: 'document-parsing', id: 'document-parsing',
group: 'extensions', group: 'extensions',
translationKey: 'documentParsing' translationKey: 'documentParsing',
icon: FileText
}, },
{ {
id: 'channels', id: 'channels',
group: 'extensions', group: 'extensions',
translationKey: 'channels' translationKey: 'channels',
icon: Radio
}, },
{ {
id: 'roles', id: 'roles',
group: 'extensions', group: 'extensions',
translationKey: 'roles' translationKey: 'roles',
icon: Users
}, },
{ {
id: 'capabilities', id: 'capabilities',
group: 'extensions', group: 'extensions',
translationKey: 'capabilities' translationKey: 'capabilities',
icon: Wrench
}, },
{ {
id: 'about', id: 'about',
group: 'system', group: 'system',
translationKey: 'about' translationKey: 'about',
icon: Info
} }
] as const ] as const
+7 -1
View File
@@ -9361,6 +9361,10 @@ button > svg {
font-weight: 500; font-weight: 500;
} }
.settings-tabs button > svg {
flex: 0 0 auto;
}
.settings-tabs button:hover { .settings-tabs button:hover {
background: var(--surface-muted); background: var(--surface-muted);
color: var(--text-primary); color: var(--text-primary);
@@ -9680,8 +9684,10 @@ button > svg {
min-height: 40px; min-height: 40px;
padding: var(--space-2) var(--space-3); padding: var(--space-2) var(--space-3);
align-items: flex-start; align-items: flex-start;
justify-content: center; justify-content: flex-start;
text-align: left; text-align: left;
flex-direction: row;
gap: var(--space-2);
} }
.settings-page .settings-tabs button strong, .settings-page .settings-tabs button strong,