Make collapsed sidebar navigation configurable

This commit is contained in:
jeffvli 2023-09-22 17:55:03 -07:00
parent 8cbc25a932
commit 47dc83f360
3 changed files with 43 additions and 20 deletions

View file

@ -87,6 +87,15 @@ export const SidebarSettings = () => {
}); });
}; };
const handleSetSidebarCollapsedNavigation = (e: ChangeEvent<HTMLInputElement>) => {
setSettings({
general: {
...settings,
sidebarCollapsedNavigation: e.target.checked,
},
});
};
const isSaveButtonDisabled = isEqual(settings.sidebarItems, localSidebarItems); const isSaveButtonDisabled = isEqual(settings.sidebarItems, localSidebarItems);
return ( return (
@ -101,6 +110,16 @@ export const SidebarSettings = () => {
description="Show playlist list in sidebar" description="Show playlist list in sidebar"
title="Sidebar playlist list" title="Sidebar playlist list"
/> />
<SettingsOptions
control={
<Switch
checked={settings.sidebarCollapsedNavigation}
onChange={handleSetSidebarCollapsedNavigation}
/>
}
description="Show navigation buttons in the collapsed sidebar"
title="Sidebar (collapsed) navigation"
/>
<SettingsOptions <SettingsOptions
control={ control={
<Button <Button

View file

@ -95,7 +95,7 @@ const sidebarItemMap = {
export const CollapsedSidebar = () => { export const CollapsedSidebar = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const { windowBarStyle } = useWindowSettings(); const { windowBarStyle } = useWindowSettings();
const { sidebarItems } = useGeneralSettings(); const { sidebarItems, sidebarCollapsedNavigation } = useGeneralSettings();
const sidebarItemsWithRoute: (SidebarItemType & { const sidebarItemsWithRoute: (SidebarItemType & {
activeIcon: IconType; activeIcon: IconType;
@ -119,6 +119,7 @@ export const CollapsedSidebar = () => {
scrollHideDelay={0} scrollHideDelay={0}
scrollbarSize={8} scrollbarSize={8}
> >
{sidebarCollapsedNavigation && (
<Group <Group
grow grow
spacing={0} spacing={0}
@ -139,6 +140,7 @@ export const CollapsedSidebar = () => {
<RiArrowRightSLine size="22" /> <RiArrowRightSLine size="22" />
</CollapsedSidebarButton> </CollapsedSidebarButton>
</Group> </Group>
)}
<DropdownMenu position="right-start"> <DropdownMenu position="right-start">
<DropdownMenu.Target> <DropdownMenu.Target>
<CollapsedSidebarItem <CollapsedSidebarItem

View file

@ -113,6 +113,7 @@ export interface SettingsState {
resume: boolean; resume: boolean;
showQueueDrawerButton: boolean; showQueueDrawerButton: boolean;
sideQueueType: SideQueueType; sideQueueType: SideQueueType;
sidebarCollapsedNavigation: boolean;
sidebarItems: SidebarItemType[]; sidebarItems: SidebarItemType[];
sidebarPlaylistList: boolean; sidebarPlaylistList: boolean;
skipButtons: { skipButtons: {
@ -208,6 +209,7 @@ const initialState: SettingsState = {
resume: false, resume: false,
showQueueDrawerButton: false, showQueueDrawerButton: false,
sideQueueType: 'sideQueue', sideQueueType: 'sideQueue',
sidebarCollapsedNavigation: true,
sidebarItems, sidebarItems,
sidebarPlaylistList: true, sidebarPlaylistList: true,
skipButtons: { skipButtons: {