Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

feat(app): pick the base theme and window style in themes tab

Hampus628ef92fb6ba
diff --git a/fluxer_app/src/features/theme_settings/components/BaseThemeSection.tsx b/fluxer_app/src/features/theme_settings/components/BaseThemeSection.tsx
new file mode 100644
index 000000000..ae740d43c
--- /dev/null
+++ b/fluxer_app/src/features/theme_settings/components/BaseThemeSection.tsx
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {SettingsSection} from '@app/features/app/components/dialogs/shared/SettingsSection';
+import * as ThemeProfileCommands from '@app/features/theme/commands/ThemeProfileCommands';
+import AccountTheme from '@app/features/theme/state/AccountTheme';
+import ThemeEditTarget from '@app/features/theme/state/ThemeEditTarget';
+import ThemeProfile from '@app/features/theme/state/ThemeProfile';
+import {ThemeSelector} from '@app/features/theme_settings/components/ThemeSelector';
+import styles from '@app/features/theme_settings/ThemesTab.module.css';
+import {Switch} from '@app/features/ui/components/form/FormSwitch';
+import {BASE_THEME_SECTION_DESCRIPTOR} from '@app/features/user/components/settings_utils/section_registry/ThemesSections';
+import type {ThemeType} from '@fluxer/constants/src/UserConstants';
+import {msg} from '@lingui/core/macro';
+import {useLingui} from '@lingui/react/macro';
+import {observer} from 'mobx-react-lite';
+import type React from 'react';
+import {useCallback} from 'react';
+
+const SYNC_THEME_ACROSS_DEVICES_DESCRIPTOR = msg({
+ message: 'Sync theme across devices',
+ comment: 'Label in the theme tab content.',
+});
+const WHEN_ENABLED_THEME_CHANGES_WILL_SYNC_TO_ALL_DESCRIPTOR = msg({
+ message: 'Theme changes sync to all your devices. Off keeps this device on its own theme.',
+ comment: 'Label in the theme tab content.',
+});
+const DESKTOP_BASE_THEME_NOTE_DESCRIPTOR = msg({
+ message: 'Every account that uses the desktop app theme gets this base theme.',
+ comment: 'Shown under the base theme picker in Settings > Themes while editing the desktop app theme.',
+});
+
+export const BaseThemeSection: React.FC = observer(() => {
+ const {i18n} = useLingui();
+ const target = ThemeEditTarget.target;
+ const selectedTheme = ThemeProfile.themePreferenceFor(target);
+ const handleThemeChange = useCallback(
+ (theme: ThemeType) => {
+ if (theme === selectedTheme) return;
+ ThemeProfileCommands.setThemePreference(theme, target);
+ },
+ [selectedTheme, target],
+ );
+ return (
+ <SettingsSection
+ id="base-theme"
+ title={i18n._(BASE_THEME_SECTION_DESCRIPTOR)}
+ data-flx="theme-settings.base-theme-section.base-theme"
+ >
+ <ThemeSelector
+ value={selectedTheme}
+ onChange={handleThemeChange}
+ data-flx="theme-settings.base-theme-section.theme-selector.theme-change"
+ />
+ {target === 'account' ? (
+ <Switch
+ label={i18n._(SYNC_THEME_ACROSS_DEVICES_DESCRIPTOR)}
+ description={i18n._(WHEN_ENABLED_THEME_CHANGES_WILL_SYNC_TO_ALL_DESCRIPTOR)}
+ value={AccountTheme.syncAcrossDevices}
+ onChange={(value) => ThemeProfileCommands.setSyncAcrossDevices(value)}
+ data-flx="theme-settings.base-theme-section.switch.set-sync-across-devices"
+ />
+ ) : (
+ <p className={styles.note} data-flx="theme-settings.base-theme-section.note">
+ {i18n._(DESKTOP_BASE_THEME_NOTE_DESCRIPTOR)}
+ </p>
+ )}
+ </SettingsSection>
+ );
+});
diff --git a/fluxer_app/src/features/theme_settings/components/DesktopWindowSection.tsx b/fluxer_app/src/features/theme_settings/components/DesktopWindowSection.tsx
new file mode 100644
index 000000000..0be8931fa
--- /dev/null
+++ b/fluxer_app/src/features/theme_settings/components/DesktopWindowSection.tsx
@@ -0,0 +1,142 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
+import {SettingsSection} from '@app/features/app/components/dialogs/shared/SettingsSection';
+import {useNativePlatform} from '@app/features/app/hooks/useNativePlatform';
+import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
+import styles from '@app/features/theme_settings/ThemesTab.module.css';
+import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
+import {modal} from '@app/features/ui/commands/ModalCommands';
+import {Switch} from '@app/features/ui/components/form/FormSwitch';
+import {
+ getCachedDesktopWindowBehaviorSettings,
+ getDesktopWindowBehaviorSettings,
+ relaunchDesktopApp,
+ setDesktopWindowBehaviorSettings,
+} from '@app/features/ui/utils/DesktopWindowBehaviorUtils';
+import {DESKTOP_WINDOW_SECTION_DESCRIPTOR} from '@app/features/user/components/settings_utils/section_registry/ThemesSections';
+import type {DesktopWindowBehaviorSettings} from '@app/types/electron.d';
+import {msg} from '@lingui/core/macro';
+import {Trans, useLingui} from '@lingui/react/macro';
+import {observer} from 'mobx-react-lite';
+import type React from 'react';
+import {useEffect, useState} from 'react';
+
+const ALLOW_TRANSPARENT_DESKTOP_WINDOW_DESCRIPTOR = msg({
+ message: 'Allow transparent desktop window',
+ comment: 'Switch label in Settings > Themes on the desktop app.',
+});
+const ALLOW_TRANSPARENT_DESKTOP_WINDOW_DESCRIPTION_DESCRIPTOR = msg({
+ message: 'Lets custom CSS reveal transparent window regions after restarting the desktop app.',
+ comment: 'Description of the "Allow transparent desktop window" switch in Settings > Themes.',
+});
+const RESTART_DESCRIPTOR = msg({
+ message: 'Restart {productName}?',
+ comment: 'Confirmation title after changing desktop transparency in Settings > Themes.',
+});
+const TRANSPARENCY_RESTART_DESCRIPTION_DESCRIPTOR = msg({
+ message: 'Desktop window transparency changes apply after restarting the app.',
+ comment: 'Confirmation text after changing desktop transparency in Settings > Themes.',
+});
+const RESTART_NOW_DESCRIPTOR = msg({
+ message: 'Restart now',
+ comment: 'Confirm button that restarts the desktop app.',
+});
+const LATER_DESCRIPTOR = msg({
+ message: 'Later',
+ comment: 'Button that closes the restart prompt without restarting.',
+});
+
+export const DesktopWindowSection: React.FC = observer(() => {
+ const {i18n} = useLingui();
+ const {isLinux, isWindows} = useNativePlatform();
+ const [settings, setSettings] = useState<DesktopWindowBehaviorSettings | null>(
+ getCachedDesktopWindowBehaviorSettings(),
+ );
+ const [busy, setBusy] = useState(false);
+ useEffect(() => {
+ void getDesktopWindowBehaviorSettings().then(setSettings);
+ }, []);
+ if (!settings) {
+ return null;
+ }
+ const handleChange = (value: boolean) => {
+ setBusy(true);
+ void setDesktopWindowBehaviorSettings({allowTransparency: value})
+ .then((nextSettings) => {
+ if (nextSettings) {
+ setSettings(nextSettings);
+ }
+ ModalCommands.push(
+ modal(() => (
+ <ConfirmModal
+ title={i18n._(RESTART_DESCRIPTOR, {productName: RuntimeConfig.productName})}
+ description={i18n._(TRANSPARENCY_RESTART_DESCRIPTION_DESCRIPTOR)}
+ primaryText={i18n._(RESTART_NOW_DESCRIPTOR)}
+ secondaryText={i18n._(LATER_DESCRIPTOR)}
+ onPrimary={async () => relaunchDesktopApp()}
+ data-flx="theme-settings.desktop-window-section.handle-change.confirm-modal"
+ />
+ )),
+ );
+ })
+ .finally(() => setBusy(false));
+ };
+ return (
+ <SettingsSection
+ id="transparent-window"
+ title={i18n._(DESKTOP_WINDOW_SECTION_DESCRIPTOR)}
+ data-flx="theme-settings.desktop-window-section.transparent-window"
+ >
+ <Switch
+ label={i18n._(ALLOW_TRANSPARENT_DESKTOP_WINDOW_DESCRIPTOR)}
+ description={i18n._(ALLOW_TRANSPARENT_DESKTOP_WINDOW_DESCRIPTION_DESCRIPTOR)}
+ value={settings.allowTransparency}
+ disabled={busy}
+ onChange={handleChange}
+ data-flx="theme-settings.desktop-window-section.switch.change"
+ />
+ {isLinux && settings.allowTransparency ? (
+ <ul className={styles.notice} data-flx="theme-settings.desktop-window-section.notice">
+ <li data-flx="theme-settings.desktop-window-section.li">
+ <Trans>
+ Resizing, maximizing, and window snapping depend on the compositor. Wayland without client-side
+ decorations may not provide handles. Launch with --ozone-platform=x11 if the window feels stuck.
+ </Trans>
+ </li>
+ <li data-flx="theme-settings.desktop-window-section.li--2">
+ <Trans>
+ Hardware acceleration can cause rendering glitches with transparent windows. Try --disable-gpu if you see
+ flicker or smearing.
+ </Trans>
+ </li>
+ <li data-flx="theme-settings.desktop-window-section.li--3">
+ <Trans>
+ Docked DevTools and windows partially off-screen can render a gray background instead of staying
+ transparent.
+ </Trans>
+ </li>
+ </ul>
+ ) : null}
+ {isWindows && settings.allowTransparency ? (
+ <ul className={styles.notice} data-flx="theme-settings.desktop-window-section.notice--2">
+ <li data-flx="theme-settings.desktop-window-section.li--4">
+ <Trans>Aero Snap and Snap Layouts can stop working while transparency is enabled.</Trans>
+ </li>
+ <li data-flx="theme-settings.desktop-window-section.li--5">
+ <Trans>
+ Windows cut off at the top or bottom of the screen, and docked DevTools, can render a gray background
+ instead of staying transparent.
+ </Trans>
+ </li>
+ <li data-flx="theme-settings.desktop-window-section.li--6">
+ <Trans>
+ Text is rendered with grayscale antialiasing instead of ClearType while transparency is enabled, so it
+ will look softer.
+ </Trans>
+ </li>
+ </ul>
+ ) : null}
+ </SettingsSection>
+ );
+});
diff --git a/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/theme/ThemeButton.tsx b/fluxer_app/src/features/theme_settings/components/ThemeButton.tsx
similarity index 80%
rename from fluxer_app/src/features/user/components/modals/tabs/appearance_tab/theme/ThemeButton.tsx
rename to fluxer_app/src/features/theme_settings/components/ThemeButton.tsx
index eea8f1c4e..e8a6ccb4d 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/theme/ThemeButton.tsx
+++ b/fluxer_app/src/features/theme_settings/components/ThemeButton.tsx
@@ -1,15 +1,15 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {remFromPx} from '@app/features/theme/layout/RemFromPx';
+import styles from '@app/features/theme_settings/components/ThemeSelector.module.css';
import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import styles from '@app/features/user/components/modals/tabs/appearance_tab/ThemeTab.module.css';
import type {ThemeType} from '@fluxer/constants/src/UserConstants';
import {CheckIcon} from '@phosphor-icons/react';
import {clsx} from 'clsx';
import {observer} from 'mobx-react-lite';
import React from 'react';
-export interface ThemeButtonProps {
+interface ThemeButtonProps {
themeType: ThemeType;
currentTheme: ThemeType;
label: string;
@@ -25,17 +25,14 @@ export const ThemeButton = observer(
React.forwardRef<HTMLButtonElement, ThemeButtonProps>(
({themeType, currentTheme, label, backgroundColor, isLight, disabled = false, onKeyDown, onClick, icon}, ref) => {
const isSelected = currentTheme === themeType;
- const getButtonClassName = () => {
- const classes = [styles.themeButton];
- if (isSelected) {
- classes.push(styles.themeButtonSelected);
- } else if (isLight) {
- classes.push(styles.themeButtonLight);
- } else {
- classes.push(styles.themeButtonDark);
- }
- return clsx(classes);
- };
+ const classes = [styles.themeButton];
+ if (isSelected) {
+ classes.push(styles.themeButtonSelected);
+ } else if (isLight) {
+ classes.push(styles.themeButtonLight);
+ } else {
+ classes.push(styles.themeButtonDark);
+ }
return (
<FocusRing offset={-2} data-flx="user.appearance-tab.theme.theme-button.focus-ring">
<button
@@ -43,14 +40,14 @@ export const ThemeButton = observer(
type="button"
onClick={() => onClick(themeType)}
onKeyDown={(e) => onKeyDown(e, themeType)}
- className={getButtonClassName()}
+ className={clsx(classes)}
style={{backgroundColor}}
disabled={disabled}
role="radio"
aria-checked={isSelected}
aria-disabled={disabled}
aria-label={label}
- tabIndex={disabled ? -1 : isSelected ? 0 : -1}
+ tabIndex={!disabled && isSelected ? 0 : -1}
data-flx="user.appearance-tab.theme.theme-button.radio.click.button"
>
{icon && (
diff --git a/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemeTab.module.css b/fluxer_app/src/features/theme_settings/components/ThemeSelector.module.css
similarity index 97%
rename from fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemeTab.module.css
rename to fluxer_app/src/features/theme_settings/components/ThemeSelector.module.css
index 610de273e..db47daf89 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/ThemeTab.module.css
+++ b/fluxer_app/src/features/theme_settings/components/ThemeSelector.module.css
@@ -48,7 +48,7 @@
.themeButtonCheckmark {
position: absolute;
top: -0.25rem;
- right: -0.25rem;
+ inset-inline-end: -0.25rem;
display: flex;
height: 1.25rem;
width: 1.25rem;
diff --git a/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/theme/ThemeTabContent.tsx b/fluxer_app/src/features/theme_settings/components/ThemeSelector.tsx
similarity index 73%
rename from fluxer_app/src/features/user/components/modals/tabs/appearance_tab/theme/ThemeTabContent.tsx
rename to fluxer_app/src/features/theme_settings/components/ThemeSelector.tsx
index 24b93ab00..03524490a 100644
--- a/fluxer_app/src/features/user/components/modals/tabs/appearance_tab/theme/ThemeTabContent.tsx
+++ b/fluxer_app/src/features/theme_settings/components/ThemeSelector.tsx
@@ -2,21 +2,17 @@
import {THEME_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {isKeyboardActivationKey} from '@app/features/input/utils/KeyboardUtils';
-import * as ThemePreferenceCommands from '@app/features/theme/commands/ThemePreferenceCommands';
import {remFromPx} from '@app/features/theme/layout/RemFromPx';
import Theme from '@app/features/theme/state/Theme';
-import * as ThemeStudioCommands from '@app/features/theme_studio/commands/ThemeStudioCommands';
-import {Button} from '@app/features/ui/button/Button';
-import {Switch} from '@app/features/ui/components/form/FormSwitch';
+import {ThemeButton} from '@app/features/theme_settings/components/ThemeButton';
+import styles from '@app/features/theme_settings/components/ThemeSelector.module.css';
import {Tooltip} from '@app/features/ui/tooltip/Tooltip';
-import styles from '@app/features/user/components/modals/tabs/appearance_tab/ThemeTab.module.css';
-import {ThemeButton} from '@app/features/user/components/modals/tabs/appearance_tab/theme/ThemeButton';
import {SYSTEM_THEME_DESCRIPTOR} from '@app/features/user/utils/UserMessageDescriptors';
import type {ThemeType} from '@fluxer/constants/src/UserConstants';
import {ThemeTypes} from '@fluxer/constants/src/UserConstants';
import {msg} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
-import {ArrowsCounterClockwiseIcon, PaintBrushBroadIcon} from '@phosphor-icons/react';
+import {ArrowsCounterClockwiseIcon} from '@phosphor-icons/react';
import {observer} from 'mobx-react-lite';
import type React from 'react';
import {useCallback, useEffect, useMemo, useRef} from 'react';
@@ -62,19 +58,6 @@ const SYSTEM_LIGHT_THEME_AUTOMATICALLY_SYNC_WITH_YOUR_SYSTEM_DESCRIPTOR = msg({
message: "System: light theme (automatically sync with your system's dark/light preference)",
comment: 'Description text in the theme tab content.',
});
-const SYNC_THEME_ACROSS_DEVICES_DESCRIPTOR = msg({
- message: 'Sync theme across devices',
- comment: 'Label in the theme tab content.',
-});
-const WHEN_ENABLED_THEME_CHANGES_WILL_SYNC_TO_ALL_DESCRIPTOR = msg({
- message: 'Theme changes sync to all your devices. Off keeps this device on its own theme.',
- comment: 'Label in the theme tab content.',
-});
-const OPEN_THEME_STUDIO_DESCRIPTOR = msg({
- message: 'Open theme studio…',
- comment: 'Button or menu action label in the theme tab content. Keep it concise.',
-});
-
interface ThemeSelectorProps {
value: ThemeType;
onChange: (theme: ThemeType) => void;
@@ -223,50 +206,3 @@ export const ThemeSelector: React.FC<ThemeSelectorProps> = observer(({value, onC
</div>
);
});
-
-export const ThemeTabContent: React.FC = observer(() => {
- const {i18n} = useLingui();
- const syncAcrossDevices = Theme.syncAcrossDevices;
- const themePreference = Theme.themePreference;
- const currentSelectedTheme: ThemeType = themePreference;
- const handleThemeChange = useCallback(
- (newTheme: ThemeType) => {
- if (newTheme === currentSelectedTheme) return;
- ThemePreferenceCommands.updateThemePreference(newTheme);
- },
- [currentSelectedTheme],
- );
- const handleOpenStudio = useCallback(() => {
- ThemeStudioCommands.openThemeStudio();
- }, []);
- return (
- <>
- <ThemeSelector
- value={currentSelectedTheme}
- onChange={handleThemeChange}
- data-flx="user.appearance-tab.theme.theme-tab-content.theme-selector.theme-change"
- />
- <Switch
- label={i18n._(SYNC_THEME_ACROSS_DEVICES_DESCRIPTOR)}
- description={i18n._(WHEN_ENABLED_THEME_CHANGES_WILL_SYNC_TO_ALL_DESCRIPTOR)}
- value={syncAcrossDevices}
- onChange={(value) => ThemePreferenceCommands.setSyncAcrossDevices(value)}
- data-flx="user.appearance-tab.theme.theme-tab-content.switch.set-sync-across-devices"
- />
- <Button
- variant="secondary"
- fitContent
- leftIcon={
- <PaintBrushBroadIcon
- size={18}
- data-flx="user.appearance-tab.theme.theme-tab-content.paint-brush-broad-icon"
- />
- }
- onClick={handleOpenStudio}
- data-flx="user.appearance-tab.theme.theme-tab-content.button.open-studio"
- >
- {i18n._(OPEN_THEME_STUDIO_DESCRIPTOR)}
- </Button>
- </>
- );
-});
diff --git a/fluxer_app/src/features/theme_settings/components/ThisAccountSection.tsx b/fluxer_app/src/features/theme_settings/components/ThisAccountSection.tsx
new file mode 100644
index 000000000..ea198c0cc
--- /dev/null
+++ b/fluxer_app/src/features/theme_settings/components/ThisAccountSection.tsx
@@ -0,0 +1,109 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {SettingsSection} from '@app/features/app/components/dialogs/shared/SettingsSection';
+import * as ThemeProfileCommands from '@app/features/theme/commands/ThemeProfileCommands';
+import AccountThemeMode from '@app/features/theme/state/AccountThemeMode';
+import ThemeEditTarget, {type ThemeTarget} from '@app/features/theme/state/ThemeEditTarget';
+import ThemeProfile from '@app/features/theme/state/ThemeProfile';
+import {useCurrentAccountLabels} from '@app/features/theme_settings/hooks/useCurrentAccountLabels';
+import styles from '@app/features/theme_settings/ThemesTab.module.css';
+import {USE_DESKTOP_APP_THEME_DESCRIPTOR} from '@app/features/theme_settings/utils/ThemeSettingsMessageDescriptors';
+import {Switch} from '@app/features/ui/components/form/FormSwitch';
+import {RadioGroup, type RadioOption} from '@app/features/ui/radio_group/RadioGroup';
+import {THIS_ACCOUNT_SECTION_DESCRIPTOR} from '@app/features/user/components/settings_utils/section_registry/ThemesSections';
+import {msg} from '@lingui/core/macro';
+import {useLingui} from '@lingui/react/macro';
+import {observer} from 'mobx-react-lite';
+import type React from 'react';
+import {useMemo} from 'react';
+
+const USE_DESKTOP_APP_THEME_DESCRIPTION_DESCRIPTOR = msg({
+ message:
+ "Every account you add to this desktop app uses the same theme, on any instance. Turn this off to use this account's own theme. Its own theme stays saved either way.",
+ comment: 'Description under the "Use the desktop app theme for this account" switch in Settings > Themes.',
+});
+const THEME_TO_EDIT_DESCRIPTOR = msg({
+ message: 'Theme to edit',
+ comment:
+ "Label for a choice in Settings > Themes on the desktop app between editing the theme shared by every account and editing the current account's own theme.",
+});
+const DESKTOP_APP_THEME_DESCRIPTOR = msg({
+ message: 'Desktop app theme',
+ comment: 'Option under "Theme to edit". The theme shared by every account in this desktop app.',
+});
+const ACCOUNT_ON_INSTANCE_DESCRIPTOR = msg({
+ message: '{username} on {instanceName}',
+ comment:
+ 'Option under "Theme to edit" for the current account\'s own theme. {username} is the account\'s username and {instanceName} is the instance it is on, like fluxer.app.',
+});
+const EDITING_OWN_THEME_WHILE_FOLLOWING_DESCRIPTOR = msg({
+ message:
+ '{username} on {instanceName} uses the desktop app theme right now. Changes here show when you turn off "{switchLabel}".',
+ comment:
+ 'Shown in Settings > Themes while editing an account\'s own theme that the account does not use right now. {switchLabel} is the label of the "Use the desktop app theme for this account" switch.',
+});
+const EDITING_DESKTOP_THEME_WHILE_OWN_DESCRIPTOR = msg({
+ message:
+ '{username} on {instanceName} uses its own theme right now. Changes here show on accounts that use the desktop app theme.',
+ comment: 'Shown in Settings > Themes while editing the desktop app theme from an account that uses its own theme.',
+});
+
+export const EditTargetNote: React.FC = observer(() => {
+ const {i18n} = useLingui();
+ const {username, instanceName} = useCurrentAccountLabels();
+ const target = ThemeEditTarget.target;
+ if (target === ThemeProfile.activeTarget) {
+ return null;
+ }
+ return (
+ <p className={styles.note} data-flx="theme-settings.this-account-section.edit-target-note.note">
+ {target === 'account'
+ ? i18n._(EDITING_OWN_THEME_WHILE_FOLLOWING_DESCRIPTOR, {
+ username,
+ instanceName,
+ switchLabel: i18n._(USE_DESKTOP_APP_THEME_DESCRIPTOR),
+ })
+ : i18n._(EDITING_DESKTOP_THEME_WHILE_OWN_DESCRIPTOR, {username, instanceName})}
+ </p>
+ );
+});
+
+export const ThisAccountSection: React.FC = observer(() => {
+ const {i18n} = useLingui();
+ const {username, instanceName} = useCurrentAccountLabels();
+ const targetOptions = useMemo(
+ (): ReadonlyArray<RadioOption<ThemeTarget>> => [
+ {value: 'desktop', name: i18n._(DESKTOP_APP_THEME_DESCRIPTOR)},
+ {value: 'account', name: i18n._(ACCOUNT_ON_INSTANCE_DESCRIPTOR, {username, instanceName})},
+ ],
+ [i18n.locale, username, instanceName],
+ );
+ return (
+ <SettingsSection
+ id="this-account"
+ title={i18n._(THIS_ACCOUNT_SECTION_DESCRIPTOR)}
+ data-flx="theme-settings.this-account-section.this-account"
+ >
+ <Switch
+ label={i18n._(USE_DESKTOP_APP_THEME_DESCRIPTOR)}
+ description={i18n._(USE_DESKTOP_APP_THEME_DESCRIPTION_DESCRIPTOR)}
+ value={AccountThemeMode.followDesktopTheme}
+ onChange={(value) => ThemeProfileCommands.setFollowDesktopTheme(value)}
+ data-flx="theme-settings.this-account-section.switch.set-follow-desktop-theme"
+ />
+ <div className={styles.stack} data-flx="theme-settings.this-account-section.stack">
+ <p className={styles.fieldLabel} data-flx="theme-settings.this-account-section.field-label">
+ {i18n._(THEME_TO_EDIT_DESCRIPTOR)}
+ </p>
+ <RadioGroup
+ options={targetOptions}
+ value={ThemeEditTarget.target}
+ onChange={(value) => ThemeProfileCommands.pickEditTarget(value)}
+ aria-label={i18n._(THEME_TO_EDIT_DESCRIPTOR)}
+ data-flx="theme-settings.this-account-section.radio-group.pick-edit-target"
+ />
+ <EditTargetNote data-flx="theme-settings.this-account-section.edit-target-note" />
+ </div>
+ </SettingsSection>
+ );
+});