added home-new hidden page to start porting over content#118
added home-new hidden page to start porting over content#118jennnniferkuang wants to merge 8 commits into
Conversation
…-react into ts-migration
|
This change is part of the following stack: Change managed by git-spice. |
WalkthroughThis PR introduces new React component infrastructure by creating a Page component wrapper in a new components-new directory, adding a HomeNew route, and updating the import path in the main index file. TypeScript configuration is also extended with DOM library typings. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3cbb859 to
f90d0ee
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
src/routes-new/HomeNew.tsx (1)
1-9: Placeholder component looks fine for the initial setup.Since this is a TypeScript file, consider adding an explicit return type for consistency:
-const HomeNew = () => { +const HomeNew = (): JSX.Element => {This is optional but improves type safety as you build out the component.
src/components-new/Page.tsx (1)
3-5: Consider renaming the interface for clarity.
HomePagesuggests this is specific to the home page, but it's actually the props interface for the genericPagewrapper component. A clearer name would bePageProps:-interface HomePage { +interface PageProps { title: string; } -const Page: React.FC<HomePage> = ({ +const Page: React.FC<PageProps> = ({
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
src/components-new/Page.tsx(1 hunks)src/index.jsx(3 hunks)src/routes-new/HomeNew.tsx(1 hunks)tsconfig.json(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
src/routes-new/HomeNew.tsx (3)
src/components/DividerLine/DividerLine.jsx (1)
div(6-10)src/components/Page.jsx (1)
Helmet(5-14)src/components/HomeContent/HomeContent.jsx (1)
h1(6-16)
src/index.jsx (1)
src/components/Page.jsx (1)
Page(5-14)
src/components-new/Page.tsx (1)
src/components/Page.jsx (1)
Page(5-14)
🔇 Additional comments (2)
tsconfig.json (1)
5-6: LGTM!Adding
domanddom.iterableto the TypeScript lib configuration is appropriate for supporting the new TypeScript React components.src/index.jsx (1)
172-176: Route structure follows existing patterns.The new route is correctly structured. Once the
Pageimport issue above is resolved (using separate imports for old and new Page components), this will work as intended.
| return ( | ||
| <div> | ||
| <title>{`${title || ''} - Waterloo Rocketry`}</title> | ||
| {children} | ||
| </div> | ||
| ); |
There was a problem hiding this comment.
Critical: Raw <title> element won't set the document title.
A <title> element rendered inside a <div> in the React component tree does not update the browser's document title. It will just render as invisible text in the DOM body.
The original Page.jsx (see src/components/Page.jsx lines 4-13) correctly uses react-helmet to manage the document <head>. Port that approach:
-import React from 'react';
+import React from 'react';
+import { Helmet } from 'react-helmet';
interface HomePage {
title: string;
}
const Page: React.FC<HomePage> = ({
title,
children,
}) => {
return (
- <div>
- <title>{`${title || ''} - Waterloo Rocketry`}</title>
+ <>
+ <Helmet>
+ <title>{`${title || ''} - Waterloo Rocketry`}</title>
+ </Helmet>
{children}
- </div>
+ </>
);
};🤖 Prompt for AI Agents
In src/components-new/Page.tsx around lines 11 to 16, the code renders a raw
<title> inside a <div>, which does not set the browser document title; replace
this with react-helmet usage: import { Helmet } from 'react-helmet' at the top
of the file (or add it to existing imports), remove the raw <title> element from
the DOM, and wrap the title string in a <Helmet><title>{`${title || ''} -
Waterloo Rocketry`}</title></Helmet> placed alongside the children so the
document head is correctly updated.
|
|
||
| import Navigation from './components/Navigation/Navigation'; | ||
| import Page from './components/Page'; | ||
| import Page from './components-new/Page'; |
There was a problem hiding this comment.
Critical: This import change breaks document title for all existing routes.
Replacing the Page import affects every existing route (Home, Competition, Join, Rockets, etc.), not just the new home-new route. The original Page.jsx uses react-helmet to properly set the document <title>, while the new Page.tsx renders a raw <title> element inside a <div>, which won't update the document title correctly.
To avoid breaking existing pages, keep the original import and use a different name for the new component:
-import Page from './components-new/Page';
+import Page from './components/Page';
+import PageNew from './components-new/Page';Then use PageNew only for the new route at lines 172-176.
🤖 Prompt for AI Agents
In src/index.jsx around line 8 and lines 172-176, the import of the new Page
component replaced the original Page and breaks document titles; restore the
original Page import (keep the existing Page.jsx import) and import the new
component under a distinct name (e.g., PageNew) so you don't override the
original, then update only the new route (lines 172-176) to reference PageNew
while leaving all other routes using the original Page.
This change is
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.