mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-28 23:16:32 -04:00
Use react-query for UI settings
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import moment from 'moment';
|
||||
import React, { useEffect, useMemo, useState } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||
import { useUiSettingsValues } from 'Settings/UI/useUiSettings';
|
||||
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||
import formatTimeSpan from 'Utilities/Date/formatTimeSpan';
|
||||
|
||||
@@ -11,9 +10,7 @@ interface StartTimeProps {
|
||||
|
||||
function StartTime(props: StartTimeProps) {
|
||||
const { startTime } = props;
|
||||
const { timeFormat, longDateFormat } = useSelector(
|
||||
createUISettingsSelector()
|
||||
);
|
||||
const { timeFormat, longDateFormat } = useUiSettingsValues();
|
||||
const [time, setTime] = useState(Date.now());
|
||||
|
||||
const { formattedStartTime, uptime } = useMemo(() => {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import moment from 'moment';
|
||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { CommandBody } from 'Commands/Command';
|
||||
import { useCancelCommand } from 'Commands/useCommands';
|
||||
import Icon, { IconProps } from 'Components/Icon';
|
||||
@@ -10,7 +9,7 @@ import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||
import TableRow from 'Components/Table/TableRow';
|
||||
import useModalOpenState from 'Helpers/Hooks/useModalOpenState';
|
||||
import { icons, kinds } from 'Helpers/Props';
|
||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||
import { useUiSettingsValues } from 'Settings/UI/useUiSettings';
|
||||
import formatDate from 'Utilities/Date/formatDate';
|
||||
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||
import formatTimeSpan from 'Utilities/Date/formatTimeSpan';
|
||||
@@ -120,7 +119,7 @@ export default function QueuedTaskRow(props: QueuedTaskRowProps) {
|
||||
|
||||
const { cancelCommand } = useCancelCommand(id);
|
||||
const { longDateFormat, shortDateFormat, showRelativeDates, timeFormat } =
|
||||
useSelector(createUISettingsSelector());
|
||||
useUiSettingsValues();
|
||||
|
||||
const updateTimeTimeoutId = useRef<ReturnType<typeof setTimeout> | null>(
|
||||
null
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import moment from 'moment';
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useCommand, useExecuteCommand } from 'Commands/useCommands';
|
||||
import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
|
||||
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
||||
import TableRow from 'Components/Table/TableRow';
|
||||
import { icons } from 'Helpers/Props';
|
||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||
import { useUiSettingsValues } from 'Settings/UI/useUiSettings';
|
||||
import { isCommandExecuting } from 'Utilities/Command';
|
||||
import formatDate from 'Utilities/Date/formatDate';
|
||||
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||||
@@ -35,7 +34,7 @@ function ScheduledTaskRow({
|
||||
}: ScheduledTaskRowProps) {
|
||||
const executeCommand = useExecuteCommand();
|
||||
const { showRelativeDates, longDateFormat, shortDateFormat, timeFormat } =
|
||||
useSelector(createUISettingsSelector());
|
||||
useUiSettingsValues();
|
||||
const command = useCommand(taskName);
|
||||
|
||||
const [time, setTime] = useState(Date.now());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useAppValue } from 'App/appStore';
|
||||
import CommandNames from 'Commands/CommandNames';
|
||||
import { useCommandExecuting, useExecuteCommand } from 'Commands/useCommands';
|
||||
@@ -14,8 +14,8 @@ import PageContent from 'Components/Page/PageContent';
|
||||
import PageContentBody from 'Components/Page/PageContentBody';
|
||||
import { icons, kinds } from 'Helpers/Props';
|
||||
import useUpdateSettings from 'Settings/General/useUpdateSettings';
|
||||
import { useUiSettingsValues } from 'Settings/UI/useUiSettings';
|
||||
import { fetchGeneralSettings } from 'Store/Actions/settingsActions';
|
||||
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
||||
import { useSystemStatusData } from 'System/Status/useSystemStatus';
|
||||
import { UpdateMechanism } from 'typings/Settings/General';
|
||||
import formatDate from 'Utilities/Date/formatDate';
|
||||
@@ -31,9 +31,7 @@ function Updates() {
|
||||
const currentVersion = useAppValue('version');
|
||||
const { packageUpdateMechanismMessage } = useSystemStatusData();
|
||||
|
||||
const { shortDateFormat, longDateFormat, timeFormat } = useSelector(
|
||||
createUISettingsSelector()
|
||||
);
|
||||
const { shortDateFormat, longDateFormat, timeFormat } = useUiSettingsValues();
|
||||
const isInstallingUpdate = useCommandExecuting(
|
||||
CommandNames.ApplicationUpdate
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user