refactor: extract @freed/ui — eliminate desktop→pwa coupling#7
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(AI Generated)
Summary
packages/uias a new platform-agnostic React UI layer (@freed/ui), replacing the architectural violation where@freed/desktopimported components directly from@freed/pwa@freed/pwainto@freed/ui(git detected them as renames, history preserved):PlatformContext,AppShell,Header,Sidebar,FeedView,FeedList,FeedItem,ReaderView,AddFeedDialog,SettingsPanel,BottomSheet,PullToRefresh,Toast@freed/desktopnow has zero dependency on@freed/pwa— both are independent leaf consumers of@freed/uiArchitecture before → after
What moved to
@freed/uiPlatformContext(DI backbone),usePlatform,useAppStore,PlatformConfigAppShell,Header,SidebarFeedView,FeedList,FeedItem,ReaderViewAddFeedDialog,SettingsPanel,BottomSheetPullToRefresh,ToastWhat stays in
@freed/pwaSyncIndicator,SyncConnectDialog,PwaFeedEmptyState, and all oflib/— these are PWA-specific and couple tolib/sync,lib/store, andjsQR.Key implementation details
@freed/uiships raw.tsxsource (no build step) — consumers' Vite pipelines compile and tree-shake itpwaanddesktopupdated to include../ui/src/**__APP_VERSION__Vite define is consumed from the enclosing app's build pipeline (declared inpackages/ui/src/globals.d.ts)AGENTS.mdpackage boundary table updated with explicit rule:desktopmust never import from@freed/pwaTest plan
tsc --noEmitpasses cleanly onpackages/ui(verified: 0 errors)tsc --noEmitonpackages/desktop— only pre-existing@freed/syncerror, no regressionstsc --noEmitonpackages/pwa— only pre-existing errors (sync + test unused import + store type mismatch), no regressionsMade with Cursor