Skip to content

Notebooks: editor, publish, upload, share polish#85

Merged
Panthevm merged 3 commits into
masterfrom
7624-notebooks-view
May 21, 2026
Merged

Notebooks: editor, publish, upload, share polish#85
Panthevm merged 3 commits into
masterfrom
7624-notebooks-view

Conversation

@Panthevm
Copy link
Copy Markdown
Collaborator

Summary

  • Full create/edit experience at /notebooks/new and /notebooks/$id/edit — reuses the view-mode REST/SQL/RPC cell components with editable values, adds a Markdown cell with Edit/Preview tabs, + dividers around every cell, and a left-side delete affordance.
  • View and edit pages now share a sticky top toolbar (mx-auto max-w-[990px]) with ghost-style buttons that mirror Resource editor styling: Edit/Save in link color, Share dropdown last, Publish/Unpublish/Delete next to them.
  • Cell Send now persists cell.result back into the notebook and triggers a background save when the notebook already has an id, so running cells survives reloads. Send/trash become hover-only inside cells; the + divider is always visible.
  • Publish flow: view-mode action calls aidbox.notebooks/publish-notebook. Saves on published notebooks automatically piggy-back an update-published-notebook. Unpublish clears publication-id/edit-secret with a follow-up save so the Publish button comes back. Deleting a published notebook auto-unpublishes first.
  • Upload dropdown ("as link" + "as file"): "link" opens a dialog backed by import-notebook; "file" parses the <data value=…> blob produced by Share→As file and posts import-notebook-as-json.
  • Breadcrumbs on the edit page render Notebooks / <name> / Edit by injecting a middle crumb that resolves the notebook name (uses the same useNotebookDisplay as the view crumb).
  • Markdown rendering: detect block code when fenced with a language OR when content is multi-line, switch to typo-code, and tighten spacing so view ↔ edit do not shift.
  • New EDN pretty printer (src/utils/edn.ts) in clojure.pprint style for RPC responses with application/edn content type.
  • New reusable ConfirmDialog primitive backing Delete / Publish / Unpublish.
  • List dedup: hide the community copy on the list page when its origin matches a local personal notebook.

Test plan

  • Create a new notebook from /notebooks/new, add cells of every type, run them, refresh — results are persisted and re-rendered.
  • Open an existing notebook, edit cells, Save — redirects to view page; results survive.
  • Publish a notebook from view, refresh — Publish disappears, Unpublish shows up. Update the notebook in edit + Save → re-publish happens silently.
  • Unpublish → Publish reappears immediately on the same page.
  • Delete a published notebook — auto-unpublishes and removes from the list.
  • Share → As link copies an import-url; open another tab and import via Upload → As link.
  • Share → As file downloads HTML that re-imports cleanly via Upload → As file.
  • Open a community notebook on /notebooks — Edit/Publish/Delete hidden, Share-as-file still works.
  • Verify the personal notebook is shown once after publishing (no community duplicate in the list).
  • Breadcrumb on edit reads Notebooks / <name> / Edit.

Panthevm added 3 commits May 20, 2026 19:35
- Sidebar: Notebooks link with Notebook icon
- /notebooks (index): list of personal + community notebooks via
  aidbox.notebooks/notebooks RPC, fuzzy search, tag chips for cell
  types (rest/sql/markdown), keyboard navigation
- /notebooks/$id (view): renders cells read-only.
  - Markdown cells via react-markdown + remark-gfm
  - REST cells: raw editor + Send + response with Body/Headers tabs,
    status/duration; saved cell.result auto-populates response
  - SQL cells: SQL editor + Send + results rendered via shared
    ResultContent (db-console table); saved result auto-populates
- /notebooks/$id/edit placeholder
- /notebooks/new placeholder
- /notebooks parent layout for breadcrumb
- Search/tag UX consistency fix in Analytics and ResourceBrowser:
  trailing-token isn't promoted to a chip until whitespace is typed
- Markdown code: treat fenced code without a language as a block
  (was rendered as inline pill); switch block style to typo-code so it
  matches the rest of the app.
- Pre blocks: bleed -mx-3 like REST/SQL cells, add mb-4.
- Page layout: drop gap-6 in favor of mt-7 between header and cells,
  bump container py to 8.
- REST/SQL cell wrappers: replace mb-2 with mt-4 mb-4 for breathing room.
- Breadcrumb: show notebook name (with id fallback) by reusing the same
  React Query key as the page; works for both personal and community
  notebooks via the optional search.path.
- New editor at /notebooks/new and /notebooks/$id/edit reusing the
  view-mode REST/SQL/RPC cells with editable values plus a markdown
  cell with Edit/Preview tabs. Insert dividers ("+") around every
  cell, delete cell action overflows to the left.
- Toolbars (view + edit) match the resource editor: sticky strip with
  ghost-style buttons (Edit/Save in link color, others default,
  Share dropdown last).
- Run inside cells now saves cell.result back into the notebook and
  triggers a background save when the notebook has an id.
- Publish: view-mode action triggers aidbox.notebooks/publish-notebook
  on a fresh copy; updates happen automatically on Save when a
  notebook is already published.
- Unpublish: extra cleanup save afterwards so publication-id and
  edit-secret are cleared on the local notebook; auto-unpublish when
  deleting a published notebook.
- Upload: dropdown with "as link" (dialog + import-notebook RPC) and
  "as file" (parses the <data value=...> blob produced by Share→As file
  and posts import-notebook-as-json).
- Share-as-file now wraps the page section with mx-auto max-w-[990px]
  so the exported HTML matches the in-app layout.
- Breadcrumbs: edit route shows Notebooks / <name> / Edit by
  injecting a middle crumb that resolves the notebook name.
- Markdown rendering: tighten code-block detection (block when fenced
  with language OR multi-line), switch to typo-code, fix layout
  spacing between view and edit.
- EDN pretty printer in src/utils/edn.ts (clojure.pprint style) used
  for RPC responses with application/edn content type.
- ConfirmDialog primitive for Delete / Publish / Unpublish.
- List dedup: hide the community copy when its origin matches a local
  personal notebook.
@Panthevm Panthevm merged commit 611877e into master May 21, 2026
4 checks passed
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.

1 participant