Skip to content

Conversation

anettkva
Copy link
Member

@anettkva anettkva commented Nov 5, 2026 •

Move the pages to src/pages/, and the frontend tests to src/tests/

Closes #97

The pages were in src/components/, next to the components they use, so it was hard to see which files are routes and which are parts of pages. Now every route in App.tsx has one file in src/pages/, and src/components/ only holds the parts of the pages.

What moved

Page From To
Elements src/components/elements/ElementsPage.tsx src/pages/ElementsPage.tsx
Element src/components/elements/ElementDetailPage.tsx src/pages/ElementDetailPage.tsx
Your gymnasts src/components/gymnasts/YourGymnastsPage.tsx src/pages/YourGymnastsPage.tsx
Log in src/components/auth/LoginPage.tsx src/pages/LoginPage.tsx
Calculator, About, Not found inline in src/App.tsx src/pages/CalculatorPage.tsx, AboutPage.tsx, NotFoundPage.tsx

The files were moved with git mv, so their history follows them (git log --follow). Their content is unchanged, apart from one import in LoginPage.tsx (shared/demo, one folder less). The components the pages use stay in src/components/elements/, gymnasts/ and auth/.

Also in this PR: the frontend tests in src/tests/

This was not part of the issue, but it fits with it: the issue makes src/pages/ and src/components/ show what the app is made of, and the tests next to the code made those folders harder to read in the same way.

  • All 29 frontend tests moved with git mv into src/tests/, in the same folders as the code they test (src/tests/pages/, src/tests/components/elements/, src/tests/lib/apollo/ ...). src/tests/ already had the shared test helpers (setupTests.ts, apollo.ts, elementRows.ts).
  • They import what they test with the @/ alias instead of relative paths, so a test does not depend on where it is.
  • The backend tests stay next to their code in backend/src/. The backend is its own package with Node's relative imports and small folders, where that is the usual layout. The README explains the difference in a new section, "Where the tests are".

Other changes

  • src/App.tsx: imports every page from @/pages/…, and no longer defines the placeholder pages itself.
  • gymnastTheme.test.ts: this test reads the files of the gymnasts and login pages by folder. After the move it would have stopped checking the two pages without failing, so they are now listed explicitly, and the test checks that both are included. Its paths also start from its new place in src/tests/styles/.
  • README: the "Project structure" table describes src/pages/ (one file per route), src/components/ (parts of pages), src/components/ui/ (the shadcn/ui components and a few small shared components), src/lib/, src/tests/ and backend/src/. The new section "Where the tests are" says where the frontend, backend and end-to-end tests are, and why. The links to the moved files are updated in the README, docs/ACCESSIBILITY.md, docs/AUTHENTICATION.md and docs/SUSTAINABILITY.md.
  • docs/AI_USAGE.md: a new entry.

Not in this PR

The issue suggests moving our own components out of src/components/ui/ (DifficultyBadge, ElementValueBadge, ElementVariants), so that folder only holds shadcn/ui components. That can be a separate PR.

Testing

  • tsc -b, ESLint and npm run build pass.
  • The same 312 frontend tests pass as before the move, now from src/tests/, and no frontend test is left outside it. No backend files are changed.
  • Every link in the README and the docs points to a file that exists.
  • Prettier: one moved test got an import line that was too long, and it is fixed. The files that already failed Prettier before (among them App.tsx and YourGymnastsPage.tsx) are left as they are, so the PR only moves files and does not reformat them.

🤖 Generated with Claude Code

- Move the Elements page, the element page, Your gymnasts and the login page
  with their tests from src/components/ to src/pages/ (git mv)
- Move the Calculator, About and not-found placeholders out of App.tsx
- Import the pages from @/pages in App.tsx
- Keep the page theme test checking the two moved pages
- Describe src/pages, src/components, src/components/ui and src/lib in the
  README, and update the links in the docs

Closes #97

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anettkva anettkva requested a review from a team as a code owner November 5, 2026 11:51
Anettkva and others added 2 commits November 5, 2026 13:11
- Move all 29 frontend tests with git mv into src/tests/, in the same
  folders as the code they test
- Import what they test with the @/ alias instead of relative paths
- Read the theme files from the new place in gymnastTheme.test.ts
- Describe src/tests in the README, and update the links to the tests

Part of #97

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy link
Member

Choose a reason for hiding this comment

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

not a priority? can be there but noting it for the record

Copy link
Member

Choose a reason for hiding this comment

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

should not be done in this issue, but makes sense so ill let i tbe

@@ -231,6 +235,7 @@ describe('the components of the gymnasts and login pages', () => {

it('looks at the components of both pages and not at their tests', () => {
expect(files.some((f) => f.endsWith('GymnastRow.tsx'))).toBe(true)
expect(files.some((f) => f.endsWith('YourGymnastsPage.tsx'))).toBe(true)
Copy link
Member

Choose a reason for hiding this comment

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

make sure you intended to make this change as this is a code change

@ronjalh
Copy link
Member

ronjalh commented Nov 5, 2026

maybe write a comment in AI usage about the old file paths and reasoning for changing so it is documented what we had first and what we now have

Copy link
Member

@xeniag xeniag left a comment

Choose a reason for hiding this comment

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

Found no errors and the page works fine

@xeniag xeniag merged commit 3110903 into dev Nov 5, 2026
@ronjalh ronjalh deleted the 97-move-the-pages-to-srcpages branch November 5, 2026 12:34
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants