From cb46e7f3d56696573f7eff86f78cbd8f91c30f5b Mon Sep 17 00:00:00 2001 From: codytseng Date: Sun, 19 Oct 2025 15:03:06 +0800 Subject: [PATCH] refactor: move notification list style setting to appearance page --- .../AppearanceSettingsPage/index.tsx | 38 +++++++++++++++---- .../secondary/GeneralSettingsPage/index.tsx | 27 +------------ 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/pages/secondary/AppearanceSettingsPage/index.tsx b/src/pages/secondary/AppearanceSettingsPage/index.tsx index d2fadd26..e84651d9 100644 --- a/src/pages/secondary/AppearanceSettingsPage/index.tsx +++ b/src/pages/secondary/AppearanceSettingsPage/index.tsx @@ -4,7 +4,7 @@ import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { cn } from '@/lib/utils' import { useTheme } from '@/providers/ThemeProvider' import { useUserPreferences } from '@/providers/UserPreferencesProvider' -import { Monitor, Moon, Sun, Columns2, PanelLeft } from 'lucide-react' +import { Columns2, LayoutList, List, Monitor, Moon, PanelLeft, Sun } from 'lucide-react' import { forwardRef } from 'react' import { useTranslation } from 'react-i18next' @@ -20,14 +20,38 @@ const LAYOUTS = [ { key: true, label: 'Single column', icon: } ] as const +const NOTIFICATION_STYLES = [ + { key: 'detailed', label: 'Detailed', icon: }, + { key: 'compact', label: 'Compact', icon: } +] as const + const AppearanceSettingsPage = forwardRef(({ index }: { index?: number }, ref) => { const { t } = useTranslation() const { themeSetting, setThemeSetting, primaryColor, setPrimaryColor } = useTheme() - const { enableSingleColumnLayout, updateEnableSingleColumnLayout } = useUserPreferences() + const { + enableSingleColumnLayout, + updateEnableSingleColumnLayout, + notificationListStyle, + updateNotificationListStyle + } = useUserPreferences() return (
+
+ +
+ {THEMES.map(({ key, label, icon }) => ( + setThemeSetting(key)} + /> + ))} +
+
@@ -43,15 +67,15 @@ const AppearanceSettingsPage = forwardRef(({ index }: { index?: number }, ref) =
- -
- {THEMES.map(({ key, label, icon }) => ( + +
+ {NOTIFICATION_STYLES.map(({ key, label, icon }) => ( setThemeSetting(key)} + onClick={() => updateNotificationListStyle(key)} /> ))}
diff --git a/src/pages/secondary/GeneralSettingsPage/index.tsx b/src/pages/secondary/GeneralSettingsPage/index.tsx index a4c0f665..7d3e7e46 100644 --- a/src/pages/secondary/GeneralSettingsPage/index.tsx +++ b/src/pages/secondary/GeneralSettingsPage/index.tsx @@ -1,12 +1,11 @@ import { Label } from '@/components/ui/label' import { Select, SelectContent, SelectItem, SelectTrigger } from '@/components/ui/select' import { Switch } from '@/components/ui/switch' -import { MEDIA_AUTO_LOAD_POLICY, NOTIFICATION_LIST_STYLE } from '@/constants' +import { MEDIA_AUTO_LOAD_POLICY } from '@/constants' import { LocalizedLanguageNames, TLanguage } from '@/i18n' import SecondaryPageLayout from '@/layouts/SecondaryPageLayout' import { cn, isSupportCheckConnectionType } from '@/lib/utils' import { useContentPolicy } from '@/providers/ContentPolicyProvider' -import { useUserPreferences } from '@/providers/UserPreferencesProvider' import { useUserTrust } from '@/providers/UserTrustProvider' import { TMediaAutoLoadPolicy } from '@/types' import { SelectValue } from '@radix-ui/react-select' @@ -28,7 +27,6 @@ const GeneralSettingsPage = forwardRef(({ index }: { index?: number }, ref) => { setMediaAutoLoadPolicy } = useContentPolicy() const { hideUntrustedNotes, updateHideUntrustedNotes } = useUserTrust() - const { notificationListStyle, updateNotificationListStyle } = useUserPreferences() const handleLanguageChange = (value: TLanguage) => { i18n.changeLanguage(value) @@ -55,29 +53,6 @@ const GeneralSettingsPage = forwardRef(({ index }: { index?: number }, ref) => { - - - -