remove sidebar props from context
This commit is contained in:
parent
31b976fa87
commit
9d4e30d9ea
|
@ -1,4 +1,4 @@
|
|||
import React, { useContext } from 'react';
|
||||
import React from 'react';
|
||||
|
||||
import NavigationSection from './NavigationSection';
|
||||
import UtilitySection from './UtilitySection';
|
||||
|
@ -9,14 +9,17 @@ import { DrawerSidebar, PaddedDivider } from './styledComponents';
|
|||
import HeaderSection from './Header';
|
||||
import { CollectionSummaries } from 'types/collection';
|
||||
import UserDetailsSection from './userDetailsSection';
|
||||
import { GalleryContext } from 'pages/gallery';
|
||||
|
||||
interface Iprops {
|
||||
collectionSummaries: CollectionSummaries;
|
||||
sidebarView: boolean;
|
||||
closeSidebar: () => void;
|
||||
}
|
||||
export default function Sidebar({ collectionSummaries }: Iprops) {
|
||||
const { sidebarView, closeSidebar } = useContext(GalleryContext);
|
||||
|
||||
export default function Sidebar({
|
||||
collectionSummaries,
|
||||
sidebarView,
|
||||
closeSidebar,
|
||||
}: Iprops) {
|
||||
return (
|
||||
<DrawerSidebar open={sidebarView} onClose={closeSidebar}>
|
||||
<HeaderSection closeSidebar={closeSidebar} />
|
||||
|
|
|
@ -130,8 +130,6 @@ const defaultGalleryContext: GalleryContextType = {
|
|||
syncWithRemote: () => null,
|
||||
setNotificationAttributes: () => null,
|
||||
setBlockingLoad: () => null,
|
||||
sidebarView: false,
|
||||
closeSidebar: () => null,
|
||||
};
|
||||
|
||||
export const GalleryContext = createContext<GalleryContextType>(
|
||||
|
@ -204,7 +202,7 @@ export default function Gallery() {
|
|||
const [electronFiles, setElectronFiles] = useState<ElectronFile[]>(null);
|
||||
const [uploadTypeSelectorView, setUploadTypeSelectorView] = useState(false);
|
||||
|
||||
const [sidebarView, setSidebarView] = useState(false);
|
||||
const [sidebarView, setSidebarView] = useState(true);
|
||||
|
||||
const closeSidebar = () => setSidebarView(false);
|
||||
const openSidebar = () => setSidebarView(true);
|
||||
|
@ -584,8 +582,6 @@ export default function Gallery() {
|
|||
syncWithRemote,
|
||||
setNotificationAttributes,
|
||||
setBlockingLoad,
|
||||
closeSidebar,
|
||||
sidebarView,
|
||||
}}>
|
||||
<FullScreenDropZone
|
||||
getRootProps={getRootProps}
|
||||
|
@ -683,7 +679,11 @@ export default function Gallery() {
|
|||
setUploadTypeSelectorView={setUploadTypeSelectorView}
|
||||
showSessionExpiredMessage={showSessionExpiredMessage}
|
||||
/>
|
||||
<Sidebar collectionSummaries={collectionSummaries} />
|
||||
<Sidebar
|
||||
collectionSummaries={collectionSummaries}
|
||||
sidebarView={sidebarView}
|
||||
closeSidebar={closeSidebar}
|
||||
/>
|
||||
|
||||
<PhotoFrame
|
||||
files={files}
|
||||
|
|
|
@ -24,6 +24,4 @@ export type GalleryContextType = {
|
|||
syncWithRemote: (force?: boolean, silent?: boolean) => Promise<void>;
|
||||
setNotificationAttributes: (attributes: NotificationAttributes) => void;
|
||||
setBlockingLoad: (value: boolean) => void;
|
||||
sidebarView: boolean;
|
||||
closeSidebar: () => void;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue