From 0044bf0b855cee401744ccced5f3f71911140cc5 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Fri, 11 Feb 2022 14:26:01 -0800 Subject: [PATCH] Enforce configured font on popups/tooltips - Move setting from misc -> config state --- src/App.tsx | 5 +++-- src/__tests__/App.test.tsx | 2 +- src/components/layout/Layout.tsx | 7 ++++--- src/components/library/AlbumList.tsx | 6 +++--- src/components/library/AlbumView.tsx | 13 ++++--------- src/components/library/ArtistView.tsx | 18 ++++++------------ src/components/player/NowPlayingMiniView.tsx | 6 +++--- src/components/player/NowPlayingView.tsx | 6 +++--- src/components/player/PlayerBar.tsx | 15 +++------------ src/components/playlist/PlaylistList.tsx | 13 ++++--------- src/components/playlist/PlaylistView.tsx | 17 ++++++----------- src/components/search/SearchBar.tsx | 6 +++--- src/components/settings/Config.tsx | 11 ++++++----- .../settings/ConfigPanels/CacheConfig.tsx | 6 +++--- .../ConfigPanels/LookAndFeelConfig.tsx | 9 +++++---- .../settings/ConfigPanels/PlayerConfig.tsx | 6 +++--- src/components/shared/ColumnSortPopover.tsx | 6 +++--- src/components/shared/CustomTooltip.tsx | 8 +++++--- src/components/shared/Paginator.tsx | 13 ++++--------- src/components/shared/Popup.tsx | 15 +++++++++++++++ src/components/shared/styled.ts | 3 ++- src/redux/configSlice.ts | 7 +++++++ src/redux/miscSlice.ts | 7 ------- 23 files changed, 96 insertions(+), 109 deletions(-) create mode 100644 src/components/shared/Popup.tsx diff --git a/src/App.tsx b/src/App.tsx index aa9ab5e..8fe711e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -35,6 +35,7 @@ const App = () => { const [theme, setTheme] = useState(defaultDark); const [font, setFont] = useState('Poppins'); const misc = useAppSelector((state) => state.misc); + const config = useAppSelector((state) => state.config); useEffect(() => { const themes: any = @@ -45,8 +46,8 @@ const App = () => { }, [misc.theme]); useEffect(() => { - setFont(misc.font); - }, [misc.font]); + setFont(config.lookAndFeel.font); + }, [config.lookAndFeel.font]); if (!localStorage.getItem('server') || !localStorage.getItem('serverBase64')) { return ( diff --git a/src/__tests__/App.test.tsx b/src/__tests__/App.test.tsx index 9a30626..660e9a1 100644 --- a/src/__tests__/App.test.tsx +++ b/src/__tests__/App.test.tsx @@ -72,7 +72,6 @@ const playerState: Player = { const miscState: General = { theme: 'defaultDark', - font: 'Poppins', contextMenu: { show: false, }, @@ -136,6 +135,7 @@ const configState: ConfigPage = { sort: {}, serverType: Server.Subsonic, lookAndFeel: { + font: 'Poppins', listView: { music: { columns: [ diff --git a/src/components/layout/Layout.tsx b/src/components/layout/Layout.tsx index cfba65f..790004a 100644 --- a/src/components/layout/Layout.tsx +++ b/src/components/layout/Layout.tsx @@ -10,7 +10,7 @@ import { RootContainer, RootFooter, MainContainer } from './styled'; import { setContextMenu } from '../../redux/miscSlice'; import { useAppDispatch, useAppSelector } from '../../redux/hooks'; import { clearSelected } from '../../redux/multiSelectSlice'; -import { StyledButton, StyledNavItem, StyledPopover } from '../shared/styled'; +import { StyledButton, StyledNavItem } from '../shared/styled'; import { GridViewConfigPanel, ListViewConfigPanel, @@ -25,6 +25,7 @@ import WindowConfig from '../settings/ConfigPanels/WindowConfig'; import AdvancedConfig from '../settings/ConfigPanels/AdvancedConfig'; import { setSidebar } from '../../redux/configSlice'; import SearchBar from '../search/SearchBar'; +import Popup from '../shared/Popup'; const Layout = ({ footer, children, disableSidebar, font }: any) => { const { t } = useTranslation(); @@ -157,7 +158,7 @@ const Layout = ({ footer, children, disableSidebar, font }: any) => { { )} - + } trigger="click" placement="bottomEnd" diff --git a/src/components/library/AlbumList.tsx b/src/components/library/AlbumList.tsx index cb008c3..453038b 100644 --- a/src/components/library/AlbumList.tsx +++ b/src/components/library/AlbumList.tsx @@ -16,7 +16,6 @@ import { StyledInputPicker, StyledInputPickerContainer, StyledNavItem, - StyledPopover, StyledTag, } from '../shared/styled'; import { FilterButton, RefreshButton } from '../shared/ToolbarButtons'; @@ -31,6 +30,7 @@ import { setFilter, setPagination, setAdvancedFilters, setColumnSort } from '../ import useGridScroll from '../../hooks/useGridScroll'; import useListScroll from '../../hooks/useListScroll'; import useListClickHandler from '../../hooks/useListClickHandler'; +import Popup from '../shared/Popup'; export const ALBUM_SORT_TYPES = [ { label: i18n.t('A-Z (Name)'), value: 'alphabeticalByName', role: i18n.t('Default') }, @@ -315,7 +315,7 @@ const AlbumList = () => { placement="bottomEnd" preventOverflow speaker={ - +