From b2232f43550d63b82272a0a9a83de403689bbd16 Mon Sep 17 00:00:00 2001 From: CaIon Date: Wed, 29 Apr 2026 20:09:07 +0800 Subject: [PATCH] feat(ui): add system settings to sidebar and unhide frontend theme switcher - Add System Settings entry to Admin sidebar group with Settings icon - Register /system-settings URL mapping in sidebar config - Remove 3-click hidden unlock from Frontend Theme setting, making it directly visible in System Information section --- .../general/system-info-section.tsx | 68 ++++++++----------- web/default/src/hooks/use-sidebar-config.ts | 2 + web/default/src/hooks/use-sidebar-data.ts | 7 ++ 3 files changed, 39 insertions(+), 38 deletions(-) diff --git a/web/default/src/features/system-settings/general/system-info-section.tsx b/web/default/src/features/system-settings/general/system-info-section.tsx index 6993662a..ff5064a7 100644 --- a/web/default/src/features/system-settings/general/system-info-section.tsx +++ b/web/default/src/features/system-settings/general/system-info-section.tsx @@ -3,7 +3,6 @@ import type { Resolver } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' import { RotateCcw } from 'lucide-react' import { useTranslation } from 'react-i18next' -import { useHiddenClickUnlock } from '@/hooks/use-hidden-click-unlock' import { Button } from '@/components/ui/button' import { Form, @@ -60,7 +59,6 @@ function normalizeValue(value: unknown): string { export function SystemInfoSection({ defaultValues }: SystemInfoSectionProps) { const { t } = useTranslation() const updateOption = useUpdateOption() - const frontendThemeUnlock = useHiddenClickUnlock({ requiredClicks: 3 }) const normalizedDefaults: SystemInfoFormValues = { theme: { @@ -127,47 +125,41 @@ export function SystemInfoSection({ defaultValues }: SystemInfoSectionProps) {
- {frontendThemeUnlock.unlocked && ( - ( - - {t('Frontend Theme')} - - - {t( - 'Switch between the new frontend and the classic frontend. Changes take effect after page reload.' - )} - - - - )} - /> - )} + ( + + {t('Frontend Theme')} + + + {t( + 'Switch between the new frontend and the classic frontend. Changes take effect after page reload.' + )} + + + + )} + /> = { '/users': { section: 'admin', module: 'user' }, '/redemption-codes': { section: 'admin', module: 'redemption' }, '/subscriptions': { section: 'admin', module: 'subscription' }, + '/system-settings': { section: 'admin', module: 'setting' }, + '/system-settings/general': { section: 'admin', module: 'setting' }, } /** diff --git a/web/default/src/hooks/use-sidebar-data.ts b/web/default/src/hooks/use-sidebar-data.ts index 04249535..66265da5 100644 --- a/web/default/src/hooks/use-sidebar-data.ts +++ b/web/default/src/hooks/use-sidebar-data.ts @@ -14,6 +14,7 @@ import { MessageSquare, CreditCard, ListTodo, + Settings, } from 'lucide-react' import { useTranslation } from 'react-i18next' import { WORKSPACE_IDS } from '@/components/layout/lib/workspace-registry' @@ -120,6 +121,12 @@ export function useSidebarData(): SidebarData { url: '/subscriptions', icon: CreditCard, }, + { + title: t('System Settings'), + url: '/system-settings/general', + activeUrls: ['/system-settings'], + icon: Settings, + }, ], }, ],