Skip to content

refactor: extract @freed/ui — eliminate desktop→pwa coupling#7

Merged
AubreyF merged 1 commit intomainfrom
refactor/ui-component-architecture
Mar 3, 2026
Merged

refactor: extract @freed/ui — eliminate desktop→pwa coupling#7
AubreyF merged 1 commit intomainfrom
refactor/ui-component-architecture

Conversation

@AubreyF
Copy link
Copy Markdown
Contributor

@AubreyF AubreyF commented Mar 3, 2026

(AI Generated)

Summary

  • Introduces packages/ui as a new platform-agnostic React UI layer (@freed/ui), replacing the architectural violation where @freed/desktop imported components directly from @freed/pwa
  • Migrates 15 components out of @freed/pwa into @freed/ui (git detected them as renames, history preserved): PlatformContext, AppShell, Header, Sidebar, FeedView, FeedList, FeedItem, ReaderView, AddFeedDialog, SettingsPanel, BottomSheet, PullToRefresh, Toast
  • @freed/desktop now has zero dependency on @freed/pwa — both are independent leaf consumers of @freed/ui

Architecture before → after

Before:
  desktop → pwa (components/layout, components/feed, context)  ← violation
  pwa     → shared, sync

After:
  desktop → ui, shared                ← clean leaf
  pwa     → ui, shared, sync          ← clean leaf
  ui      → shared                    ← platform-agnostic layer
  shared  → (nothing)                 ← pure TS

What moved to @freed/ui

Layer Components
Context PlatformContext (DI backbone), usePlatform, useAppStore, PlatformConfig
Layout AppShell, Header, Sidebar
Feed FeedView, FeedList, FeedItem, ReaderView
Dialogs AddFeedDialog, SettingsPanel, BottomSheet
Primitives PullToRefresh, Toast

What stays in @freed/pwa

SyncIndicator, SyncConnectDialog, PwaFeedEmptyState, and all of lib/ — these are PWA-specific and couple to lib/sync, lib/store, and jsQR.

Key implementation details

  • @freed/ui ships raw .tsx source (no build step) — consumers' Vite pipelines compile and tree-shake it
  • Tailwind content paths in both pwa and desktop updated to include ../ui/src/**
  • __APP_VERSION__ Vite define is consumed from the enclosing app's build pipeline (declared in packages/ui/src/globals.d.ts)
  • AGENTS.md package boundary table updated with explicit rule: desktop must never import from @freed/pwa

Test plan

  • tsc --noEmit passes cleanly on packages/ui (verified: 0 errors)
  • tsc --noEmit on packages/desktop — only pre-existing @freed/sync error, no regressions
  • tsc --noEmit on packages/pwa — only pre-existing errors (sync + test unused import + store type mismatch), no regressions
  • PWA dev build starts and renders correctly
  • Desktop dev build starts and renders correctly
  • Sidebar, feed list, reader view, settings panel all function as before

Made with Cursor

Introduce packages/ui as the platform-agnostic React UI layer, replacing
the previous pattern where desktop imported UI components directly from
@freed/pwa (an architectural violation).

What moved to @freed/ui:
- PlatformContext (DI backbone for platform-specific injection)
- Layout: AppShell, Header, Sidebar
- Feed: FeedView, FeedList, FeedItem, ReaderView
- Dialogs/sheets: AddFeedDialog, SettingsPanel, BottomSheet
- Primitives: PullToRefresh, Toast

What stays in @freed/pwa:
- App.tsx, main.tsx (PWA entry + SW registration)
- SyncIndicator (uses pwa lib/sync + pwa store)
- SyncConnectDialog (uses jsQR + pwa lib/sync)
- PwaFeedEmptyState (PWA-specific empty state)
- lib/ (store, sync, capture, pwa-updater)

desktop now imports exclusively from @freed/ui — zero dependency on
@freed/pwa. Package boundary rules updated in AGENTS.md.

Tailwind content paths in both pwa and desktop updated to include
../ui/src/** so classes in @freed/ui source are processed correctly.

Made-with: Cursor
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 3, 2026

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

Project Deployment Actions Updated (UTC)
freed Building Building Preview, Comment Mar 3, 2026 2:03am
freed-pwa Building Building Preview, Comment Mar 3, 2026 2:03am

@AubreyF AubreyF merged commit 5624f7b into main Mar 3, 2026
5 checks passed
@AubreyF AubreyF deleted the refactor/ui-component-architecture branch March 3, 2026 02:15
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