Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/react-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: React app
on:
push:
paths: ['react-app/**', '.github/workflows/react-app.yml']
pull_request:
paths: ['react-app/**', '.github/workflows/react-app.yml']
jobs:
validate:
runs-on: ubuntu-latest
defaults:
run:
working-directory: react-app
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: react-app/package-lock.json
- run: npm ci
- run: npm run lint
- run: npm test
- run: npm run build
3 changes: 3 additions & 0 deletions react-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
*.tsbuildinfo
35 changes: 35 additions & 0 deletions react-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# React migration foundation

This standalone React 18 app leaves the Angular app and its PWA/deployment configuration unchanged.

## Run

Use Node.js 22.13+ (or 24) and npm:
```sh
cd react-app
npm ci
npm run dev
```

`npm run lint`, `npm test`, and `npm run build` validate the app.
`npm run preview` serves the production build locally.

## Module map / parallel ownership

- `src/models/index.ts`: shared interfaces, ItemType, FeedType, FEED_TYPES and Theme. The source's `User.crated_time` spelling is retained.
- `src/api/hackerNewsApi.ts`: promise API, optional AbortSignal, HTTP error rejection and awaited poll aggregation.
- `src/settings/`: SettingsProvider and useSettings. The hook returns `settings`, `toggleSettings`, `toggleOpenLinksInNewTab`, `setTheme`, `setFont`, and `setSpacing`.
- `src/styles/`: shared global themes/media variables and root layout.
- `src/utils/formatCommentCount.ts`: comment label formatter.
- `src/components/Loader/`, `src/components/ErrorMessage/`: shared ports (ErrorMessage accepts `message`).
- **Feeds owner:** `src/pages/FeedPage.tsx` receives `feedType: FeedType`, reads `:page`.
- **Item owner:** `src/pages/ItemDetailsPage.tsx` reads `:id`; future comments belong with this feature.
- **User owner:** `src/pages/UserPage.tsx` reads `:id`.
- **Shell/settings owner:** `src/components/Header/Header.tsx`, `Footer/Footer.tsx`, `Settings/Settings.tsx`.
- `src/App.tsx`: layout; `src/routes.tsx`: shared route table; `src/main.tsx`: router/provider composition.

Page and shell components are deliberately TODO placeholders; no API calls are wired to them yet.
Later owners should consume shared contracts rather than edit other owners' files.
Comment on lines +31 to +32

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Migration map understates item page progress

The map still calls every page a placeholder without API calls. ItemDetailsPage now fetches items, so the ownership guidance is stale.

Devin Review (Staging)


Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground


Settings retain the Angular localStorage keys. System theme changes continue to override and persist the theme, as in Angular. Public Theme uses `amoled`; the layout maps it to the existing `amoledblack` CSS class and accepts legacy saved `amoledblack` values.
Feed titles should apply `settings.titleFontSize + 'px'`, item containers `settings.listSpacing + 'px'`; external links use `target="_blank"` and `rel="noopener"` when `openLinkInNewTab` is true. These values are exposed, not applied globally.
11 changes: 11 additions & 0 deletions react-app/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import hooks from 'eslint-plugin-react-hooks';
import globals from 'globals';

export default tseslint.config(
{ ignores: ['dist/**'] },
js.configs.recommended,
...tseslint.configs.recommended,
{ files: ['**/*.{ts,tsx}'], languageOptions: { globals: globals.browser }, plugins: { 'react-hooks': hooks }, rules: hooks.configs.recommended.rules },
);
2 changes: 2 additions & 0 deletions react-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!doctype html>
<html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Hacker News</title></head><body><div id="root"></div><script type="module" src="/src/main.tsx"></script></body></html>
Loading
Loading