Repository navigation
feat(react): port item details page with recursive collapsible comments #935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
eashansinha
wants to merge
6
commits into
react-migration/1794416868-trunk
Choose a base branch
from
devin/1794418013-react-item-details
base: react-migration/1794416868-trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bc0a50f
feat: add isolated React migration foundation
devin-ai-integration[bot] 118d5ef
fix: upgrade React router and test tooling security dependencies
devin-ai-integration[bot] 4cbdbfc
fix: preserve Angular theme storage compatibility
devin-ai-integration[bot] 0b0a272
feat: port React item details and recursive comments
devin-ai-integration[bot] b302fd1
fix: secure targets in item HTML links
devin-ai-integration[bot] 8176267
fix: reject invalid item details responses
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| 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 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| node_modules/ | ||
| dist/ | ||
| *.tsbuildinfo |
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
| 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. | ||
|
|
||
| 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. | ||
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
| 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 }, | ||
| ); |
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
| 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> |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Debug
Playground