Skip to content

Split dashboard page.tsx into hooks + consolidate source config#24

Merged
teallarson merged 5 commits intomainfrom
teallarson/split-ui-components
Mar 10, 2026
Merged

Split dashboard page.tsx into hooks + consolidate source config#24
teallarson merged 5 commits intomainfrom
teallarson/split-ui-components

Conversation

@teallarson
Copy link
Collaborator

Summary

  • Extract 3 custom hooks (use-arcade-connection, use-source-check, use-plan-stream) from the 585-line app/dashboard/page.tsx, reducing it to ~350 lines of orchestration + JSX
  • Create lib/sources.ts as a single source of truth for all source config (icon, label, color, tool-name pattern per integration) — adding a new source is now a one-line change
  • Remove KNOWN_SERVICE regex gate from the plan route so tools from any service (Notion, Jira, etc.) pass through to the LLM, not just the 5 hardcoded ones
  • Open ItemSource type to accept any string while preserving autocomplete for known values
  • Deduplicate ConfigWarning into types/dashboard.ts (was defined in both page.tsx and health/route.ts)

Files

New:

  • types/dashboard.tsConfigWarning, ArcadeStatus, SourceCheckPhase
  • lib/sources.ts — source registry with getSource() + mapToolToSource()
  • hooks/use-arcade-connection.ts — Arcade OAuth connection state machine
  • hooks/use-source-check.ts — pre-flight source auth checking
  • hooks/use-plan-stream.ts — SSE plan streaming

Modified: page.tsx, task-card.tsx, stats-bar.tsx, source-auth-gate.tsx, types/inbox.ts, health/route.ts, map-tool-to-source.hbs, plan-route-body.hbs

Test plan

  • npm run build && npm run lint && npm run format:check passes
  • node dist/index.js test-proj --template ai-sdk && cd test-proj && bun run build succeeds
  • node dist/index.js test-proj --template mastra && cd test-proj && bun run build compiles cleanly

🤖 Generated with Claude Code

teallarson and others added 2 commits March 9, 2026 15:16
- Extract 3 custom hooks (use-arcade-connection, use-source-check,
  use-plan-stream) from the 585-line page.tsx, reducing it to ~350 lines
- Add lib/sources.ts as single source of truth for source config
  (icon, label, color, tool-name pattern per source); adding a new
  integration is now a one-line change
- Remove KNOWN_SERVICE regex gate from plan route so tools from any
  service pass through to the LLM (not just the 5 hardcoded ones)
- Open ItemSource type to accept any string while preserving autocomplete
- Deduplicate ConfigWarning type into types/dashboard.ts
- Update task-card, stats-bar, source-auth-gate to import from lib/sources

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ation

- useArcadeConnection: internalize useRouter, extract shared checkConnection
- useSourceCheck: replace raw setter exports with action functions
- usePlanStream: callback-based approach instead of cross-hook setters
- page.tsx: wire callbacks, add useMemo/useCallback, add startPlan wrapper
- header.tsx: replace useState+useEffect hydration guard with useSyncExternalStore
- eslint.config: ignore test-proj in root lint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teallarson teallarson force-pushed the teallarson/split-ui-components branch from a53119a to dd1a13b Compare March 9, 2026 19:17
teallarson and others added 2 commits March 10, 2026 09:53
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teallarson teallarson marked this pull request as ready for review March 10, 2026 14:49
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@teallarson teallarson merged commit ce9a4ac into main Mar 10, 2026
@teallarson teallarson deleted the teallarson/split-ui-components branch March 10, 2026 14:52
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