Parcourir la source

put back diff

yohei0125 il y a 3 ans
Parent
commit
5f891c83dc

+ 22 - 32
packages/app/src/components/Sidebar.tsx

@@ -15,53 +15,43 @@ import {
 import DrawerToggler from './Navbar/DrawerToggler';
 import { NavigationResizeHexagon } from './Sidebar/NavigationResizeHexagon';
 import SidebarContents from './Sidebar/SidebarContents';
-import { SidebarNav, SidebarNavSekeleton } from './Sidebar/SidebarNav';
+import SidebarNav from './Sidebar/SidebarNav';
 import { StickyStretchableScroller } from './StickyStretchableScroller';
 
 import './Sidebar.scss';
-import { isServer } from '^/../core/src';
 
 const sidebarMinWidth = 240;
 const sidebarMinimizeWidth = 20;
 const sidebarFixedWidthInDrawerMode = 320;
 
 
-const GlobalNavigation = () => {
-  const { data: isDrawerMode } = useDrawerMode();
-  const { data: currentContents } = useCurrentSidebarContents();
-  const { data: isCollapsed, mutate: mutateSidebarCollapsed } = useSidebarCollapsed();
-
-  const [isLoaded, setIsLoaded] = useState(false);
-  const { scheduleToPut } = useUserUISettings();
-
-  const itemSelectedHandler = useCallback((selectedContents) => {
-    if (isDrawerMode) {
-      return;
-    }
+// const GlobalNavigation = () => {
+//   const { data: isDrawerMode } = useDrawerMode();
+//   const { data: currentContents } = useCurrentSidebarContents();
+//   const { data: isCollapsed, mutate: mutateSidebarCollapsed } = useSidebarCollapsed();
 
-    let newValue = false;
+//   const { scheduleToPut } = useUserUISettings();
 
-    // already selected
-    if (currentContents === selectedContents) {
-      // toggle collapsed
-      newValue = !isCollapsed;
-    }
+//   const itemSelectedHandler = useCallback((selectedContents) => {
+//     if (isDrawerMode) {
+//       return;
+//     }
 
-    mutateSidebarCollapsed(newValue, false);
-    scheduleToPut({ isSidebarCollapsed: newValue });
+//     let newValue = false;
 
-  }, [currentContents, isCollapsed, isDrawerMode, mutateSidebarCollapsed, scheduleToPut]);
+//     // already selected
+//     if (currentContents === selectedContents) {
+//       // toggle collapsed
+//       newValue = !isCollapsed;
+//     }
 
-  useEffect(() => {
-    if (isServer()) return;
-    setIsLoaded(true);
-  }, []);
+//     mutateSidebarCollapsed(newValue, false);
+//     scheduleToPut({ isSidebarCollapsed: newValue });
 
-  return isLoaded
-    ? <SidebarNav onItemSelected={itemSelectedHandler} />
-    : <SidebarNavSekeleton/>;
+//   }, [currentContents, isCollapsed, isDrawerMode, mutateSidebarCollapsed, scheduleToPut]);
 
-};
+//   return <SidebarNav onItemSelected={itemSelectedHandler} />;
+// };
 
 // const SidebarContentsWrapper = () => {
 //   const { mutate: mutateSidebarScroller } = useSidebarScrollerRef();
@@ -310,7 +300,7 @@ const Sidebar = (): JSX.Element => {
           >
             <div className="grw-navigation-wrap">
               <div className="grw-global-navigation">
-                <GlobalNavigation></GlobalNavigation>
+                {/* <GlobalNavigation></GlobalNavigation> */}
               </div>
               <div
                 ref={resizableContainer}

+ 0 - 5
packages/app/src/components/Sidebar/SidebarNav.scss

@@ -1,10 +1,5 @@
 @use '~/styles/variables' as var;
 
-.grw-sidebar-nav-skeleton {
-  width: var.$grw-sidebar-nav-width;
-  height: 100vh;
-}
-
 .grw-sidebar-nav {
   $sidebar-nav-button-height: 55px;
 

+ 2 - 6
packages/app/src/components/Sidebar/SidebarNav.tsx

@@ -71,7 +71,7 @@ type Props = {
   onItemSelected: (contents: SidebarContentsType) => void,
 }
 
-export const SidebarNav: FC<Props> = (props: Props) => {
+const SidebarNav: FC<Props> = (props: Props) => {
 
   const { data: currentUser } = useCurrentUser();
 
@@ -103,8 +103,4 @@ export const SidebarNav: FC<Props> = (props: Props) => {
 
 };
 
-export const SidebarNavSekeleton: FC = () => {
-  return (
-    <div className="grw-sidebar-nav-skeleton"></div>
-  );
-};
+export default SidebarNav;