Skip to content

Refactor footer link pages to use slug-based routing and improve safety - #213

Open
dhruv-v07 wants to merge 2 commits into
masterfrom
dhruv_refactoring
Open

Refactor footer link pages to use slug-based routing and improve safety#213
dhruv-v07 wants to merge 2 commits into
masterfrom
dhruv_refactoring

Conversation

@dhruv-v07

Copy link
Copy Markdown

Changes:

  • Refactored 8 footer link pages to fetch by slug instead of hardcoded page IDs
  • Added proper error handling and 404 responses for missing pages
  • Added documentation comments to explain each page's purpose
  • Standardized code structure across all footer pages following page/[slug].jsx pattern
  • Improved safety with better null/undefined checks using strict equality

Pages refactored:

  • privacy.jsx
  • staff.jsx (preserved custom styles)
  • submit.jsx
  • editorial-board.jsx
  • records-requests.jsx
  • join-the-daily-bruin.jsx
  • the-daily-bruin-community-guide.jsx
  • daily-bruin-intern-descriptions.jsx
  • page/[slug].jsx

This follows the 4-step refactoring guide: made code readable, modular, safe, and documented.

Changes:
- Refactored 8 footer link pages to fetch by slug instead of hardcoded page IDs
- Added proper error handling and 404 responses for missing pages
- Added documentation comments to explain each page's purpose
- Standardized code structure across all footer pages following page/[slug].jsx pattern
- Improved safety with better null/undefined checks using strict equality

Pages refactored:
- privacy.jsx
- staff.jsx (preserved custom styles)
- submit.jsx
- editorial-board.jsx
- records-requests.jsx
- join-the-daily-bruin.jsx
- the-daily-bruin-community-guide.jsx
- daily-bruin-intern-descriptions.jsx
- page/[slug].jsx

This follows the 4-step refactoring guide: made code readable, modular, safe, and documented.

@NarekGermirlian NarekGermirlian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Delete all of the separate page files. They are unnecessary and can all be found through page/[slug].jsx. Make sure to redirect all footer links under components/MainSiteFooter/index.jsx to /page/[the_page_slug]

…[slug]

Removed unnecessary individual page files (privacy, staff, submit, editorial-board, records-requests, join-the-daily-bruin, the-daily-bruin-community-guide, daily-bruin-intern-descriptions) since they are all handled by page/[slug].jsx. Updated MainSiteFooter links to point to /page/[slug] accordingly.

Made-with: Cursor

@NarekGermirlian NarekGermirlian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good! Partially finished; do the same thing for the pages "about", "advertise" (with slug "ucla-advertising-and-marketing"), & "comment".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants