| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { memo } from 'react';
- import dynamic from 'next/dynamic';
- import { SidebarContentsType } from '~/interfaces/ui';
- import { useSidebarMode } from '~/stores/ui';
- import { PrimaryItem } from './PrimaryItem';
- import styles from './PrimaryItems.module.scss';
- // Do not SSR Socket.io to make it work
- const PrimaryItemForNotification = dynamic(
- () => import('../InAppNotification/PrimaryItemForNotification').then(mod => mod.PrimaryItemForNotification), { ssr: false },
- );
- type Props = {
- onItemHover?: (contents: SidebarContentsType) => void,
- }
- export const PrimaryItems = memo((props: Props) => {
- const { onItemHover } = props;
- const { data: sidebarMode } = useSidebarMode();
- if (sidebarMode == null) {
- return <></>;
- }
- return (
- <div className={styles['grw-primary-items']}>
- <PrimaryItem sidebarMode={sidebarMode} contents={SidebarContentsType.TREE} label="Page Tree" iconName="list" onHover={onItemHover} />
- <PrimaryItem sidebarMode={sidebarMode} contents={SidebarContentsType.CUSTOM} label="Custom Sidebar" iconName="code" onHover={onItemHover} />
- <PrimaryItem sidebarMode={sidebarMode} contents={SidebarContentsType.RECENT} label="Recent Changes" iconName="update" onHover={onItemHover} />
- <PrimaryItem sidebarMode={sidebarMode} contents={SidebarContentsType.BOOKMARKS} label="Bookmarks" iconName="bookmarks" onHover={onItemHover} />
- <PrimaryItem sidebarMode={sidebarMode} contents={SidebarContentsType.TAG} label="Tags" iconName="local_offer" onHover={onItemHover} />
- <PrimaryItemForNotification sidebarMode={sidebarMode} onHover={onItemHover} />
- </div>
- );
- });
|