diff --git a/client/src/javascript/components/general/WindowTitle.tsx b/client/src/javascript/components/general/WindowTitle.tsx index 9f09f2d8..20c1c17e 100644 --- a/client/src/javascript/components/general/WindowTitle.tsx +++ b/client/src/javascript/components/general/WindowTitle.tsx @@ -3,15 +3,17 @@ import {observer} from 'mobx-react'; import {useLingui} from '@lingui/react'; import {compute, getTranslationString} from '../../util/size'; +import SettingStore from '../../stores/SettingStore'; import TransferDataStore from '../../stores/TransferDataStore'; const WindowTitle: FC = observer(() => { + const {UIPageTitleSpeedEnabled: enabled} = SettingStore.floodSettings; const {transferSummary: summary} = TransferDataStore; const {i18n} = useLingui(); let title = 'Flood'; - if (summary != null && Object.keys(summary).length > 0) { + if (enabled && summary != null && Object.keys(summary).length > 0) { const down = compute(summary.downRate); const up = compute(summary.upRate); diff --git a/client/src/javascript/components/modals/settings-modal/UITab.tsx b/client/src/javascript/components/modals/settings-modal/UITab.tsx index 2e723990..1facd706 100644 --- a/client/src/javascript/components/modals/settings-modal/UITab.tsx +++ b/client/src/javascript/components/modals/settings-modal/UITab.tsx @@ -10,6 +10,7 @@ import type {Language} from '@client/constants/Languages'; import type {FloodSettings} from '@shared/types/FloodSettings'; import ModalFormSectionHeader from '../ModalFormSectionHeader'; +import MiscUISettingsList from './lists/MiscUISettingsList'; import TorrentContextMenuActionsList from './lists/TorrentContextMenuActionsList'; import TorrentListColumnsList from './lists/TorrentListColumnsList'; @@ -99,6 +100,12 @@ const UITab: FC = ({onSettingsChange}: UITabProps) => { + + + + + + ); }; diff --git a/client/src/javascript/components/modals/settings-modal/lists/MiscUISettingsList.tsx b/client/src/javascript/components/modals/settings-modal/lists/MiscUISettingsList.tsx new file mode 100644 index 00000000..55e4bf8a --- /dev/null +++ b/client/src/javascript/components/modals/settings-modal/lists/MiscUISettingsList.tsx @@ -0,0 +1,33 @@ +import {FC, useRef} from 'react'; + +import SettingStore from '@client/stores/SettingStore'; +import ToggleList from '@client/components/general/ToggleList'; + +import type {FloodSettings} from '@shared/types/FloodSettings'; + +interface MiscUISettingsListProps { + onSettingsChange: (changedSettings: Partial) => void; +} + +const MiscUISettingsList: FC = ({onSettingsChange}: MiscUISettingsListProps) => { + const changedUIPageTitleSpeedEnabledRef = useRef( + SettingStore.floodSettings.UIPageTitleSpeedEnabled, + ); + + return ( + { + changedUIPageTitleSpeedEnabledRef.current = !changedUIPageTitleSpeedEnabledRef.current; + onSettingsChange({UIPageTitleSpeedEnabled: changedUIPageTitleSpeedEnabledRef.current}); + }, + }, + ]} + /> + ); +}; + +export default MiscUISettingsList; diff --git a/client/src/javascript/i18n/strings/en.json b/client/src/javascript/i18n/strings/en.json index 038bbfa7..d380c8de 100644 --- a/client/src/javascript/i18n/strings/en.json +++ b/client/src/javascript/i18n/strings/en.json @@ -210,6 +210,8 @@ "settings.ui.displayed.context.menu.items": "Context Menu Items", "settings.ui.displayed.details": "Torrent Detail Columns", "settings.ui.language": "Language", + "settings.ui.misc": "Miscellaneous", + "settings.ui.page.title.speed": "Display upload and download speed in page title", "settings.ui.locale": "Locale", "settings.ui.tag.selector.mode": "Tag Selector Preference", "settings.ui.tag.selector.mode.multi": "Multi Selection", diff --git a/shared/constants/defaultFloodSettings.ts b/shared/constants/defaultFloodSettings.ts index e5c93696..e08dab22 100644 --- a/shared/constants/defaultFloodSettings.ts +++ b/shared/constants/defaultFloodSettings.ts @@ -74,6 +74,7 @@ const defaultFloodSettings: Readonly = { mountPoints: [], deleteTorrentData: true, startTorrentsOnLoad: true, + UIPageTitleSpeedEnabled: true, }; export default defaultFloodSettings; diff --git a/shared/types/FloodSettings.ts b/shared/types/FloodSettings.ts index 985a8014..6ebb09c8 100644 --- a/shared/types/FloodSettings.ts +++ b/shared/types/FloodSettings.ts @@ -40,6 +40,9 @@ export interface FloodSettings { // Last used "Add Torrents" tab UITorrentsAddTab?: 'by-url' | 'by-file' | 'by-creation'; + + // Display upload and download speed in page title + UIPageTitleSpeedEnabled: boolean; } export type FloodSetting = keyof FloodSettings;