Skip to content

Phase 8: PWA & Final Polish#316

Open
vibhaseshadri-cognition wants to merge 8 commits into
masterfrom
devin-06.09.2026-vibha/react-migration-phase8
Open

Phase 8: PWA & Final Polish#316
vibhaseshadri-cognition wants to merge 8 commits into
masterfrom
devin-06.09.2026-vibha/react-migration-phase8

Conversation

@vibhaseshadri-cognition

@vibhaseshadri-cognition vibhaseshadri-cognition commented Jun 9, 2026

Copy link
Copy Markdown

Summary

Adds PWA support via vite-plugin-pwa and final production build verification.

Changes:

  • vite.config.ts: Added VitePWA({ registerType: 'autoUpdate' }) with manifest config (icons, theme color, display standalone) and workbox runtimeCaching for HN API (NetworkFirst strategy, 5min TTL)
  • Removed public/manifest.json — now generated by the plugin at build time
  • npm run build produces: sw.js, workbox-*.js, registerSW.js, 9 precache entries

This completes the Angular 9 → React 18 migration. All 8 phases:

  1. Foundation (Phase 1: React 18 + Vite + TypeScript Foundation #309)
  2. Services & State (Phase 2: Services, Settings Context & Shared Utilities #310)
  3. Layout (Phase 3: Layout Components (Header, Footer, Settings Panel) #311)
  4. Feed Feature (Phase 4: Feed Feature (FeedPage + ItemRow) #312)
  5. Item Details & Comments (Phase 5: Item Details & Recursive Comments #313)
  6. User Profile (Phase 6: User Profile Page #314)
  7. Router Integration (Phase 7: Router & App Shell Integration #315)
  8. PWA (this PR)

Depends on Phase 7 (#315).

Link to Devin session: https://app.devin.ai/sessions/0bb1dd94ecbc4422a76b7a458d0f4e7c
Requested by: @vibhaseshadri-cognition


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

devin-ai-integration Bot and others added 8 commits June 9, 2026 16:57
- Replace Angular build config with Vite + React 18 setup
- Create vite.config.ts, tsconfig.json, package.json with React deps
- Add entry points: src/main.tsx, src/App.tsx, index.html
- Port SCSS theming files (_themes.scss, _theme_variables.scss, _media.scss)
- Define TypeScript interfaces in src/types/ (Story, Comment, User, Settings, PollResult, FeedType)
- Move static assets to public/ directory for Vite serving
- Remove Angular-specific files: angular.json, tsconfig.app/spec.json, tslint.json, karma.conf.js, ngsw-config.json, browserslist, polyfills.ts, test.ts, all *.module.ts files
- Remove Angular dependencies, add react, react-dom, react-router-dom v6
- Verify npm run dev starts and app shell renders

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- Add src/services/hackernews-api.ts: fetchFeed, fetchItemContent (with poll sub-fetching via Promise.all), fetchPollContent, fetchUser using plain fetch
- Add src/contexts/SettingsContext.tsx: React Context + useReducer for Settings state, localStorage persistence, system dark mode detection with matchMedia listener
- Add src/components/shared/Loader.tsx + SCSS: CSS loading animation ported from Angular
- Add src/components/shared/ErrorMessage.tsx + SCSS: skull error display ported from Angular
- Add src/utils/formatComment.ts: replaces Angular CommentPipe (0→'discuss', 1→'1 comment', n→'n comments')
- Update tsconfig.json include paths for new directories

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- Add Header with NavLink navigation, logo, settings toggle, scrollTo(0,0) on nav clicks
- Add Footer with static content matching Angular template
- Add Settings panel with theme radios, open-in-new-tab checkbox, font size and list spacing inputs
- All components consume SettingsContext
- Port all SCSS styles from Angular components

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- FeedPage: paginated feed with loader/error states, 30 items/page, prev/more navigation
- ItemRow: story row with external/internal link logic, domain, points, user, time_ago, comment count
- Respects settings: titleFontSize, listSpacing, openLinkInNewTab
- Mobile/laptop responsive layouts via subtext-palm/subtext-laptop
- Jobs feed special header text
- SCSS ported from Angular feed and item components

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- ItemDetailsPage: fetches item by ID, back button via useNavigate(-1), poll results with percentage bars, dangerouslySetInnerHTML for content, mobile/laptop responsive layouts
- Comment: recursive rendering of nested comments, collapse/expand toggle, deleted comment display
- SCSS ported from Angular item-details and comment components

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- UserPage: fetches user by ID, back button via useNavigate(-1), profile display with username, karma, created date, about (dangerouslySetInnerHTML)
- Mobile/laptop responsive layout ported from Angular
- Loader/ErrorMessage for loading/error states

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- Wire up react-router-dom v6 Routes in App.tsx
- / redirects to /news/1
- /news/:page, /newest/:page, /show/:page, /ask/:page, /jobs/:page → FeedPage with feedType prop
- /item/:id → ItemDetailsPage, /user/:id → UserPage
- Theme class on root div from SettingsContext (dynamic: default/night/amoledblack)
- SettingsProvider wraps entire app
- GA tracking via useLocation hook on route changes
- Header + Routes (Outlet equivalent) + Footer layout

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
- Add vite-plugin-pwa for service worker generation with autoUpdate
- Configure manifest with app icons, theme color, display standalone
- Add workbox runtimeCaching for HN API (NetworkFirst strategy)
- Remove static public/manifest.json (now generated by vite-plugin-pwa)
- Production build verified: sw.js + workbox generated, 9 precache entries

Co-Authored-By: Vibha  Seshadri <vibha.seshadri@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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