Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Fixes and improvements in document editor and container header
Hakan Shehuce84e6519e38
diff --git a/desktop/src/components/documents/document.tsx b/desktop/src/components/documents/document.tsxindex f156cb74..2b9bc840 100644--- a/desktop/src/components/documents/document.tsx+++ b/desktop/src/components/documents/document.tsx@@ -6,6 +6,7 @@ import { sql } from 'kysely';import { SelectNode } from '@/data/schemas/workspace';import { useWorkspace } from '@/contexts/workspace';import { mapNode } from '@/lib/nodes';+import { NodeTypes } from '@/lib/constants';interface DocumentProps {node: LocalNode;@@ -27,6 +28,7 @@ export const Document = ({ node }: DocumentProps) => {SELECT child.*FROM nodes childINNER JOIN document_hierarchy parent ON child.parent_id = parent.id+ WHERE parent.type NOT IN (${NodeTypes.Page}))SELECT *FROM document_hierarchy;diff --git a/desktop/src/components/workspaces/container-header.tsx b/desktop/src/components/workspaces/container-header.tsxindex 83d76127..f6bf6764 100644--- a/desktop/src/components/workspaces/container-header.tsx+++ b/desktop/src/components/workspaces/container-header.tsx@@ -30,6 +30,21 @@ import { useQuery } from '@tanstack/react-query';import { SelectNode } from '@/data/schemas/workspace';import { NeuronId } from '@/lib/id';+const buildBreadcrumbNodes = (node: LocalNode, rows: SelectNode[]) => {+ const breadcrumbNodes: LocalNode[] = [];+ let parentId = node.parentId;+ while (parentId !== null && parentId !== undefined) {+ const row = rows.find((row) => row.id === parentId);+ if (row) {+ breadcrumbNodes.push(mapNode(row));+ parentId = row.parent_id;+ } else {+ parentId = null;+ }+ }+ return breadcrumbNodes.reverse();+};+interface BreadcrumbNodeProps {node: LocalNode;className?: string;@@ -72,6 +87,7 @@ export const BreadcrumbNodeEditor = ({ node }: BreadcrumbNodeEditorProps) => {updated_by: workspace.userId,version_id: NeuronId.generate(NeuronId.Type.Version),})+ .where('id', '=', node.id).compile();await workspace.mutate(query);@@ -125,7 +141,7 @@ export const ContainerHeader = ({ node }: ContainerHeaderProps) => {return null;}- const breadcrumbNodes = data?.rows.map((row) => mapNode(row)) ?? [];+ const breadcrumbNodes: LocalNode[] = buildBreadcrumbNodes(node, data.rows);const showEllipsis = breadcrumbNodes.length > 2;const firstNodes = showEllipsis? breadcrumbNodes.slice(0, 1)diff --git a/server/src/routes/accounts.ts b/server/src/routes/accounts.tsindex 085e9f79..8c426a57 100644--- a/server/src/routes/accounts.ts+++ b/server/src/routes/accounts.ts@@ -156,6 +156,7 @@ accountsRouter.post('/login/google', async (req: Request, res: Response) => {attrs: JSON.stringify({ googleId: googleUser.id }),updated_at: new Date(),})+ .where('id', '=', existingAccount.id).execute();}