Skip to content

Todo Panel — Read-only categories from JSON persistence #46

Closed

Description

@harrryyd

Parent

#44

What to build

Server-side persistence layer reading/writing ~/.t3code/todos.json plus a pure state machine. The web app loads categories from the server and renders them as colored, collapsible section headers.

State machine (todoStore): Pure functions operating on { categories: TodoCategory[], items: TodoItem[] }. At this slice: load from JSON, toggle category collapse (UI-only state, not persisted), reorder categories (in-memory, persisted later).

Persistence (todoPersistence): Reads ~/.t3code/todos.json on startup, writes via atomic write (write to temp file, rename over target). Returns the full state.

WebSocket: todo.load NativeApi method returns the current state to the client.

UI: Categories render as collapsible sections with the category color tinting the header background. Clicking a header toggles collapse/expand. Items are not yet supported — to verify visually, the persistence layer can seed initial data from the JSON file.

Acceptance criteria

  • todoStore module in packages/shared with loadTodos, toggleCategory (collapse), reorderCategories functions
  • todoPersistence in apps/server reads/writes ~/.t3code/todos.json atomically
  • todo.load WebSocket NativeApi method wired in apps/server/src/wsServer.ts
  • useTodos hook in apps/web loads state via WebSocket on mount
  • Categories render as colored, collapsible section headers in the sidebar
  • Category collapse state is not persisted (local UI state)
  • Unit tests for todoStore: basic load, toggle collapse, reorder categories
  • Integration test for todoPersistence: round-trip read/write, atomic write integrity
  • bun fmt, bun lint, bun typecheck all pass

Blocked by

Activity

  1. harrryyd commented on Jun 8, 2026

    @harrryyd
    OwnerAuthor

    Implemented and merged to main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions