Skip to content

feat(webclaw): add table block workbench with csv + prompt insertion#36

Open
austinlaw076 wants to merge 1 commit intoibelick:mainfrom
austinlaw076:feature/table-block
Open

feat(webclaw): add table block workbench with csv + prompt insertion#36
austinlaw076 wants to merge 1 commit intoibelick:mainfrom
austinlaw076:feature/table-block

Conversation

@austinlaw076
Copy link

Summary

This PR adds a new Table Block workbench feature in WebClaw chat, with inline editing and prompt integration, while preserving existing send/history/stream behavior.

What’s included

  • New block type: table (columns + rows)
  • Inline editable table UI:
    • Header rename
    • Cell click-to-edit
    • Enter to commit
    • Tab / Shift+Tab navigation across editable targets
  • Table operations:
    • Add/remove row
    • Add/remove column (guard: cannot remove last column)
  • Actions per block:
    • Copy Markdown
    • Insert to Prompt
    • CSV import/export:
      • Paste CSV + apply import
      • Copy CSV
      • Download CSV
  • Per-session persistence via Zustand persist (localStorage)

Technical Notes

  • Followed existing architecture and UI primitives:
    • React + Tailwind + existing Button/layout patterns
    • Zustand persistent store
    • Existing composer flow reused for prompt insertion (appendToPrompt)
  • No protocol changes:
    • No changes to Gateway WS/RPC stream contract
    • Existing chat send/history/stream flow remains intact
  • Added a dedicated dev route for browser E2E verification:
    • /dev/table-block

Files Changed

  • apps/webclaw/src/screens/chat/chat-screen.tsx
  • apps/webclaw/src/screens/chat/components/chat-composer.tsx
  • apps/webclaw/src/screens/chat/hooks/use-chat-measurements.ts
  • apps/webclaw/src/screens/chat/components/chat-workbench.tsx (new)
  • apps/webclaw/src/screens/chat/components/table-block.tsx (new)
  • apps/webclaw/src/screens/chat/hooks/use-table-workbench-blocks.ts (new)
  • apps/webclaw/src/screens/chat/table-block-utils.ts (new)
  • apps/webclaw/src/screens/chat/table-block-state-utils.ts (new)
  • apps/webclaw/src/routes/dev.table-block.tsx (new)
  • apps/webclaw/e2e/table-block.spec.ts (new)
  • apps/webclaw/playwright.config.ts (new)
  • apps/webclaw/vitest.config.ts (new)
  • apps/webclaw/src/screens/chat/table-block-utils.test.ts (new)
  • apps/webclaw/src/screens/chat/table-block-state-utils.test.ts (new)
  • apps/webclaw/package.json
  • apps/webclaw/src/routeTree.gen.ts
  • pnpm-lock.yaml

Validation / Test Evidence

  • Unit tests:
    • pnpm -C apps/webclaw test
    • Result: 3 files, 12 tests passed
  • Browser E2E (Playwright):
    • pnpm -C apps/webclaw test:e2e
    • Result: 1 passed
    • Coverage:
      • Add table block
      • Cell edit + commit
      • CSV import
      • Insert to prompt
      • Refresh persistence check
  • Build:
    • pnpm -C apps/webclaw build
    • Result: passed

DoD Mapping

  • 10x10 edit smoothness: lightweight inline editor with keyboard navigation implemented (MVP scope)
  • Markdown serialization correctness: covered by unit tests (table-block-utils.test.ts)
  • Persistence after refresh: verified in Playwright E2E

Edge Cases Handled

  • Empty/invalid CSV import -> user-visible error
  • Trailing empty CSV lines tolerated
  • Quoted CSV fields, commas, newlines, escaped quotes supported
  • Prevent removing the final remaining column
  • Empty rows state renders safely with guidance text

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