Merge pull request #55 from docmost/fix/bug-fixes
Fix: missing tree, editor font and responsive recent pages
This commit is contained in:
commit
0fc8edeb52
6 changed files with 53 additions and 48 deletions
|
|
@ -1,4 +1,11 @@
|
||||||
import { Text, Group, UnstyledButton, Badge, Table } from "@mantine/core";
|
import {
|
||||||
|
Text,
|
||||||
|
Group,
|
||||||
|
UnstyledButton,
|
||||||
|
Badge,
|
||||||
|
Table,
|
||||||
|
ScrollArea,
|
||||||
|
} from "@mantine/core";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import PageListSkeleton from "@/components/ui/page-list-skeleton.tsx";
|
import PageListSkeleton from "@/components/ui/page-list-skeleton.tsx";
|
||||||
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
||||||
|
|
@ -22,6 +29,7 @@ export default function RecentChanges({ spaceId }: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return pages && pages.items.length > 0 ? (
|
return pages && pages.items.length > 0 ? (
|
||||||
|
<ScrollArea>
|
||||||
<Table highlightOnHover verticalSpacing="sm">
|
<Table highlightOnHover verticalSpacing="sm">
|
||||||
<Table.Tbody>
|
<Table.Tbody>
|
||||||
{pages.items.map((page) => (
|
{pages.items.map((page) => (
|
||||||
|
|
@ -62,6 +70,7 @@ export default function RecentChanges({ spaceId }: Props) {
|
||||||
))}
|
))}
|
||||||
</Table.Tbody>
|
</Table.Tbody>
|
||||||
</Table>
|
</Table>
|
||||||
|
</ScrollArea>
|
||||||
) : (
|
) : (
|
||||||
<Text size="md" ta="center">
|
<Text size="md" ta="center">
|
||||||
No pages yet
|
No pages yet
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
);
|
);
|
||||||
font-size: var(--mantine-font-size-md);
|
font-size: var(--mantine-font-size-md);
|
||||||
line-height: var(--mantine-line-height-xl);
|
line-height: var(--mantine-line-height-xl);
|
||||||
font-weight: 415;
|
font-weight: 400;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
> * + * {
|
> * + * {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
iframe {
|
iframe {
|
||||||
display: block;
|
display: block;
|
||||||
outline: 0px solid transparent;
|
outline: 0 solid transparent;
|
||||||
border-radius: var(--mantine-radius-md);
|
border-radius: var(--mantine-radius-md);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ export default function SpaceTree({ spaceId, readOnly }: SpaceTreeProps) {
|
||||||
if (pagesData?.pages && !hasNextPage) {
|
if (pagesData?.pages && !hasNextPage) {
|
||||||
const allItems = pagesData.pages.flatMap((page) => page.items);
|
const allItems = pagesData.pages.flatMap((page) => page.items);
|
||||||
const treeData = buildTree(allItems);
|
const treeData = buildTree(allItems);
|
||||||
|
|
||||||
if (data.length < 1 || data?.[0].spaceId !== spaceId) {
|
if (data.length < 1 || data?.[0].spaceId !== spaceId) {
|
||||||
//Thoughts
|
//Thoughts
|
||||||
// don't reset if there is data in state
|
// don't reset if there is data in state
|
||||||
|
|
@ -106,7 +107,7 @@ export default function SpaceTree({ spaceId, readOnly }: SpaceTreeProps) {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
if (isDataLoaded.current && currentPage) {
|
if (isDataLoaded.current && currentPage) {
|
||||||
// check if pageId node is present in the tree
|
// check if pageId node is present in the tree
|
||||||
const node = dfs(treeApiRef.current.root, currentPage.id);
|
const node = dfs(treeApiRef.current?.root, currentPage.id);
|
||||||
if (node) {
|
if (node) {
|
||||||
// if node is found, no need to traverse its ancestors
|
// if node is found, no need to traverse its ancestors
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,8 @@ export function useTreeMutation<T>(spaceId: string) {
|
||||||
slugId: createdPage.slugId,
|
slugId: createdPage.slugId,
|
||||||
name: "",
|
name: "",
|
||||||
position: createdPage.position,
|
position: createdPage.position,
|
||||||
|
spaceId: createdPage.spaceId,
|
||||||
|
parentPageId: createdPage.parentPageId,
|
||||||
children: [],
|
children: [],
|
||||||
} as any;
|
} as any;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,10 @@
|
||||||
import { Group, Center, Text } from "@mantine/core";
|
import { Group, Center, Text } from "@mantine/core";
|
||||||
import { Spotlight } from "@mantine/spotlight";
|
import { Spotlight } from "@mantine/spotlight";
|
||||||
import {
|
import { IconFileDescription, IconSearch } from "@tabler/icons-react";
|
||||||
IconFileDescription,
|
|
||||||
IconHome,
|
|
||||||
IconSearch,
|
|
||||||
IconSettings,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { useDebouncedValue } from "@mantine/hooks";
|
import { useDebouncedValue } from "@mantine/hooks";
|
||||||
import { usePageSearchQuery } from "@/features/search/queries/search-query";
|
import { usePageSearchQuery } from "@/features/search/queries/search-query";
|
||||||
import { useGetSpaceBySlugQuery } from "@/features/space/queries/space-query.ts";
|
|
||||||
import { useRecentChangesQuery } from "@/features/page/queries/page-query.ts";
|
|
||||||
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
import { buildPageUrl } from "@/features/page/page.utils.ts";
|
||||||
|
|
||||||
interface SearchSpotlightProps {
|
interface SearchSpotlightProps {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue