Skip to content

feat(pages): add Wiki / Pages feature#6

Merged
anujeet98 merged 5 commits into
mainfrom
feat/add-wiki
Jul 14, 2026
Merged

feat(pages): add Wiki / Pages feature#6
anujeet98 merged 5 commits into
mainfrom
feat/add-wiki

Conversation

@Rishavraaj

Copy link
Copy Markdown
Member

Summary

Adds a Wiki / Pages feature to Zuko — a rich-text knowledge base where teams can write and organize findings, decisions, and runbooks. Pages are scoped to an organization, support nested subpages, and use Editor.js as the editor with autosave.


Changes

Database

  • New page table: stores title, blocks (Editor.js JSON), version, parentId (for nesting), and org/user relations
  • Migration: 20260713082325_add_pages_and_page_attachments

Backend (apps/backend)

  • pages.module.ts — registers the pages feature module; imported into app.module.ts
  • pages.controller.ts — REST endpoints: GET /pages, GET /pages/:id, POST /pages, PATCH /pages/:id, DELETE /pages/:id; guarded by AuthGuard + OrganizationGuard
  • pages.service.ts — business logic: create, read, update, delete with parent-cycle guard (prevents a page being nested under its own child)
  • pages.repository.ts — Prisma queries; all scoped to the caller's organization
  • dto/page.dto.ts — Zod schemas for create/update request validation

Frontend (apps/web)

  • /pages — list view using the shared BaseTable pattern (same as contacts/companies/tasks); title cell shows hover-reveal icons to open in drawer or full page
  • /pages/[id] — full-page editor: two-column layout with Editor.js on the left and a metadata sidebar (last updated, table of contents, subpages) on the right; read/edit toggle switch; autosave with "Saving…" / "Saved ✓" indicator
  • PageDrawer — slide-over drawer that opens when clicking a page from the list; shows the page editor inline without leaving the list
  • use-page-detail-editor.ts — shared hook used by both PageDetail and PageDrawer for save state and cache sync
  • PageTableOfContents — parses Editor.js heading blocks and renders an on-page anchor list
  • lib/api/pages.ts — typed API client for all pages endpoints
  • query-options.ts — TanStack Query options for pages list and page detail (staleTime: Infinity on detail to avoid remounting the editor on navigation)
  • application-layout.tsx — added "Wiki" nav item

UI Kit (libs/ui-kit)

  • WikiEditor — Editor.js wrapper (dynamic import, SSR-disabled); tools: header, list (with checklist), code, quote, table, inline code, marker, embed, delimiter, warning
  • WikiPage — autosave layer on top of WikiEditor; debounces saves by 2 s, fires onSaveStart / onSaveComplete / onSaveError callbacks
  • Drawer — Headless UI slide-over component
  • globals.css — Editor.js typography overrides: font sizes, line heights, checklist checkbox colors/alignment, inline code styles, dark mode text colors
  • panel-right.svg — Lucide panel-right icon in public/icons for the drawer-open button

Models (libs/models)

  • editor-markdown.ts — utility to convert Editor.js blocks to plain Markdown (for MCP/search use later)

Test Plan

  • GET /pages returns empty list for a fresh org
  • Create page via "New Page" — opens in drawer, title defaults to "Untitled"
  • Edit title in drawer and full-page view — saves on blur, updates list
  • Write content in editor — autosaves after 2 s; "Saving…" then "Saved ✓" appears
  • Navigate away and back — content persists without a network refetch
  • Create a subpage from the sidebar — appears under parent in the subpages list
  • Delete a page — subpages are also removed; drawer closes if deleted page was open
  • Cross-org isolation — page from org A is not visible or editable from org B
  • Dark mode — text, checkboxes, and inline code all render correctly

Rishavraaj and others added 5 commits July 14, 2026 13:03
Org-scoped knowledge base built on Editor.js. Teams can create, nest,
and edit rich-text pages with autosave. Accessible from a dedicated
/pages list view and inline via a side drawer.

Backend: PagesModule with CRUD controller + service + repository,
Zod-validated DTOs, all queries org-scoped via OrganizationGuard.

Frontend: /pages list (BaseTable pattern), /pages/[id] full-page editor
with read/edit toggle and metadata sidebar (ToC, subpages, last updated),
PageDrawer for inline editing, usePageDetailEditor shared hook, typed
API client, TanStack Query options with staleTime: Infinity on detail
to prevent editor remounts on back-navigation.

UI kit: WikiEditor (Editor.js dynamic import, SSR-off), WikiPage
(autosave debounce + save lifecycle callbacks), Drawer (Headless UI
slide-over), Editor.js CSS overrides for typography/dark mode/checklists,
editor-markdown converter utility, panel-right SVG icon.

Database: page table with parentId self-relation for subpage nesting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove @editorjs/attaches package and its @codexteam/ajax dependency
- Remove @editorjs/image package
- Remove @excalidraw/excalidraw and related packages (@excalidraw/laser-pointer, @excalidraw/mermaid-to-excalidraw, @excalidraw/random-username, @excalidraw/markdown-to-text)
- Remove @Chevrotain parsing utilities (@chevrotain/cst-dts-gen, @chevrotain/gast, @chevrotain/regexp-to-ast, @chevrotain/utils)
- Update @braintree/sanitize-url from 6.0.2 to 7.1.2
- Clean up unused dependencies to reduce bundle size and maintenance overhead

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
`<label>` without an associated control fails the jsx-a11y
label-has-associated-control lint rule. The element is a visual heading,
not a form label.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@anujeet98
anujeet98 merged commit 1e67225 into main Jul 14, 2026
1 check passed
@anujeet98
anujeet98 deleted the feat/add-wiki branch July 14, 2026 15:21
@Rishavraaj Rishavraaj self-assigned this Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants