|
|
@@ -2,11 +2,14 @@ import React, {
|
|
|
FC, memo, useCallback,
|
|
|
} from 'react';
|
|
|
|
|
|
+import dynamic from 'next/dynamic';
|
|
|
import Link from 'next/link';
|
|
|
|
|
|
import { useUserUISettings } from '~/client/services/user-ui-settings';
|
|
|
import { SidebarContentsType } from '~/interfaces/ui';
|
|
|
-import { useIsAdmin, useGrowiCloudUri, useIsDefaultLogo } from '~/stores/context';
|
|
|
+import {
|
|
|
+ useIsAdmin, useGrowiCloudUri, useIsDefaultLogo, useIsGuestUser,
|
|
|
+} from '~/stores/context';
|
|
|
import { useCurrentSidebarContents } from '~/stores/ui';
|
|
|
|
|
|
import { SidebarBrandLogo } from './SidebarBrandLogo';
|
|
|
@@ -14,6 +17,12 @@ import { SidebarBrandLogo } from './SidebarBrandLogo';
|
|
|
import styles from './SidebarNav.module.scss';
|
|
|
|
|
|
|
|
|
+const PersonalDropdown = dynamic(() => import('./PersonalDropdown').then(mod => mod.PersonalDropdown), { ssr: false });
|
|
|
+const InAppNotificationDropdown = dynamic(() => import('../InAppNotification/InAppNotificationDropdown')
|
|
|
+ .then(mod => mod.InAppNotificationDropdown), { ssr: false });
|
|
|
+const AppearanceModeDropdown = dynamic(() => import('./AppearanceModeDropdown').then(mod => mod.AppearanceModeDropdown), { ssr: false });
|
|
|
+
|
|
|
+
|
|
|
type PrimaryItemProps = {
|
|
|
contents: SidebarContentsType,
|
|
|
label: string,
|
|
|
@@ -85,11 +94,14 @@ type Props = {
|
|
|
|
|
|
export const SidebarNav: FC<Props> = (props: Props) => {
|
|
|
const { data: isAdmin } = useIsAdmin();
|
|
|
+ const { data: isGuestUser } = useIsGuestUser();
|
|
|
const { data: growiCloudUri } = useGrowiCloudUri();
|
|
|
const { data: isDefaultLogo } = useIsDefaultLogo();
|
|
|
|
|
|
const { onItemSelected } = props;
|
|
|
|
|
|
+ const isAuthenticated = isGuestUser === false;
|
|
|
+
|
|
|
return (
|
|
|
<div className={`grw-sidebar-nav ${styles['grw-sidebar-nav']}`}>
|
|
|
{/* Brand Logo */}
|
|
|
@@ -112,6 +124,10 @@ export const SidebarNav: FC<Props> = (props: Props) => {
|
|
|
<PrimaryItem contents={SidebarContentsType.BOOKMARKS} label="Bookmarks" iconName="bookmark" onItemSelected={onItemSelected} />
|
|
|
</div>
|
|
|
<div className="grw-sidebar-nav-secondary-container">
|
|
|
+ <AppearanceModeDropdown isAuthenticated={isAuthenticated} />
|
|
|
+ <PersonalDropdown />
|
|
|
+ <InAppNotificationDropdown />
|
|
|
+
|
|
|
{isAdmin && <SecondaryItem label="Admin" iconName="settings" href="/admin" />}
|
|
|
{/* <SecondaryItem label="Draft" iconName="file_copy" href="/me/drafts" /> */}
|
|
|
<SecondaryItem label="Help" iconName="help" href={ growiCloudUri != null ? 'https://growi.cloud/help/' : 'https://docs.growi.org' } isBlank />
|