mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
Add missing sidebar configuration
This commit is contained in:
parent
7fa4641dfe
commit
ba8e23e8d4
3 changed files with 64 additions and 44 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useCallback, useState } from 'react';
|
||||
import { ChangeEvent, useCallback, useState } from 'react';
|
||||
import { Group } from '@mantine/core';
|
||||
import { Reorder, useDragControls } from 'framer-motion';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
|
|
@ -54,10 +54,10 @@ const DraggableSidebarItem = ({ item, handleChangeDisabled }: DraggableSidebarIt
|
|||
};
|
||||
|
||||
export const SidebarSettings = () => {
|
||||
const { sidebarItems } = useGeneralSettings();
|
||||
const { setSidebarItems } = useSettingsStoreActions();
|
||||
const settings = useGeneralSettings();
|
||||
const { setSidebarItems, setSettings } = useSettingsStoreActions();
|
||||
|
||||
const [localSidebarItems, setLocalSidebarItems] = useState(sidebarItems);
|
||||
const [localSidebarItems, setLocalSidebarItems] = useState(settings.sidebarItems);
|
||||
|
||||
const handleSave = () => {
|
||||
setSidebarItems(localSidebarItems);
|
||||
|
|
@ -78,12 +78,26 @@ export const SidebarSettings = () => {
|
|||
);
|
||||
}, []);
|
||||
|
||||
const isSaveButtonDisabled = isEqual(sidebarItems, localSidebarItems);
|
||||
const handleSetSidebarPlaylistList = (e: ChangeEvent<HTMLInputElement>) => {
|
||||
setSettings({
|
||||
general: {
|
||||
...settings,
|
||||
sidebarPlaylistList: e.target.checked,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const isSaveButtonDisabled = isEqual(settings.sidebarItems, localSidebarItems);
|
||||
|
||||
return (
|
||||
<>
|
||||
<SettingsOptions
|
||||
control={<Switch />}
|
||||
control={
|
||||
<Switch
|
||||
checked={settings.sidebarPlaylistList}
|
||||
onChange={handleSetSidebarPlaylistList}
|
||||
/>
|
||||
}
|
||||
description="Show playlist list in sidebar"
|
||||
title="Sidebar playlist list"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue