A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
feat(app): move theme settings into a Themes settings tab
Hampus3a443d7063b2
diff --git a/fluxer_app/src/features/user/components/modals/tabs/AppearanceTab.tsx b/fluxer_app/src/features/user/components/modals/tabs/AppearanceTab.tsxindex 904d87353..0971f361d 100644--- a/fluxer_app/src/features/user/components/modals/tabs/AppearanceTab.tsx+++ b/fluxer_app/src/features/user/components/modals/tabs/AppearanceTab.tsx@@ -25,7 +25,7 @@ import {canResetAppZoomLevel,} from '@app/features/user/components/modals/tabs/appearance_tab/ScalingTab';import {StreamerModeTabContent} from '@app/features/user/components/modals/tabs/appearance_tab/StreamerModeTab';-import {ThemeTabContent} from '@app/features/user/components/modals/tabs/appearance_tab/theme/ThemeTabContent';+import {ThemesLinkContent} from '@app/features/user/components/modals/tabs/appearance_tab/ThemesLinkContent';import inlineStyles from '@app/features/user/components/modals/tabs/TabInline.module.css';import {shouldShowAppZoomLevel} from '@app/features/user/components/settings_utils/AppZoomLevelUtils';import {@@ -48,7 +48,7 @@ const AppearanceSections = observer(() => {return (<><SettingsSection id="theme" title={i18n._(THEME_DESCRIPTOR)} data-flx="user.appearance-tab.theme">- <ThemeTabContent data-flx="user.appearance-tab.theme-tab-content" />+ <ThemesLinkContent data-flx="user.appearance-tab.themes-link-content" /></SettingsSection>{showHdrSettings ? (diff --git a/fluxer_app/src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedSettingsCategories.ts b/fluxer_app/src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedSettingsCategories.tsindex 7053cbe03..b4770c7d5 100644--- a/fluxer_app/src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedSettingsCategories.ts+++ b/fluxer_app/src/features/user/components/modals/tabs/advanced_settings_tab/AdvancedSettingsCategories.ts@@ -58,6 +58,7 @@ const SOURCE_TAB_CATEGORY: Partial<Record<UserSettingsTabType, SettingsCategoryTauthorized_apps: 'privacy',blocked_users: 'privacy',appearance: 'appearance',+ themes: 'appearance',accessibility: 'accessibility',chat_settings: 'chat',voice_video: 'voice',diff --git a/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemesLinkContent.module.css b/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemesLinkContent.module.cssnew file mode 100644index 000000000..70526cc51--- /dev/null+++ b/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemesLinkContent.module.css@@ -0,0 +1,21 @@+/* SPDX-License-Identifier: AGPL-3.0-or-later */++.text {+ margin: 0;+ font-size: 0.875rem;+ line-height: 1.25rem;+ color: var(--text-primary-muted);+}++.link {+ padding: 0;+ border: none;+ background: none;+ color: var(--text-link);+ font: inherit;+ cursor: pointer;+}++.link:hover {+ text-decoration: underline;+}diff --git a/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemesLinkContent.tsx b/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemesLinkContent.tsxnew file mode 100644index 000000000..bafbd1381--- /dev/null+++ b/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemesLinkContent.tsx@@ -0,0 +1,26 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import {openThemesSettings} from '@app/features/theme_settings/commands/ThemeSettingsCommands';+import FocusRing from '@app/features/ui/focus_ring/FocusRing';+import styles from '@app/features/user/components/modals/tabs/appearance_tab/ThemesLinkContent.module.css';+import {Trans} from '@lingui/react/macro';+import type React from 'react';++export const ThemesLinkContent: React.FC = () => (+ <p className={styles.text} data-flx="user.appearance-tab.themes-link-content.text">+ <Trans comment='Shown in Settings > Look and feel. "Themes" is a link to the Themes settings tab.'>+ You can pick a dark or light theme and change colors and quick CSS in{' '}+ <FocusRing offset={-2} data-flx="user.appearance-tab.themes-link-content.focus-ring">+ <button+ type="button"+ className={styles.link}+ onClick={openThemesSettings}+ data-flx="user.appearance-tab.themes-link-content.link.open-themes-tab.button"+ >+ "Themes"+ </button>+ </FocusRing>+ .+ </Trans>+ </p>+);diff --git a/fluxer_app/src/features/user/components/settings_utils/DesktopSettingsTabs.ts b/fluxer_app/src/features/user/components/settings_utils/DesktopSettingsTabs.tsindex 1bd43050e..267adfa25 100644--- a/fluxer_app/src/features/user/components/settings_utils/DesktopSettingsTabs.ts+++ b/fluxer_app/src/features/user/components/settings_utils/DesktopSettingsTabs.ts@@ -1,5 +1,6 @@// SPDX-License-Identifier: AGPL-3.0-or-later+import {ThemesTab} from '@app/features/theme_settings/ThemesTab';import {AccessibilityTab} from '@app/features/user/components/modals/tabs/AccessibilityTab';import AccountSecurityTab from '@app/features/user/components/modals/tabs/AccountSecurityTab';import AdvancedSettingsTab from '@app/features/user/components/modals/tabs/AdvancedSettingsTab';@@ -32,6 +33,7 @@ const DESKTOP_TAB_COMPONENTS: Partial<Record<UserSettingsTabType, React.Componendevices: AccountSecurityTab,linked_accounts: LinkedAccountsTab,appearance: AppearanceTab,+ themes: ThemesTab,accessibility: AccessibilityTab,chat_settings: ChatSettingsTab,voice_video: VoiceVideoTab,diff --git a/fluxer_app/src/features/user/components/settings_utils/SettingsConstants.tsx b/fluxer_app/src/features/user/components/settings_utils/SettingsConstants.tsxindex 6f7fd8e95..e23cd2d49 100644--- a/fluxer_app/src/features/user/components/settings_utils/SettingsConstants.tsx+++ b/fluxer_app/src/features/user/components/settings_utils/SettingsConstants.tsx@@ -18,6 +18,7 @@ import {type SettingsSectionId,type UserSettingsTabType,} from '@app/features/user/components/settings_utils/SettingsSectionRegistry';+import {shouldShowClaimedAccountSettings} from '@app/features/user/components/settings_utils/SettingsVisibility';import {ACCESSIBILITY_DESCRIPTOR,ACCOUNT_DESCRIPTOR as ACCOUNT_SECURITY_DESCRIPTOR,@@ -32,7 +33,6 @@ import {PRIVACY_DESCRIPTOR as PRIVACY_SAFETY_DESCRIPTOR,SHORTCUTS_DESCRIPTOR,} from '@app/features/user/components/settings_utils/section_registry/SharedDescriptors';-import Users from '@app/features/user/state/Users';import {GIFTS_DESCRIPTOR as GIFTS_AND_CODES_DESCRIPTOR,LOOK_AND_FEEL_DESCRIPTOR,@@ -42,10 +42,10 @@ import type {I18n, MessageDescriptor} from '@lingui/core';import {msg} from '@lingui/core/macro';import {Trans} from '@lingui/react/macro';import {+ AtomIcon,BellIcon,ChatCircleIcon,CodeIcon,- CrownIcon,DesktopIcon,DevicesIcon,EyeSlashIcon,@@ -61,6 +61,7 @@ import {ProhibitIcon,RobotIcon,ShieldIcon,+ SwatchesIcon,TranslateIcon,UserIcon,UserListIcon,@@ -103,6 +104,10 @@ const ADVANCED_SETTINGS_DESCRIPTOR = msg({message: 'Advanced',comment: 'User settings tab for power-user and experimental application preferences.',});+const THEMES_DESCRIPTOR = msg({+ message: 'Themes',+ comment: 'User settings tab for the base theme, theme files, colors, fonts and quick CSS.',+});const DESIGN_SYSTEM_DESCRIPTOR = msg({message: 'Design system',comment: 'Developer settings tab showing UI component examples.',@@ -126,6 +131,7 @@ interface SettingsTabDescriptor {label: SettingsTabLabel;icon: Icon;iconWeight?: IconWeight;+ isVisible?: () => boolean;}export function getCategoryLabel(category: UserSettingsTabCategories): React.ReactElement {@@ -147,6 +153,7 @@ const ALL_TABS_DESCRIPTORS: Array<SettingsTabDescriptor> = [category: 'user_settings',label: PROFILE_DESCRIPTOR,icon: UserIcon,+ isVisible: shouldShowClaimedAccountSettings,},{type: 'account_security',@@ -165,6 +172,7 @@ const ALL_TABS_DESCRIPTORS: Array<SettingsTabDescriptor> = [category: 'user_settings',label: CONNECTIONS_DESCRIPTOR,icon: UserListIcon,+ isVisible: shouldShowClaimedAccountSettings,},{type: 'authorized_apps',@@ -188,13 +196,15 @@ const ALL_TABS_DESCRIPTORS: Array<SettingsTabDescriptor> = [type: 'plutonium',category: 'billing',label: getPremiumProductFullName,- icon: CrownIcon,+ icon: AtomIcon,+ isVisible: shouldShowPremiumFeatures,},{type: 'gift_inventory',category: 'billing',label: GIFTS_AND_CODES_DESCRIPTOR,icon: GiftIcon,+ isVisible: shouldShowPremiumFeatures,},{type: 'appearance',@@ -202,6 +212,12 @@ const ALL_TABS_DESCRIPTORS: Array<SettingsTabDescriptor> = [label: LOOK_AND_FEEL_DESCRIPTOR,icon: PaintBrushIcon,},+ {+ type: 'themes',+ category: 'app_settings',+ label: THEMES_DESCRIPTOR,+ icon: SwatchesIcon,+ },{type: 'notifications',category: 'app_settings',@@ -244,6 +260,7 @@ const ALL_TABS_DESCRIPTORS: Array<SettingsTabDescriptor> = [category: 'app_settings',label: DESKTOP_SETTINGS_DESCRIPTOR,icon: DesktopIcon,+ isVisible: isDesktop,},{type: 'advanced_settings',@@ -334,29 +351,16 @@ export function formatUserSettingsPath(return parts.filter(Boolean).join(' > ');}-export const getSettingsTabs = (i18n: I18n): Array<SettingsTab> => {- const allTabs = ALL_TABS_DESCRIPTORS.map((tab) => ({- ...tab,+export const getSettingsTabs = (i18n: I18n): Array<SettingsTab> =>+ ALL_TABS_DESCRIPTORS.filter(+ (tab) => !ACCOUNT_NESTED_TAB_TYPES.some((tabType) => tabType === tab.type) && (tab.isVisible?.() ?? true),+ ).map((tab) => ({+ type: tab.type,+ category: tab.category,label: getUserSettingsTabLabel(i18n, tab.type),+ icon: tab.icon,+ iconWeight: tab.iconWeight,}));- const showPremium = shouldShowPremiumFeatures();- const showClaimedAccountUi = shouldShowClaimedAccountUi();- return allTabs.filter((tab) => {- if (!showClaimedAccountUi && (tab.type === 'my_profile' || tab.type === 'linked_accounts')) {- return false;- }- if (ACCOUNT_NESTED_TAB_TYPES.some((tabType) => tabType === tab.type)) {- return false;- }- if (!showPremium && (tab.type === 'plutonium' || tab.type === 'gift_inventory')) {- return false;- }- if (tab.type === 'desktop_settings' && !isDesktop()) {- return false;- }- return true;- });-};export interface SettingsSubtab {type: UserSettingsSubtabType;@@ -364,10 +368,6 @@ export interface SettingsSubtab {label: string;}-function shouldShowClaimedAccountUi(): boolean {- return Users.getCurrentUser()?.isClaimed() ?? true;-}-function getDesktopSettingsTabLabel(i18n: I18n): string {switch (guessPlatform()) {case 'windows':@@ -382,17 +382,8 @@ function getDesktopSettingsTabLabel(i18n: I18n): string {}export const getSettingsSubtabs = (i18n: I18n): Array<SettingsSubtab> => {- const showClaimedAccountUi = shouldShowClaimedAccountUi();return registryGetAllSectionDefinitions()- .filter((section) => {- if (!showClaimedAccountUi && (section.id === 'account' || section.id === 'security')) {- return false;- }- if ('isVisible' in section && section.isVisible && !section.isVisible()) {- return false;- }- return true;- })+ .filter((section) => !('isVisible' in section && section.isVisible && !section.isVisible())).map((section) => ({type: section.id,parentTab: section.tabType,diff --git a/fluxer_app/src/features/user/components/settings_utils/SettingsSearchIndex.ts b/fluxer_app/src/features/user/components/settings_utils/SettingsSearchIndex.tsindex 81ef28ba6..df61c4df1 100644--- a/fluxer_app/src/features/user/components/settings_utils/SettingsSearchIndex.ts+++ b/fluxer_app/src/features/user/components/settings_utils/SettingsSearchIndex.ts@@ -41,6 +41,7 @@ import type {SearchableSettingDescriptor,SearchableSettingKeyword,} from '@app/features/user/components/settings_utils/search_index/SearchIndexTypes';+import {themesIndex} from '@app/features/user/components/settings_utils/search_index/ThemesIndex';import {voiceVideoIndex} from '@app/features/user/components/settings_utils/search_index/VoiceVideoIndex';import type {I18n} from '@lingui/core';@@ -102,6 +103,7 @@ const ADDITIONAL_SEARCHABLE_ITEMS: Array<SearchableSettingDescriptor> = [...plutoniumIndex,...giftInventoryIndex,...appearanceIndex,+ ...themesIndex,...notificationsIndex,...chatSettingsIndex,...voiceVideoIndex,diff --git a/fluxer_app/src/features/user/components/settings_utils/SettingsSectionRegistry.ts b/fluxer_app/src/features/user/components/settings_utils/SettingsSectionRegistry.tsindex 3f1f8e534..940519303 100644--- a/fluxer_app/src/features/user/components/settings_utils/SettingsSectionRegistry.ts+++ b/fluxer_app/src/features/user/components/settings_utils/SettingsSectionRegistry.ts@@ -14,6 +14,7 @@ import type {SettingsSectionConfig,UserSettingsTabType,} from '@app/features/user/components/settings_utils/section_registry/SectionRegistryTypes';+import {themesSections} from '@app/features/user/components/settings_utils/section_registry/ThemesSections';import {voiceVideoSections} from '@app/features/user/components/settings_utils/section_registry/VoiceVideoSections';import type {I18n} from '@lingui/core';@@ -26,6 +27,7 @@ export type {const SECTION_REGISTRY = [...generalSettingsSections,...appearanceSections,+ ...themesSections,...accessibilitySections,...chatSettingsSections,...voiceVideoSections,diff --git a/fluxer_app/src/features/user/components/settings_utils/UserSettingsDeepLinks.ts b/fluxer_app/src/features/user/components/settings_utils/UserSettingsDeepLinks.tsindex 70f035dc7..6b3fe6b74 100644--- a/fluxer_app/src/features/user/components/settings_utils/UserSettingsDeepLinks.ts+++ b/fluxer_app/src/features/user/components/settings_utils/UserSettingsDeepLinks.ts@@ -26,6 +26,7 @@ const USER_SETTINGS_TAB_TYPES = new Set<UserSettingsTabType>(['blocked_users','devices','appearance',+ 'themes','accessibility','chat_settings','voice_video',diff --git a/fluxer_app/src/features/user/components/settings_utils/search_index/ThemesIndex.ts b/fluxer_app/src/features/user/components/settings_utils/search_index/ThemesIndex.tsnew file mode 100644index 000000000..63e00216c--- /dev/null+++ b/fluxer_app/src/features/user/components/settings_utils/search_index/ThemesIndex.ts@@ -0,0 +1,85 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import {+ EXPORT_LIBRARY_DESCRIPTOR,+ IMPORT_LIBRARY_DESCRIPTOR,+ OPEN_QUICK_CSS_EDITOR_DESCRIPTOR,+ SYNC_CUSTOM_CSS_ACROSS_DEVICES_DESCRIPTOR,+ USE_DESKTOP_APP_THEME_DESCRIPTOR,+} from '@app/features/theme_settings/utils/ThemeSettingsMessageDescriptors';+import MobileLayout from '@app/features/ui/state/MobileLayout';+import {isDesktop} from '@app/features/ui/utils/NativeUtils';+import type {SearchableSettingDescriptor} from '@app/features/user/components/settings_utils/search_index/SearchIndexTypes';+import {msg} from '@lingui/core/macro';++const SAME_THEME_FOR_EVERY_ACCOUNT_DESCRIPTOR = msg({+ message: 'Use the same theme for every account in the desktop app',+ comment: 'Settings search entry description. One-line summary of what the setting controls.',+});+const CSS_EDITOR_DESCRIPTOR = msg({+ message: 'CSS editor',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const CUSTOM_CSS_DESCRIPTOR = msg({+ message: 'Custom CSS',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const ALLOW_TRANSPARENT_DESKTOP_WINDOW_DESCRIPTOR = msg({+ message: 'Allow transparent desktop window',+ comment: 'Settings search entry label. Names the switch in Settings > Themes on the desktop app.',+});++export const themesIndex: Array<SearchableSettingDescriptor> = [+ {+ id: 'themes-use-desktop-app-theme',+ tabType: 'themes',+ sectionId: 'this-account',+ label: USE_DESKTOP_APP_THEME_DESCRIPTOR,+ description: SAME_THEME_FOR_EVERY_ACCOUNT_DESCRIPTOR,+ keywords: [USE_DESKTOP_APP_THEME_DESCRIPTOR],+ tags: ['appearance'],+ isVisible: isDesktop,+ },+ {+ id: 'themes-transparent-window',+ tabType: 'themes',+ sectionId: 'transparent-window',+ label: ALLOW_TRANSPARENT_DESKTOP_WINDOW_DESCRIPTOR,+ keywords: [],+ tags: ['appearance', 'desktop'],+ isVisible: isDesktop,+ },+ {+ id: 'themes-export-library',+ tabType: 'themes',+ sectionId: 'share-and-back-up',+ label: EXPORT_LIBRARY_DESCRIPTOR,+ keywords: [],+ tags: ['appearance'],+ },+ {+ id: 'themes-import-library',+ tabType: 'themes',+ sectionId: 'share-and-back-up',+ label: IMPORT_LIBRARY_DESCRIPTOR,+ keywords: [],+ tags: ['appearance'],+ },+ {+ id: 'themes-open-quick-css-editor',+ tabType: 'themes',+ sectionId: 'quick-css',+ label: OPEN_QUICK_CSS_EDITOR_DESCRIPTOR,+ keywords: [CSS_EDITOR_DESCRIPTOR, CUSTOM_CSS_DESCRIPTOR],+ tags: ['appearance'],+ isVisible: () => !MobileLayout.enabled,+ },+ {+ id: 'themes-sync-custom-css',+ tabType: 'themes',+ sectionId: 'quick-css',+ label: SYNC_CUSTOM_CSS_ACROSS_DEVICES_DESCRIPTOR,+ keywords: [CUSTOM_CSS_DESCRIPTOR],+ tags: ['appearance'],+ },+];diff --git a/fluxer_app/src/features/user/components/settings_utils/section_registry/AppearanceSections.ts b/fluxer_app/src/features/user/components/settings_utils/section_registry/AppearanceSections.tsindex 317acf573..37d1b9630 100644--- a/fluxer_app/src/features/user/components/settings_utils/section_registry/AppearanceSections.ts+++ b/fluxer_app/src/features/user/components/settings_utils/section_registry/AppearanceSections.ts@@ -13,13 +13,10 @@ import {CHANNEL_LIST_DESCRIPTOR,CHAT_INPUT_DESCRIPTOR,COLOR_DESCRIPTOR,- COLORS_DESCRIPTOR,CONFIRM_VOICE_JOIN_DESCRIPTOR,- DEVICES_DESCRIPTOR,DIRECT_MESSAGE_DESCRIPTOR,DOUBLE_CLICK_DESCRIPTOR as DOUBLE_CLICK_2_DESCRIPTOR,DOUBLE_CLICK_DESCRIPTOR,- FONTS_DESCRIPTOR,FRIENDS_DESCRIPTOR,INDICATOR_DESCRIPTOR,JOIN_VOICE_DESCRIPTOR,@@ -53,105 +50,14 @@ import {HIGH_DYNAMIC_RANGE_DESCRIPTOR,SPACE_BETWEEN_MESSAGE_GROUPS_DESCRIPTOR,STREAMER_MODE_DESCRIPTOR,- SYSTEM_THEME_DESCRIPTOR,} from '@app/features/user/utils/UserMessageDescriptors';import {msg} from '@lingui/core/macro';-const CHOOSE_A_BASE_APPEARANCE_MANAGE_QUICK_CSS_ORGANIZE_DESCRIPTOR = msg({- message: 'Choose a base appearance, manage quick CSS, organize saved theme files, and tune theme tokens.',- comment: 'Settings section description. One-line summary of what the settings section controls.',-});const THEME_2_DESCRIPTOR = msg({message: 'Theme',comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',});-const LIGHT_MODE_DESCRIPTOR = msg({- message: 'Light mode',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const DARK_DESCRIPTOR = msg({- message: 'Dark',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const LIGHT_DESCRIPTOR = msg({- message: 'Light',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const COAL_DESCRIPTOR = msg({- message: 'Coal',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const COLOR_SCHEME_DESCRIPTOR = msg({- message: 'Color scheme',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});--const SYNC_DESCRIPTOR = msg({- message: 'Sync',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const SYNC_THEME_DESCRIPTOR = msg({- message: 'Sync theme',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const THEME_SYNC_DESCRIPTOR = msg({- message: 'Theme sync',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const CSS_DESCRIPTOR = msg({- message: 'CSS',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const QUICK_CSS_DESCRIPTOR = msg({- message: 'Quick CSS',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const CUSTOM_DESCRIPTOR = msg({- message: 'Custom',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const THEME_LIBRARY_DESCRIPTOR = msg({- message: 'Theme library',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const THEME_FILES_DESCRIPTOR = msg({- message: 'Theme files',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const IMPORT_THEMES_DESCRIPTOR = msg({- message: 'Import themes',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const EXPORT_THEMES_DESCRIPTOR = msg({- message: 'Export themes',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const THEME_ASSETS_DESCRIPTOR = msg({- message: 'Theme assets',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const LOCAL_FILES_DESCRIPTOR = msg({- message: 'Local files',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const THEME_TOKENS_DESCRIPTOR = msg({- message: 'Theme tokens',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const OVERRIDES_DESCRIPTOR = msg({- message: 'Overrides',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const STYLING_DESCRIPTOR = msg({- message: 'Styling',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const LOOK_AND_FEEL_DESCRIPTOR = msg({- message: 'Look and feel',- comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',-});-const CONTROL_HOW_HDR_IMAGES_ARE_DISPLAYED_ON_HDR_DESCRIPTOR = msg({message: 'Control how HDR images are displayed on HDR-capable monitors.',comment: 'Settings section description. One-line summary of what the settings section controls.',@@ -424,36 +330,7 @@ export const appearanceSections = [id: 'theme',tabType: 'appearance',label: THEME_DESCRIPTOR,- description: CHOOSE_A_BASE_APPEARANCE_MANAGE_QUICK_CSS_ORGANIZE_DESCRIPTOR,- keywords: [- THEME_2_DESCRIPTOR,- DARK_MODE_DESCRIPTOR,- LIGHT_MODE_DESCRIPTOR,- DARK_DESCRIPTOR,- LIGHT_DESCRIPTOR,- COAL_DESCRIPTOR,- COLOR_SCHEME_DESCRIPTOR,- SYSTEM_THEME_DESCRIPTOR,- SYNC_DESCRIPTOR,- SYNC_THEME_DESCRIPTOR,- THEME_SYNC_DESCRIPTOR,- DEVICES_DESCRIPTOR,- CSS_DESCRIPTOR,- QUICK_CSS_DESCRIPTOR,- CUSTOM_DESCRIPTOR,- THEME_LIBRARY_DESCRIPTOR,- THEME_FILES_DESCRIPTOR,- IMPORT_THEMES_DESCRIPTOR,- EXPORT_THEMES_DESCRIPTOR,- THEME_ASSETS_DESCRIPTOR,- LOCAL_FILES_DESCRIPTOR,- THEME_TOKENS_DESCRIPTOR,- OVERRIDES_DESCRIPTOR,- COLORS_DESCRIPTOR,- FONTS_DESCRIPTOR,- STYLING_DESCRIPTOR,- LOOK_AND_FEEL_DESCRIPTOR,- ],+ keywords: [THEME_2_DESCRIPTOR, DARK_MODE_DESCRIPTOR],isAdvanced: false,},{diff --git a/fluxer_app/src/features/user/components/settings_utils/section_registry/SectionRegistryTypes.ts b/fluxer_app/src/features/user/components/settings_utils/section_registry/SectionRegistryTypes.tsindex a6ff7e9d0..f91ce65c4 100644--- a/fluxer_app/src/features/user/components/settings_utils/section_registry/SectionRegistryTypes.ts+++ b/fluxer_app/src/features/user/components/settings_utils/section_registry/SectionRegistryTypes.ts@@ -8,7 +8,7 @@ import type {} from '@app/features/user/components/settings_utils/SettingsMetadata';import type {MessageDescriptor} from '@lingui/core';-export type SectionKeyword = MessageDescriptor | string | (() => string);+type SectionKeyword = MessageDescriptor | string | (() => string);export type UserSettingsTabType =| 'my_profile'@@ -20,6 +20,7 @@ export type UserSettingsTabType =| 'blocked_users'| 'devices'| 'appearance'+ | 'themes'| 'accessibility'| 'chat_settings'| 'voice_video'diff --git a/fluxer_app/src/features/user/components/settings_utils/section_registry/ThemesSections.ts b/fluxer_app/src/features/user/components/settings_utils/section_registry/ThemesSections.tsnew file mode 100644index 000000000..49c9b12c4--- /dev/null+++ b/fluxer_app/src/features/user/components/settings_utils/section_registry/ThemesSections.ts@@ -0,0 +1,223 @@+// SPDX-License-Identifier: AGPL-3.0-or-later++import {isDesktop} from '@app/features/ui/utils/NativeUtils';+import type {SectionDefinition} from '@app/features/user/components/settings_utils/section_registry/SectionRegistryTypes';+import {+ COLORS_DESCRIPTOR,+ DEVICES_DESCRIPTOR,+ FONTS_DESCRIPTOR,+} from '@app/features/user/components/settings_utils/section_registry/SharedDescriptors';+import {DARK_MODE_DESCRIPTOR, SYSTEM_THEME_DESCRIPTOR} from '@app/features/user/utils/UserMessageDescriptors';+import {msg} from '@lingui/core/macro';++export const THIS_ACCOUNT_SECTION_DESCRIPTOR = msg({+ message: 'This account',+ comment:+ 'Section title in Settings > Themes on the desktop app, for choosing whether the current account uses the theme shared by every account.',+});+export const BASE_THEME_SECTION_DESCRIPTOR = msg({+ message: 'Base theme',+ comment: 'Section title in Settings > Themes for picking dark, light, coal or the system theme.',+});+export const YOUR_THEMES_SECTION_DESCRIPTOR = msg({+ message: 'Your themes',+ comment: 'Section title in Settings > Themes listing the CSS theme files the user imported.',+});+export const COLORS_AND_FONTS_SECTION_DESCRIPTOR = msg({+ message: 'Colors and fonts',+ comment: 'Section title in Settings > Themes for changing single colors and fonts of the base theme.',+});+export const QUICK_CSS_SECTION_DESCRIPTOR = msg({+ message: 'Quick CSS',+ comment: 'Section title in Settings > Themes. Quick CSS is custom CSS the user writes to restyle the app.',+});+export const ASSETS_SECTION_DESCRIPTOR = msg({+ message: 'Assets',+ comment: 'Section title in Settings > Themes for images and fonts the user uploads to use in custom CSS.',+});+export const DESKTOP_WINDOW_SECTION_DESCRIPTOR = msg({+ message: 'Desktop window',+ comment: 'Section title in Settings > Themes on the desktop app for window transparency.',+});+export const SHARE_AND_BACK_UP_SECTION_DESCRIPTOR = msg({+ message: 'Share and back up',+ comment: 'Section title in Settings > Themes for sharing a theme, exporting and importing the theme library.',+});++const THEME_DESCRIPTOR = msg({+ message: 'Theme',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const LIGHT_MODE_DESCRIPTOR = msg({+ message: 'Light mode',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const DARK_DESCRIPTOR = msg({+ message: 'Dark',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const LIGHT_DESCRIPTOR = msg({+ message: 'Light',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const COAL_DESCRIPTOR = msg({+ message: 'Coal',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const COLOR_SCHEME_DESCRIPTOR = msg({+ message: 'Color scheme',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const SYNC_DESCRIPTOR = msg({+ message: 'Sync',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const SYNC_THEME_DESCRIPTOR = msg({+ message: 'Sync theme',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const THEME_SYNC_DESCRIPTOR = msg({+ message: 'Theme sync',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const DESKTOP_APP_THEME_KEYWORD_DESCRIPTOR = msg({+ message: 'Desktop app theme',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const ACCOUNTS_DESCRIPTOR = msg({+ message: 'Accounts',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const CSS_DESCRIPTOR = msg({+ message: 'CSS',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const CUSTOM_DESCRIPTOR = msg({+ message: 'Custom',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const STYLING_DESCRIPTOR = msg({+ message: 'Styling',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const THEME_LIBRARY_DESCRIPTOR = msg({+ message: 'Theme library',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const THEME_FILES_DESCRIPTOR = msg({+ message: 'Theme files',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const IMPORT_THEMES_DESCRIPTOR = msg({+ message: 'Import themes',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const EXPORT_THEMES_DESCRIPTOR = msg({+ message: 'Export themes',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const THEME_ASSETS_DESCRIPTOR = msg({+ message: 'Theme assets',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const LOCAL_FILES_DESCRIPTOR = msg({+ message: 'Local files',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const THEME_TOKENS_DESCRIPTOR = msg({+ message: 'Theme tokens',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const OVERRIDES_DESCRIPTOR = msg({+ message: 'Overrides',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const TRANSPARENCY_DESCRIPTOR = msg({+ message: 'Transparency',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const SHARE_THEME_KEYWORD_DESCRIPTOR = msg({+ message: 'Share theme',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const BACKUP_DESCRIPTOR = msg({+ message: 'Backup',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});+const RESET_THEME_DESCRIPTOR = msg({+ message: 'Reset theme',+ comment: 'Settings search synonym. Used to match this term when the user types it in the settings search bar.',+});++export const themesSections = [+ {+ id: 'this-account',+ tabType: 'themes',+ label: THIS_ACCOUNT_SECTION_DESCRIPTOR,+ keywords: [THEME_DESCRIPTOR, DESKTOP_APP_THEME_KEYWORD_DESCRIPTOR, ACCOUNTS_DESCRIPTOR, SYNC_DESCRIPTOR],+ isAdvanced: false,+ isVisible: isDesktop,+ },+ {+ id: 'base-theme',+ tabType: 'themes',+ label: BASE_THEME_SECTION_DESCRIPTOR,+ keywords: [+ THEME_DESCRIPTOR,+ DARK_MODE_DESCRIPTOR,+ LIGHT_MODE_DESCRIPTOR,+ DARK_DESCRIPTOR,+ LIGHT_DESCRIPTOR,+ COAL_DESCRIPTOR,+ COLOR_SCHEME_DESCRIPTOR,+ SYSTEM_THEME_DESCRIPTOR,+ SYNC_THEME_DESCRIPTOR,+ THEME_SYNC_DESCRIPTOR,+ DEVICES_DESCRIPTOR,+ ],+ isAdvanced: false,+ },+ {+ id: 'your-themes',+ tabType: 'themes',+ label: YOUR_THEMES_SECTION_DESCRIPTOR,+ keywords: [THEME_LIBRARY_DESCRIPTOR, THEME_FILES_DESCRIPTOR, IMPORT_THEMES_DESCRIPTOR, CSS_DESCRIPTOR],+ isAdvanced: false,+ },+ {+ id: 'colors-and-fonts',+ tabType: 'themes',+ label: COLORS_AND_FONTS_SECTION_DESCRIPTOR,+ keywords: [COLORS_DESCRIPTOR, FONTS_DESCRIPTOR, THEME_TOKENS_DESCRIPTOR, OVERRIDES_DESCRIPTOR, STYLING_DESCRIPTOR],+ isAdvanced: false,+ },+ {+ id: 'assets',+ tabType: 'themes',+ label: ASSETS_SECTION_DESCRIPTOR,+ keywords: [THEME_ASSETS_DESCRIPTOR, LOCAL_FILES_DESCRIPTOR, FONTS_DESCRIPTOR],+ isAdvanced: false,+ },+ {+ id: 'transparent-window',+ tabType: 'themes',+ label: DESKTOP_WINDOW_SECTION_DESCRIPTOR,+ keywords: [TRANSPARENCY_DESCRIPTOR],+ isAdvanced: false,+ isVisible: isDesktop,+ },+ {+ id: 'share-and-back-up',+ tabType: 'themes',+ label: SHARE_AND_BACK_UP_SECTION_DESCRIPTOR,+ keywords: [SHARE_THEME_KEYWORD_DESCRIPTOR, EXPORT_THEMES_DESCRIPTOR, BACKUP_DESCRIPTOR, RESET_THEME_DESCRIPTOR],+ isAdvanced: false,+ },+ {+ id: 'quick-css',+ tabType: 'themes',+ label: QUICK_CSS_SECTION_DESCRIPTOR,+ keywords: [CSS_DESCRIPTOR, CUSTOM_DESCRIPTOR, STYLING_DESCRIPTOR, SYNC_DESCRIPTOR],+ isAdvanced: false,+ },+] as const satisfies ReadonlyArray<SectionDefinition>;