Skip to content

Inline block editor with Are.na sync (feature 1/3)#6

Draft
gndclouds wants to merge 1 commit into
mainfrom
cursor/inline-block-editor
Draft

Inline block editor with Are.na sync (feature 1/3)#6
gndclouds wants to merge 1 commit into
mainfrom
cursor/inline-block-editor

Conversation

@gndclouds
Copy link
Copy Markdown
Member

Summary

Adds a third Content tab on /sites/[id] that lets a site owner edit every Are.na block in their channel — title, description, and Text-block content — directly from the dashboard. Edits round-trip to Are.na via PUT /v3/blocks/{id} using the user's OAuth token, then queue a background rebuild so the static site reflects the change.

This is feature 1 of 3 from docs/features.md.

What changed

  • src/lib/arena.tsArenaClient.updateBlock(blockId, patch) and getBlock(blockId), both with the same rate-limit-aware retry as the rest of the client.
  • src/app/api/sites/[id]/blocks/route.tsGET: returns editable blocks for a site, sourced live from Are.na so the editor never shows stale build-cache state.
  • src/app/api/sites/[id]/blocks/[blockId]/route.tsPATCH: forwards title / description / content to Are.na, returns the canonical row, and queues a rebuild via after(() => buildSite(id)) (skippable with { rebuild: false }).
  • src/components/site-content-editor.tsx — client component: per-block draft state, save / discard buttons, inline error + "Saved · rebuild queued" feedback, refresh button.
  • src/app/sites/[id]/page.tsx — adds the Content segment to the existing tab control.

Scope of v1

  • Editable fields: title for all blocks; description for Image / Link / Media / Attachment; content for Text. Are.na's PUT /blocks/:id does not support image replacement or block reordering, so neither does this PR.
  • Authorization: Site ownership is checked locally; Are.na block ownership is enforced by Are.na (we surface 401 / 403 verbatim).
  • Conflict handling: none — last-write-wins for now. If a block changed on Are.na between fetch and save, the Are.na response replaces the row.

Test plan

  • Open the Content tab on an existing site; verify all blocks render with type label + preview.
  • Edit a Text block body, click Save → block updates on Are.na, row shows "Saved · rebuild queued", static site rebuilds.
  • Edit an Image block title and description → Are.na shows the change; image is untouched.
  • Edit a block you don't own on Are.na (e.g. collaborator channel) → editor surfaces the 401/403 error inline.
  • Click Refresh after editing on Are.na directly → the editor picks up the external change.

Open follow-ups (not in this PR)

  • Block reordering / image replacement.
  • Conflict detection ("this block changed on Are.na since you loaded the editor").
  • Debounced auto-save instead of explicit Save.
  • Markdown preview for Text blocks.

Made with Cursor

Adds a new "Content" tab on /sites/[id] that lists every block in the site's
Are.na channel and lets the owner edit title, description, and Text-block
content directly. Edits round-trip to Are.na via PUT /v3/blocks/{id} using the
user's OAuth token, then queue a background rebuild so the static site
reflects the change.

- src/lib/arena.ts: ArenaClient.updateBlock + getBlock with rate-limit retry
- src/app/api/sites/[id]/blocks/route.ts: GET editable blocks (live from Are.na)
- src/app/api/sites/[id]/blocks/[blockId]/route.ts: PATCH a single block and
  trigger rebuild
- src/components/site-content-editor.tsx: tab UI with per-block draft, save,
  discard, and inline error/success states
- src/app/sites/[id]/page.tsx: third "Content" segment in the existing tab
  control, renders SiteContentEditor

v1 scope: text-only edits. Image replacement and block reordering are not
covered. Are.na owns authorization on the block; we surface the 401/403 verbatim
when it rejects.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tiny-garden Ready Ready Preview, Comment May 11, 2026 8:20pm

Request Review

@gndclouds
Copy link
Copy Markdown
Member Author

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