Yuki Takei 4 лет назад
Родитель
Сommit
3e039e0092

+ 6 - 5
packages/app/src/components/Sidebar.tsx

@@ -11,6 +11,7 @@ import DrawerToggler from './Navbar/DrawerToggler';
 
 import SidebarNav from './Sidebar/SidebarNav';
 import SidebarContents from './Sidebar/SidebarContents';
+import { useIsSharedUser } from '~/stores/context';
 
 const sidebarMinWidth = 240;
 const sidebarMinimizeWidth = 20;
@@ -69,11 +70,6 @@ const SidebarContentsWrapper = () => {
 
       <div id="grw-sidebar-contents-scroll-target">
         <div id="grw-sidebar-content-container">
-          {/* TODO: set isSharedUser
-          <SidebarContents
-            isSharedUser={this.props.appContainer.isSharedUser}
-          />
-          */}
           <SidebarContents />
         </div>
       </div>
@@ -96,6 +92,7 @@ type Props = {
 }
 
 const Sidebar = (props: Props) => {
+  const { data: isSharedUser } = useIsSharedUser();
   const { data: isDrawerMode } = useDrawerMode();
   const { data: isDrawerOpened, mutate: mutateDrawerOpened } = useDrawerOpened();
   const { data: currentProductNavWidth, mutate: mutateProductNavWidth } = useCurrentProductNavWidth(props.productNavWidth);
@@ -267,6 +264,10 @@ const Sidebar = (props: Props) => {
     document.addEventListener('mouseup', dragableAreaMouseUpHandler);
   }, [draggableAreaMoveHandler, dragableAreaMouseUpHandler]);
 
+  if (isSharedUser) {
+    return null;
+  }
+
   return (
     <>
       <div className={`grw-sidebar d-print-none ${isDrawerMode ? 'grw-sidebar-drawer' : ''} ${isDrawerOpened ? 'open' : ''}`}>

+ 0 - 12
packages/app/src/components/Sidebar/SidebarContents.tsx

@@ -5,19 +5,12 @@ import CustomSidebar from './CustomSidebar';
 import { useCurrentSidebarContents, SidebarContents as SidebarContentType } from '~/stores/ui';
 
 type Props = {
-  isSharedUser?: boolean,
 };
 
 const SidebarContents: FC<Props> = (props: Props) => {
 
   const { data: currentSidebarContents } = useCurrentSidebarContents();
 
-  const { isSharedUser } = props;
-
-  if (isSharedUser) {
-    return null;
-  }
-
   let Contents;
   switch (currentSidebarContents) {
     case SidebarContentType.RECENT:
@@ -33,9 +26,4 @@ const SidebarContents: FC<Props> = (props: Props) => {
 
 };
 
-
-SidebarContents.defaultProps = {
-  isSharedUser: false,
-};
-
 export default SidebarContents;