[enhancement]: support toggling feature carousel
This commit is contained in:
parent
168153b211
commit
bb2f8461ed
4 changed files with 29 additions and 2 deletions
|
@ -496,6 +496,8 @@
|
|||
"globalMediaHotkeys_description": "enable or disable the usage of your system media hotkeys to control playback",
|
||||
"homeConfiguration": "home page configuration",
|
||||
"homeConfiguration_description": "configure what items are shown, and in what order, on the home page",
|
||||
"homeFeature": "home featured carousel",
|
||||
"homeFeature_description": "controls whether to show the large featured carousel on the home page",
|
||||
"hotkey_browserBack": "browser back",
|
||||
"hotkey_browserForward": "browser forward",
|
||||
"hotkey_favoriteCurrentSong": "favorite $t(common.currentSong)",
|
||||
|
|
|
@ -33,11 +33,12 @@ const HomeRoute = () => {
|
|||
const server = useCurrentServer();
|
||||
const itemsPerPage = 15;
|
||||
const { windowBarStyle } = useWindowSettings();
|
||||
const { homeItems } = useGeneralSettings();
|
||||
const { homeFeature, homeItems } = useGeneralSettings();
|
||||
|
||||
const feature = useAlbumList({
|
||||
options: {
|
||||
cacheTime: 1000 * 60,
|
||||
enabled: homeFeature,
|
||||
staleTime: 1000 * 60,
|
||||
},
|
||||
query: {
|
||||
|
@ -249,7 +250,7 @@ const HomeRoute = () => {
|
|||
px="2rem"
|
||||
spacing="lg"
|
||||
>
|
||||
<FeatureCarousel data={featureItemsWithImage} />
|
||||
{homeFeature && <FeatureCarousel data={featureItemsWithImage} />}
|
||||
{sortedCarousel.map((carousel) => (
|
||||
<MemoizedSwiperGridCarousel
|
||||
key={`carousel-${carousel.uniqueId}`}
|
||||
|
|
|
@ -377,6 +377,28 @@ export const ControlSettings = () => {
|
|||
isHidden: false,
|
||||
title: t('setting.genreBehavior', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
{
|
||||
control: (
|
||||
<Switch
|
||||
aria-label={t('setting.homeFeature', { postProcess: 'sentenceCase' })}
|
||||
defaultChecked={settings.homeFeature}
|
||||
onChange={(e) =>
|
||||
setSettings({
|
||||
general: {
|
||||
...settings,
|
||||
homeFeature: e.currentTarget.checked,
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
),
|
||||
description: t('setting.homeFeature', {
|
||||
context: 'description',
|
||||
postProcess: 'sentenceCase',
|
||||
}),
|
||||
isHidden: false,
|
||||
title: t('setting.homeFeature', { postProcess: 'sentenceCase' }),
|
||||
},
|
||||
];
|
||||
|
||||
return <SettingsSection options={controlOptions} />;
|
||||
|
|
|
@ -198,6 +198,7 @@ export interface SettingsState {
|
|||
externalLinks: boolean;
|
||||
followSystemTheme: boolean;
|
||||
genreTarget: GenreTarget;
|
||||
homeFeature: boolean;
|
||||
homeItems: SortableItem<HomeItem>[];
|
||||
language: string;
|
||||
passwordStore?: string;
|
||||
|
@ -319,6 +320,7 @@ const initialState: SettingsState = {
|
|||
externalLinks: true,
|
||||
followSystemTheme: false,
|
||||
genreTarget: GenreTarget.TRACK,
|
||||
homeFeature: true,
|
||||
homeItems,
|
||||
language: 'en',
|
||||
passwordStore: undefined,
|
||||
|
|
Reference in a new issue