CivicDataLab / CivicDataLab/IDS-DRR-Frontend
Use canonical Next.js layout
Open
Nobody has claimed this yet.
maintenance
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 1
Description
We should defer this work at least until development reaches a quiet period. Just logging as something I noticed.
This makes the repo more predictable for developers.
- Keep the route groups clear of non-routable files where possible (other than components).
- Move ./app/[locale]/[state]/analytics/utils/utils.ts into lib/analytics.ts (added in #362)
- Co-locate components used by only one route group.
- Move (and rename as kebab-case) from top-level components/ into app/[locale]/[state]/analytics/components:
- FactorIcons.tsx
- InfoCircle.tsx (only used by output-window)
- MobileFilterBox.tsx (only used by filter-component)
- MapChart/ (only used by map-component)
- Move (and rename as kebab-case) from top-level components/ into app/[locale]/[state]/analytics/components:
- Consistently use kebab-case for filenames (sometimes PascalCase is used)
- Rename files:
- app/[locale]/datasets/components/{DatasetCards,BreadCrumbs,GraphqlPagination,Filter}.tsx
- app/[locale]/[state]/analytics/components/RadioButton.*
- tests/RadioButton.test.tsx
- lib/serverUtils.ts
- Rename directory:
- langSelect/
- Avoid nested index.tsx:
- Details/index.tsx to details.tsx
- Metadata/index.tsx to metadata.tsx
- PrimaryData/index.tsx to primary-data.tsx
- Resources/index.tsx to resources.tsx
- Rename files:
- Ideally, rename components/ directories under app/ with an underscore as _components/ https://nextjs.org/docs/app/getting-started/project-structure#route-groups-and-private-folders
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the listed paths under app/[locale]/[state]/analytics, app/[locale]/datasets, components/, langSelect/, and lib/serverUtils.ts, along with tests/RadioButton.test.tsx. Check the Next.js route-groups and private-folders guidance linked in the issue, then verify that the requested moves and kebab-case renames preserve imports and the test suite passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, typescript
- Domain
- frontend, web-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100