Skip to content

chore(frontend): purge outdated files and code fragments#425

Merged
harbassan merged 3 commits into
masterfrom
chore/purge-codebase
Jun 16, 2026
Merged

chore(frontend): purge outdated files and code fragments#425
harbassan merged 3 commits into
masterfrom
chore/purge-codebase

Conversation

@harbassan

@harbassan harbassan commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Issue

The codebase is full of outdated files, which are components, contexts, style files or helpers. The scenario context also had some code only for compatibility reasons, which is no longer needed given that those parts of the codebase no longer exist due to previous changes.

Solution

Purge.

Risk

The risk lies in the ScenarioContext only, since that is where modifications were made regarding the compat changes. The rest are just deletions of files that are not used anywhere else, so completely safe.

Checklist

  • Acceptance criteria met
  • Wiki documentation is written and up to date
  • Unit tests written and passing
  • Integration tests written and passing
  • Continuous integration build passing

Summary by CodeRabbit

  • Refactor

    • Restructured application routing and scenario navigation architecture.
    • Reorganized core UI layout and component structure.
    • Simplified context management and state handling for scenario data.
  • Bug Fixes

    • Improved scenario selection and routing logic.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

App routing is restructured so /scenario/:scenarioId becomes a parent route with AuthoringToolPage (inside SceneContextProvider) as its index, replacing the old ScenePage wrapper. ScenarioContextProvider migrates from local-storage to useParams for scenario identity and drops legacy context fields. SceneContextProvider removes its ScenarioContext dependency. Dozens of unused components, pages, hooks, and stylesheets are deleted.

Changes

Route restructuring, context migration, and dead code removal

Layer / File(s) Summary
App route restructuring: ScenePage → AuthoringToolPage under scenario parent route
frontend/src/App.jsx
Removes ScenePage import, adds AuthoringToolPage, and replaces flat top-level scenario routes with a parent Route wrapping a nested Switch that renders AuthoringToolPage inside SceneContextProvider as the index, with ProtectedRoutes for manage-resources and manage-groups as children.
ScenarioContextProvider and SceneContextProvider migration to router params
frontend/src/context/ScenarioContextProvider.jsx, frontend/src/context/SceneContextProvider.jsx
ScenarioContextProvider replaces local-storage currentScenario with useParams scenarioId, rewires roleList/stateVariables fetches, updates the useEffect dependency to [scenarioId, user], and removes all legacy context fields (currentScenario, setCurrentScenario, refetch aliases, scenarios/accessScenarios/assignedScenarios). SceneContextProvider removes its ScenarioContext import and the useQuery block that called setCurrentScenario.
ScenarioInfo search state rename and UI simplification
frontend/src/features/scenarioInfo/ScenarioInfo.jsx
Renames searchTerm state to search, updates the filtering predicate, and replaces multi-element search container markup with a simplified label/input/search structure.
Deleted legacy components, pages, hooks, and styles
frontend/src/components/ContextMenu.jsx, frontend/src/components/DashedCard.jsx, frontend/src/components/DeleteButton.jsx, frontend/src/components/DeleteModal.jsx, frontend/src/components/GroupCard.jsx, frontend/src/components/ListContainer/ThumbnailList.jsx, frontend/src/components/ListContainer/ThumbnailList.module.scss, frontend/src/components/ListContainer/component.styles.js, frontend/src/components/ShareModal/ShareModal.jsx, frontend/src/components/ShareModal/ShareModal.module.scss, frontend/src/components/SideBar/SideBar.jsx, frontend/src/components/SideBar/SideBar.module.scss, frontend/src/components/TopBar/TopBar.jsx, frontend/src/components/CreateScenarioCard/CreateScenarioCard.module.scss, frontend/src/context/ToolbarContext.jsx, frontend/src/context/ToolbarContextProvider.jsx, frontend/src/features/authoring/components/BackModal/BackModal.jsx, frontend/src/features/authoring/components/BackModal/BackModal.module.scss, frontend/src/features/create/CreateLandingPage.css, frontend/src/features/create/components/HorizontalGradientLine.*, frontend/src/features/groups/TopBar.jsx, frontend/src/features/login/LoginPage/GoogleIcon.jsx, frontend/src/features/login/LoginPage/LoginPage.module.scss, frontend/src/features/play/PlayPage.jsx, frontend/src/features/play/components/HorizontalGradientLine.*, frontend/src/features/play/playPage.css, frontend/src/features/playScenario/components/HorizontalGradientLine.*, frontend/src/features/playScenario/modals/ResetConfirmationModal.jsx, frontend/src/features/scenarioInfo/components/GradientLine.jsx, frontend/src/features/scenarioSelection/ScenarioSelectionPage.jsx, frontend/src/features/sceneSelection/SceneSelectionPage.jsx, frontend/src/hooks/useScaledFontSize.jsx
Removes ScenarioSelectionPage, SceneSelectionPage/ScenePage, PlayPage, SideBar, TopBar (both shared and groups-scoped), BackModal, ShareModal, DeleteModal, DeleteButton, DashedCard, GroupCard, ThumbnailList, ContextMenu, ToolbarContext/ToolbarContextProvider, ResetConfirmationModal, GradientLine, multiple HorizontalGradientLine duplicates, GoogleIcon, useScaledFontSize, and associated SCSS/CSS modules.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • UoaWDCC/VPS#414: Also modifies frontend/src/App.jsx routing to remove a legacy play entrypoint and the PlayPage component, directly overlapping with this PR's deletion of PlayPage and its route cleanup.

Poem

🐰 Hop, hop — old pages gone!
The routes grew lean, the contexts strong,
useParams now holds the key,
No more local storage, hooray, we're free!
Deleted files drift like autumn leaves,
A cleaner warren, if you please! 🍂

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: removing outdated files and code fragments from the frontend codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The PR description follows the template structure with Issue, Solution, Risk, and Checklist sections clearly defined. All required sections are present and adequately filled out.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/purge-codebase

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@harbassan
harbassan force-pushed the chore/purge-codebase branch from 1d697fb to 8e7a4f8 Compare June 16, 2026 06:49
@harbassan
harbassan marked this pull request as ready for review June 16, 2026 09:55
@harbassan
harbassan requested a review from leowla June 16, 2026 09:57

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/App.jsx`:
- Around line 117-135: The plain Route wrapper on line 117 allows
ScenarioContextProvider to mount and execute scenario queries before
authentication is verified by child ProtectedRoute components, creating an auth
boundary weakness. Replace the plain Route element wrapping the scenarioId path
with a ProtectedRoute element instead, keeping the same
path="/scenario/:scenarioId" and moving ScenarioContextProvider inside it. This
ensures authentication is checked before any scenario context initialization or
API calls occur, securing the route boundary.
- Line 128: The ProtectedRoute component at the specified location is using the
index prop, which is a React Router v6 feature, but since ProtectedRoute spreads
props to an underlying v5 Route component via ...rest, the index prop is not
recognized by v5 and will be ineffective. Replace the index prop with exact to
properly enforce exact path matching for the /scenario/:scenarioId route in
React Router v5.

In `@frontend/src/context/ScenarioContextProvider.jsx`:
- Line 44: Remove the debug console.log(scenarioId) statement from the
ScenarioContextProvider render path. This statement is executed on every render
and route transition, causing excessive log spam. Delete the entire console.log
line to clean up the debug output and improve the provider's performance
monitoring.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: da6adfac-acb2-46eb-8165-22ea9beb18be

📥 Commits

Reviewing files that changed from the base of the PR and between 5688fb0 and f8746e3.

⛔ Files ignored due to path filters (1)
  • frontend/src/features/login/backgroundImg.jpg is excluded by !**/*.jpg
📒 Files selected for processing (39)
  • frontend/src/App.jsx
  • frontend/src/components/ContextMenu.jsx
  • frontend/src/components/CreateScenarioCard/CreateScenarioCard.module.scss
  • frontend/src/components/DashedCard.jsx
  • frontend/src/components/DeleteButton.jsx
  • frontend/src/components/DeleteModal.jsx
  • frontend/src/components/GroupCard.jsx
  • frontend/src/components/ListContainer/ThumbnailList.jsx
  • frontend/src/components/ListContainer/ThumbnailList.module.scss
  • frontend/src/components/ListContainer/component.styles.js
  • frontend/src/components/ShareModal/ShareModal.jsx
  • frontend/src/components/ShareModal/ShareModal.module.scss
  • frontend/src/components/SideBar/SideBar.jsx
  • frontend/src/components/SideBar/SideBar.module.scss
  • frontend/src/components/TopBar/TopBar.jsx
  • frontend/src/context/ScenarioContextProvider.jsx
  • frontend/src/context/SceneContextProvider.jsx
  • frontend/src/context/ToolbarContext.jsx
  • frontend/src/context/ToolbarContextProvider.jsx
  • frontend/src/features/authoring/components/BackModal/BackModal.jsx
  • frontend/src/features/authoring/components/BackModal/BackModal.module.scss
  • frontend/src/features/create/CreateLandingPage.css
  • frontend/src/features/create/components/HorizontalGradientLine.css
  • frontend/src/features/create/components/HorizontalGradientLine.jsx
  • frontend/src/features/groups/TopBar.jsx
  • frontend/src/features/login/LoginPage/GoogleIcon.jsx
  • frontend/src/features/login/LoginPage/LoginPage.module.scss
  • frontend/src/features/play/PlayPage.jsx
  • frontend/src/features/play/components/HorizontalGradientLine.css
  • frontend/src/features/play/components/HorizontalGradientLine.jsx
  • frontend/src/features/play/playPage.css
  • frontend/src/features/playScenario/components/HorizontalGradientLine.css
  • frontend/src/features/playScenario/components/HorizontalGradientLine.jsx
  • frontend/src/features/playScenario/modals/ResetConfirmationModal.jsx
  • frontend/src/features/scenarioInfo/ScenarioInfo.jsx
  • frontend/src/features/scenarioInfo/components/GradientLine.jsx
  • frontend/src/features/scenarioSelection/ScenarioSelectionPage.jsx
  • frontend/src/features/sceneSelection/SceneSelectionPage.jsx
  • frontend/src/hooks/useScaledFontSize.jsx
💤 Files with no reviewable changes (36)
  • frontend/src/features/create/components/HorizontalGradientLine.css
  • frontend/src/features/scenarioInfo/components/GradientLine.jsx
  • frontend/src/components/GroupCard.jsx
  • frontend/src/features/login/LoginPage/GoogleIcon.jsx
  • frontend/src/components/ListContainer/ThumbnailList.jsx
  • frontend/src/features/authoring/components/BackModal/BackModal.module.scss
  • frontend/src/features/play/PlayPage.jsx
  • frontend/src/features/create/components/HorizontalGradientLine.jsx
  • frontend/src/components/DeleteModal.jsx
  • frontend/src/components/ListContainer/component.styles.js
  • frontend/src/features/play/components/HorizontalGradientLine.jsx
  • frontend/src/components/DashedCard.jsx
  • frontend/src/features/playScenario/components/HorizontalGradientLine.css
  • frontend/src/features/sceneSelection/SceneSelectionPage.jsx
  • frontend/src/components/DeleteButton.jsx
  • frontend/src/components/ShareModal/ShareModal.jsx
  • frontend/src/components/ContextMenu.jsx
  • frontend/src/components/SideBar/SideBar.module.scss
  • frontend/src/hooks/useScaledFontSize.jsx
  • frontend/src/context/ToolbarContext.jsx
  • frontend/src/features/playScenario/components/HorizontalGradientLine.jsx
  • frontend/src/features/playScenario/modals/ResetConfirmationModal.jsx
  • frontend/src/features/play/components/HorizontalGradientLine.css
  • frontend/src/features/create/CreateLandingPage.css
  • frontend/src/context/ToolbarContextProvider.jsx
  • frontend/src/features/authoring/components/BackModal/BackModal.jsx
  • frontend/src/features/scenarioSelection/ScenarioSelectionPage.jsx
  • frontend/src/features/play/playPage.css
  • frontend/src/components/ShareModal/ShareModal.module.scss
  • frontend/src/context/SceneContextProvider.jsx
  • frontend/src/components/ListContainer/ThumbnailList.module.scss
  • frontend/src/components/CreateScenarioCard/CreateScenarioCard.module.scss
  • frontend/src/components/SideBar/SideBar.jsx
  • frontend/src/components/TopBar/TopBar.jsx
  • frontend/src/features/login/LoginPage/LoginPage.module.scss
  • frontend/src/features/groups/TopBar.jsx

Comment thread frontend/src/App.jsx Outdated
Comment thread frontend/src/App.jsx Outdated
Comment thread frontend/src/context/ScenarioContextProvider.jsx Outdated
@harbassan
harbassan force-pushed the chore/purge-codebase branch from f8746e3 to cce8603 Compare June 16, 2026 10:11

@leowla leowla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🧹🧼 LGTM! I'm skipping manual testing since this is cleanup with no functional changes.

frontend/src/hooks/useLocalStorage.jsx is also redundant now, can be deleted too.

@harbassan

Copy link
Copy Markdown
Contributor Author

frontend/src/hooks/useLocalStorage.jsx is also redundant now, can be deleted too.

Yep but that one seems generic enough as a hook to where I can see that being used in the future.

@harbassan
harbassan merged commit 8daa21b into master Jun 16, 2026
3 checks passed
@harbassan
harbassan deleted the chore/purge-codebase branch June 16, 2026 11:35
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