mirror of
https://github.com/docmost/docmost.git
synced 2026-07-27 09:24:40 +10:00
feat(base): render table icon in sidebar for is_base=true pages
- Add isBase to SpaceTreeNode type - Forward isBase from IPage in buildTree utility - In the sidebar Node renderer, show IconTable when node.data.isBase is true and no custom emoji icon is set
This commit is contained in:
@@ -30,6 +30,7 @@ import {
|
|||||||
IconPointFilled,
|
IconPointFilled,
|
||||||
IconStar,
|
IconStar,
|
||||||
IconStarFilled,
|
IconStarFilled,
|
||||||
|
IconTable,
|
||||||
IconTrash,
|
IconTrash,
|
||||||
} from "@tabler/icons-react";
|
} from "@tabler/icons-react";
|
||||||
import {
|
import {
|
||||||
@@ -422,6 +423,8 @@ function Node({ node, style, dragHandle, tree }: NodeRendererProps<any>) {
|
|||||||
icon={
|
icon={
|
||||||
node.data.icon ? (
|
node.data.icon ? (
|
||||||
node.data.icon
|
node.data.icon
|
||||||
|
) : node.data.isBase ? (
|
||||||
|
<IconTable size={18} />
|
||||||
) : (
|
) : (
|
||||||
<IconFileDescription size="18" />
|
<IconFileDescription size="18" />
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export type SpaceTreeNode = {
|
|||||||
spaceId: string;
|
spaceId: string;
|
||||||
parentPageId: string;
|
parentPageId: string;
|
||||||
hasChildren: boolean;
|
hasChildren: boolean;
|
||||||
|
isBase?: boolean;
|
||||||
canEdit?: boolean;
|
canEdit?: boolean;
|
||||||
children: SpaceTreeNode[];
|
children: SpaceTreeNode[];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export function buildTree(pages: IPage[]): SpaceTreeNode[] {
|
|||||||
hasChildren: page.hasChildren,
|
hasChildren: page.hasChildren,
|
||||||
spaceId: page.spaceId,
|
spaceId: page.spaceId,
|
||||||
parentPageId: page.parentPageId,
|
parentPageId: page.parentPageId,
|
||||||
|
isBase: page.isBase,
|
||||||
canEdit: page.canEdit ?? page.permissions?.canEdit,
|
canEdit: page.canEdit ?? page.permissions?.canEdit,
|
||||||
children: [],
|
children: [],
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user