1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-26 22:56:23 -04:00

Use react-query for UI settings

This commit is contained in:
Mark McDowall
2025-12-28 16:35:16 -08:00
parent e9011011ed
commit 74e6ce4305
32 changed files with 264 additions and 263 deletions
@@ -1,11 +1,12 @@
import React, { useMemo } from 'react';
import { useSelector } from 'react-redux';
import { IconName } from 'Components/Icon';
import { icons } from 'Helpers/Props';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import {
UiSettingsModel,
useUiSettingsValues,
} from 'Settings/UI/useUiSettings';
import dimensions from 'Styles/Variables/dimensions';
import QualityProfile from 'typings/QualityProfile';
import UiSettings from 'typings/Settings/UiSettings';
import formatDateTime from 'Utilities/Date/formatDateTime';
import getRelativeDate from 'Utilities/Date/getRelativeDate';
import formatBytes from 'Utilities/Number/formatBytes';
@@ -95,7 +96,7 @@ const rows = [
function getInfoRowProps(
row: RowProps,
props: SeriesIndexOverviewInfoProps,
uiSettings: UiSettings
uiSettings: UiSettingsModel
): RowInfoProps | null {
const { name } = row;
@@ -209,8 +210,7 @@ function getInfoRowProps(
function SeriesIndexOverviewInfo(props: SeriesIndexOverviewInfoProps) {
const { height, nextAiring } = props;
const uiSettings = useSelector(createUISettingsSelector());
const uiSettings = useUiSettingsValues();
const { shortDateFormat, showRelativeDates, longDateFormat, timeFormat } =
uiSettings;
@@ -1,6 +1,5 @@
import classNames from 'classnames';
import React, { useCallback, useState } from 'react';
import { useSelector } from 'react-redux';
import CommandNames from 'Commands/CommandNames';
import { useExecuteCommand } from 'Commands/useCommands';
import Label from 'Components/Label';
@@ -16,7 +15,7 @@ import SeriesIndexPosterSelect from 'Series/Index/Select/SeriesIndexPosterSelect
import { Statistics } from 'Series/Series';
import { useSeriesPosterOptions } from 'Series/seriesOptionsStore';
import SeriesPoster from 'Series/SeriesPoster';
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
import { useUiSettingsValues } from 'Settings/UI/useUiSettings';
import formatDateTime from 'Utilities/Date/formatDateTime';
import getRelativeDate from 'Utilities/Date/getRelativeDate';
import translate from 'Utilities/String/translate';
@@ -48,7 +47,7 @@ function SeriesIndexPoster(props: SeriesIndexPosterProps) {
} = useSeriesPosterOptions();
const { showRelativeDates, shortDateFormat, longDateFormat, timeFormat } =
useSelector(createUISettingsSelector());
useUiSettingsValues();
const executeCommand = useExecuteCommand();
const [hasPosterError, setHasPosterError] = useState(false);