From 2caf88ce51d071a8fff0c53d302b0309dff1abff Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 9 Dec 2023 14:16:59 +0100 Subject: [PATCH] Remove incorrect "ListItemSecondaryAction" usage (#486) --- src/components/navbar/ReaderNavBar.tsx | 27 +++---- src/components/navbar/action/LangSelect.tsx | 12 ++- .../reader/ReaderSettingsOptions.tsx | 73 ++++++++----------- .../downloads/DownloadAheadSetting.tsx | 9 +-- .../globalUpdate/GlobalUpdateSettings.tsx | 13 ++-- .../GlobalUpdateSettingsInterval.tsx | 5 +- .../webUI/WebUIUpdateIntervalSetting.tsx | 15 ++-- .../TwoStatePreference.tsx | 21 +++--- src/screens/Settings.tsx | 33 ++++----- src/screens/settings/DownloadSettings.tsx | 65 +++++++---------- src/screens/settings/SearchSettings.tsx | 13 ++-- src/screens/settings/ServerSettings.tsx | 61 +++++++--------- src/screens/settings/WebUISettings.tsx | 13 ++-- 13 files changed, 143 insertions(+), 217 deletions(-) diff --git a/src/components/navbar/ReaderNavBar.tsx b/src/components/navbar/ReaderNavBar.tsx index dae493b0..b3a92f42 100644 --- a/src/components/navbar/ReaderNavBar.tsx +++ b/src/components/navbar/ReaderNavBar.tsx @@ -21,7 +21,6 @@ import Zoom from '@mui/material/Zoom'; import { Divider, FormControl, MenuItem, Select, styled, Tooltip } from '@mui/material'; import ListItem from '@mui/material/ListItem'; import ListItemText from '@mui/material/ListItemText'; -import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import Collapse from '@mui/material/Collapse'; import { useTranslation } from 'react-i18next'; import { ChapterOffset, IReaderSettings, TChapter, TManga } from '@/typings'; @@ -247,20 +246,18 @@ export function ReaderNavBar(props: IProps) { }} > - - setSettingsCollapseOpen(!settingsCollapseOpen)} - size="large" - > - {settingsCollapseOpen && } - {!settingsCollapseOpen && } - - + setSettingsCollapseOpen(!settingsCollapseOpen)} + size="large" + > + {settingsCollapseOpen && } + {!settingsCollapseOpen && } + - - handleChange(e, lang)} - /> - + handleChange(e, lang)} + /> ))} diff --git a/src/components/reader/ReaderSettingsOptions.tsx b/src/components/reader/ReaderSettingsOptions.tsx index 5c6875b4..f738c92d 100644 --- a/src/components/reader/ReaderSettingsOptions.tsx +++ b/src/components/reader/ReaderSettingsOptions.tsx @@ -7,7 +7,6 @@ */ import { List, ListItem, ListItemText, Switch } from '@mui/material'; -import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import Select from '@mui/material/Select'; import MenuItem from '@mui/material/MenuItem'; import { useTranslation } from 'react-i18next'; @@ -39,66 +38,54 @@ export function ReaderSettingsOptions({ - - setSettingValue('staticNav', e.target.checked)} - /> - + setSettingValue('staticNav', e.target.checked)} + /> - - setSettingValue('showPageNumber', e.target.checked)} - /> - + setSettingValue('showPageNumber', e.target.checked)} + /> - - setSettingValue('loadNextOnEnding', e.target.checked)} - /> - + setSettingValue('loadNextOnEnding', e.target.checked)} + /> - - setSettingValue('skipDupChapters', e.target.checked)} - /> - + setSettingValue('skipDupChapters', e.target.checked)} + /> {fitPageToWindowEligible ? ( - - setSettingValue('fitPageToWindow', e.target.checked)} - /> - + setSettingValue('fitPageToWindow', e.target.checked)} + /> ) : null} {readerType === 'DoubleLTR' || readerType === 'DoubleRTL' ? ( - - setSettingValue('offsetFirstPage', e.target.checked)} - /> - + setSettingValue('offsetFirstPage', e.target.checked)} + /> ) : null} diff --git a/src/components/settings/downloads/DownloadAheadSetting.tsx b/src/components/settings/downloads/DownloadAheadSetting.tsx index efbec989..5fc484ea 100644 --- a/src/components/settings/downloads/DownloadAheadSetting.tsx +++ b/src/components/settings/downloads/DownloadAheadSetting.tsx @@ -8,7 +8,6 @@ import { useTranslation } from 'react-i18next'; import { List, ListItem, ListItemText, Switch } from '@mui/material'; -import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import { useCallback } from 'react'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { NumberSetting } from '@/components/settings/NumberSetting.tsx'; @@ -51,13 +50,7 @@ export const DownloadAheadSetting = () => { - - setDoAutoUpdates(e.target.checked)} - /> - + setDoAutoUpdates(e.target.checked)} /> { primary={t('library.settings.global_update.metadata.label.title')} secondary={t('library.settings.global_update.metadata.label.description')} /> - - updateSetting('updateMangas', e.target.checked)} - /> - + updateSetting('updateMangas', e.target.checked)} + /> ); diff --git a/src/components/settings/globalUpdate/GlobalUpdateSettingsInterval.tsx b/src/components/settings/globalUpdate/GlobalUpdateSettingsInterval.tsx index deb4b172..cf763324 100644 --- a/src/components/settings/globalUpdate/GlobalUpdateSettingsInterval.tsx +++ b/src/components/settings/globalUpdate/GlobalUpdateSettingsInterval.tsx @@ -8,7 +8,6 @@ import { useTranslation } from 'react-i18next'; import { List, ListItem, ListItemText, Switch } from '@mui/material'; -import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import { useCallback } from 'react'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { NumberSetting } from '@/components/settings/NumberSetting.tsx'; @@ -51,9 +50,7 @@ export const GlobalUpdateSettingsInterval = () => { - - setDoAutoUpdates(e.target.checked)} /> - + setDoAutoUpdates(e.target.checked)} /> - - setDoAutoUpdates(e.target.checked)} - /> - + setDoAutoUpdates(e.target.checked)} + /> - - {createElement(getTwoStateType(twoStateType), { - edge: 'end', - checked: internalCurrentValue, - onChange: () => { - updateValue(twoStateType === 'Switch' ? 'switchState' : 'checkBoxState', !currentValue); + {createElement(getTwoStateType(twoStateType), { + edge: 'end', + checked: internalCurrentValue, + onChange: () => { + updateValue(twoStateType === 'Switch' ? 'switchState' : 'checkBoxState', !currentValue); - // appear smooth - setInternalCurrentValue(!currentValue); - }, - })} - + // appear smooth + setInternalCurrentValue(!currentValue); + }, + })} ); } diff --git a/src/screens/Settings.tsx b/src/screens/Settings.tsx index 22a268e4..fba8c8ce 100644 --- a/src/screens/Settings.tsx +++ b/src/screens/Settings.tsx @@ -16,7 +16,6 @@ import InfoIcon from '@mui/icons-material/Info'; import ListItem from '@mui/material/ListItem'; import ListItemIcon from '@mui/material/ListItemIcon'; import ListItemText from '@mui/material/ListItemText'; -import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import Switch from '@mui/material/Switch'; import FavoriteIcon from '@mui/icons-material/Favorite'; import { Link, ListItemButton, MenuItem, Select } from '@mui/material'; @@ -101,9 +100,7 @@ export function Settings() { - - setDarkTheme(!darkTheme)} /> - + setDarkTheme(!darkTheme)} /> - - setShowNsfw(!showNsfw)} /> - + setShowNsfw(!showNsfw)} /> @@ -146,19 +141,17 @@ export function Settings() { } /> - - - + diff --git a/src/screens/settings/DownloadSettings.tsx b/src/screens/settings/DownloadSettings.tsx index 0d03be8e..24b6dbc2 100644 --- a/src/screens/settings/DownloadSettings.tsx +++ b/src/screens/settings/DownloadSettings.tsx @@ -10,7 +10,6 @@ import { useTranslation } from 'react-i18next'; import { useContext, useEffect } from 'react'; import List from '@mui/material/List'; import { ListItem, ListItemText, Switch } from '@mui/material'; -import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import ListSubheader from '@mui/material/ListSubheader'; import { TextSetting } from '@/components/settings/TextSetting.tsx'; import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext.tsx'; @@ -87,13 +86,11 @@ export const DownloadSettings = () => { /> - - updateSetting('downloadAsCbz', e.target.checked)} - /> - + updateSetting('downloadAsCbz', e.target.checked)} + /> { > - - - updateMetadataSetting('deleteChaptersManuallyMarkedRead', e.target.checked) - } - /> - + updateMetadataSetting('deleteChaptersManuallyMarkedRead', e.target.checked)} + /> { /> - - updateMetadataSetting('deleteChaptersWithBookmark', e.target.checked)} - /> - + updateMetadataSetting('deleteChaptersWithBookmark', e.target.checked)} + /> { > - - updateSetting('autoDownloadNewChapters', e.target.checked)} - /> - + updateSetting('autoDownloadNewChapters', e.target.checked)} + /> - - updateSetting('excludeEntryWithUnreadChapters', e.target.checked)} - disabled={!downloadSettings?.autoDownloadNewChapters} - /> - + updateSetting('excludeEntryWithUnreadChapters', e.target.checked)} + disabled={!downloadSettings?.autoDownloadNewChapters} + /> - - setSettingValue('ignoreFilters', e.target.checked)} - /> - + setSettingValue('ignoreFilters', e.target.checked)} + /> ); diff --git a/src/screens/settings/ServerSettings.tsx b/src/screens/settings/ServerSettings.tsx index 1ddd8277..10ebed4d 100644 --- a/src/screens/settings/ServerSettings.tsx +++ b/src/screens/settings/ServerSettings.tsx @@ -10,7 +10,6 @@ import { useTranslation } from 'react-i18next'; import { useContext, useEffect } from 'react'; import { List, ListItem, ListItemText, Switch } from '@mui/material'; import ListSubheader from '@mui/material/ListSubheader'; -import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext.tsx'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { useLocalStorage } from '@/util/useLocalStorage.tsx'; @@ -167,13 +166,11 @@ export const ServerSettings = () => { > - - updateSetting('socksProxyEnabled', e.target.checked)} - /> - + updateSetting('socksProxyEnabled', e.target.checked)} + /> { > - - updateSetting('basicAuthEnabled', e.target.checked)} - /> - + updateSetting('basicAuthEnabled', e.target.checked)} + /> { > - - updateSetting('debugLogsEnabled', e.target.checked)} - /> - + updateSetting('debugLogsEnabled', e.target.checked)} + /> - - updateSetting('gqlDebugLogsEnabled', e.target.checked)} - /> - + updateSetting('gqlDebugLogsEnabled', e.target.checked)} + /> - - updateSetting('systemTrayEnabled', e.target.checked)} - /> - + updateSetting('systemTrayEnabled', e.target.checked)} + /> diff --git a/src/screens/settings/WebUISettings.tsx b/src/screens/settings/WebUISettings.tsx index 9537edfa..d4926ca3 100644 --- a/src/screens/settings/WebUISettings.tsx +++ b/src/screens/settings/WebUISettings.tsx @@ -10,7 +10,6 @@ import { useTranslation } from 'react-i18next'; import { useContext, useEffect } from 'react'; import List from '@mui/material/List'; import { ListItem, ListItemText, Switch } from '@mui/material'; -import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; import { NavBarContext, useSetDefaultBackTo } from '@/components/context/NavbarContext.tsx'; import { ServerSettings } from '@/typings.ts'; import { requestManager } from '@/lib/requests/RequestManager.ts'; @@ -134,13 +133,11 @@ export const WebUISettings = () => { /> - - updateSetting('initialOpenInBrowserEnabled', e.target.checked)} - /> - + updateSetting('initialOpenInBrowserEnabled', e.target.checked)} + /> settingName={t('settings.webui.interface.label.title')}