diff --git a/client/package.json b/client/package.json index ae7c6682..38dbb018 100644 --- a/client/package.json +++ b/client/package.json @@ -9,7 +9,7 @@ "preview": "vite preview --port 3000" }, "dependencies": { - "@hocuspocus/provider": "^2.7.1", + "@hocuspocus/provider": "^2.8.1", "@mantine/core": "^7.2.2", "@mantine/form": "^7.2.2", "@mantine/hooks": "^7.2.2", diff --git a/client/src/components/aside/aside.tsx b/client/src/components/aside/aside.tsx index 3c8bfe87..04c3d1ae 100644 --- a/client/src/components/aside/aside.tsx +++ b/client/src/components/aside/aside.tsx @@ -1,11 +1,41 @@ -import React, { Suspense } from 'react'; - -const Comments = React.lazy(() => import('@/features/comment/comments')); +import { Box, ScrollArea, Text, useMantineTheme } from '@mantine/core'; +import CommentList from '@/features/comment/components/comment-list'; +import { useAtom } from 'jotai'; +import { asideStateAtom } from '@/components/navbar/atoms/sidebar-atom'; +import React from 'react'; export default function Aside() { + const theme = useMantineTheme(); + const [{ tab }] = useAtom(asideStateAtom); + + let title; + let component; + + switch (tab) { + case 'comments': + component = ; + title = 'Comments'; + break; + default: + component = null; + title = null; + } + + return ( - Loading comments...}> - - + + {component && ( + <> + {title} + + +
+ {component} + +
+
+ + )} +
); } diff --git a/client/src/components/layouts/header.tsx b/client/src/components/layouts/header.tsx index 5b173db9..e05cc82c 100644 --- a/client/src/components/layouts/header.tsx +++ b/client/src/components/layouts/header.tsx @@ -2,7 +2,6 @@ import { ActionIcon, Menu, Button, - rem, } from '@mantine/core'; import { IconDots, @@ -15,15 +14,20 @@ import { IconMessage, } from '@tabler/icons-react'; import React from 'react'; +import useToggleAside from '@/hooks/use-toggle-aside'; +import { useAtom } from 'jotai'; +import { historyAtoms } from '@/features/page-history/atoms/history-atoms'; export default function Header() { + const toggleAside = useToggleAside(); + return ( <> - + toggleAside('comments')}> @@ -33,6 +37,12 @@ export default function Header() { } function PageActionMenu() { + const [, setHistoryModalOpen] = useAtom(historyAtoms); + + const openHistoryModal = () => { + setHistoryModalOpen(true); + }; + return ( - } - > + leftSection={}> Page info } + leftSection={} > Copy link - } - > + leftSection={}> Share - } - > + leftSection={} + onClick={openHistoryModal}> Page history } - > + leftSection={}> Lock - } - > + leftSection={}> Delete diff --git a/client/src/components/layouts/shell.tsx b/client/src/components/layouts/shell.tsx index b6c83ea6..2a38862e 100644 --- a/client/src/components/layouts/shell.tsx +++ b/client/src/components/layouts/shell.tsx @@ -1,4 +1,4 @@ -import { desktopAsideAtom, desktopSidebarAtom } from '@/components/navbar/atoms/sidebar-atom'; +import { asideStateAtom, desktopSidebarAtom } from '@/components/navbar/atoms/sidebar-atom'; import { useToggleSidebar } from '@/components/navbar/hooks/use-toggle-sidebar'; import { Navbar } from '@/components/navbar/navbar'; import { AppShell, Burger, Group } from '@mantine/core'; @@ -8,12 +8,16 @@ import classes from './shell.module.css'; import Header from '@/components/layouts/header'; import Breadcrumb from '@/components/layouts/components/breadcrumb'; import Aside from '@/components/aside/aside'; +import { useMatchPath } from '@/hooks/use-match-path'; +import React from 'react'; export default function Shell({ children }: { children: React.ReactNode }) { const [mobileOpened, { toggle: toggleMobile }] = useDisclosure(); const [desktopOpened] = useAtom(desktopSidebarAtom); const toggleDesktop = useToggleSidebar(desktopSidebarAtom); - const [desktopAsideOpened] = useAtom(desktopAsideAtom); + const matchPath = useMatchPath(); + const isPageRoute = matchPath('/p/:pageId'); + const [{ isAsideOpen }] = useAtom(asideStateAtom); return ( - - - - -
+ {isPageRoute && } + { + isPageRoute && + +
+ + } @@ -66,9 +76,13 @@ export default function Shell({ children }: { children: React.ReactNode }) { {children} - -