mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-27 14:58:40 +10:00
feat: comments
* create comment * reply to comment thread * edit comment * delete comment * resolve comment
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
import { useMutation, useQuery, UseQueryResult } from '@tanstack/react-query';
|
||||
import { createPage, deletePage, getPageById, updatePage } from '@/features/page/services/page-service';
|
||||
import { IPage } from '@/features/page/types/page.types';
|
||||
import { useAtom } from 'jotai/index';
|
||||
import { pageAtom } from '@/features/page/atoms/page-atom';
|
||||
|
||||
export default function usePage(pageId?: string) {
|
||||
const [page, setPage] = useAtom(pageAtom<IPage>(pageId));
|
||||
|
||||
const createMutation = useMutation(
|
||||
(data: Partial<IPage>) => createPage(data),
|
||||
);
|
||||
@@ -21,11 +17,6 @@ export default function usePage(pageId?: string) {
|
||||
|
||||
const updateMutation = useMutation(
|
||||
(data: Partial<IPage>) => updatePage(data),
|
||||
{
|
||||
onSuccess: (updatedPageData) => {
|
||||
setPage(updatedPageData);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const removeMutation = useMutation(
|
||||
@@ -13,7 +13,7 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
import { IMovePage } from '@/features/page/types/page.types';
|
||||
import { useNavigate} from 'react-router-dom';
|
||||
import { TreeNode } from '@/features/page/tree/types';
|
||||
import usePage from '@/features/page/hooks/usePage';
|
||||
import usePage from '@/features/page/hooks/use-page';
|
||||
|
||||
export function usePersistence<T>() {
|
||||
const [data, setData] = useAtom(treeDataAtom);
|
||||
|
||||
@@ -56,7 +56,7 @@ export default function PageTree() {
|
||||
tree?.select(pageId);
|
||||
tree?.scrollTo(pageId, 'center');
|
||||
}, 200);
|
||||
}, [tree]);
|
||||
}, [tree, pageId]);
|
||||
|
||||
return (
|
||||
<div ref={rootElement} className={classes.treeContainer}>
|
||||
|
||||
Reference in New Issue
Block a user