Skip to content
This repository has been archived by the owner on Aug 23, 2024. It is now read-only.

Commit

Permalink
Initial sidebar improvements
Browse files Browse the repository at this point in the history
- Add playlist list to sidebar
- Add cover art toggle to sidebar
- Drag resizable
  • Loading branch information
jeffvli committed Feb 6, 2022
1 parent 97457de commit efc0e40
Show file tree
Hide file tree
Showing 13 changed files with 717 additions and 235 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
"react-query": "^3.19.1",
"react-redux": "^7.2.4",
"react-router-dom": "^5.2.0",
"react-use": "^17.3.2",
"react-virtualized-auto-sizer": "^1.0.6",
"react-visibility-sensor": "^5.1.1",
"react-window": "^1.8.6",
Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ const miscState: General = {
contextMenu: {
show: false,
},
expandSidebar: false,
sidebar: {
expand: false,
coverArt: true,
width: '225px',
},
modal: {
currentPageIndex: undefined,
show: false,
Expand Down
11 changes: 7 additions & 4 deletions src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useEffect, useState } from 'react';
import settings from 'electron-settings';
import { useHotkeys } from 'react-hotkeys-hook';
import { useHistory } from 'react-router-dom';
import { ButtonToolbar, Content, FlexboxGrid, Icon, Nav, Whisper } from 'rsuite';
import { useTranslation } from 'react-i18next';
import Sidebar from './Sidebar';
import Titlebar from './Titlebar';
import { RootContainer, RootFooter, MainContainer } from './styled';
import { setContextMenu, setExpandSidebar, setSearchQuery } from '../../redux/miscSlice';
import { setContextMenu, setSearchQuery, setSidebar } from '../../redux/miscSlice';
import { useAppDispatch, useAppSelector } from '../../redux/hooks';
import { clearSelected } from '../../redux/multiSelectSlice';
import {
Expand Down Expand Up @@ -58,7 +59,8 @@ const Layout = ({ footer, children, disableSidebar, font }: any) => {
});

const handleToggle = () => {
dispatch(setExpandSidebar(!misc.expandSidebar));
settings.setSync('sidebar.expand', !misc.sidebar.expand);
dispatch(setSidebar({ expand: !misc.sidebar.expand }));
};

const handleSidebarSelect = (e: string) => {
Expand Down Expand Up @@ -111,7 +113,7 @@ const Layout = ({ footer, children, disableSidebar, font }: any) => {
<>
<Titlebar font={font} />
<Sidebar
expand={misc.expandSidebar}
expand={misc.sidebar.expand}
handleToggle={handleToggle}
handleSidebarSelect={handleSidebarSelect}
disableSidebar={disableSidebar}
Expand Down Expand Up @@ -145,7 +147,8 @@ const Layout = ({ footer, children, disableSidebar, font }: any) => {
>
<MainContainer
id="container-main"
expanded={misc.expandSidebar}
expanded={misc.sidebar.expand}
sidebarwidth={misc.sidebar.width}
$titleBar={misc.titleBar} // transient prop to determine margin
>
<FlexboxGrid
Expand Down
Loading

0 comments on commit efc0e40

Please sign in to comment.