Skip to content

fix: remove unused code#1127

Merged
CK-7vn merged 1 commit into
CK-7vn/total-refactorfrom
CK-7vn/deadcode
May 13, 2026
Merged

fix: remove unused code#1127
CK-7vn merged 1 commit into
CK-7vn/total-refactorfrom
CK-7vn/deadcode

Conversation

@CK-7vn
Copy link
Copy Markdown
Member

@CK-7vn CK-7vn commented May 12, 2026

Pre-Submission PR Checklist

  • No debug/console/fmt.Println statements
  • Unnecessary development comments removed
  • All acceptance criteria verified
  • Functions according to ticket spexifications
  • Tested manually where applicable
  • Branch rebased with latest main
  • No business logic exists within the database layer

Description of the change

PR implements a ton of deadcode removal. During the refactor a lot of old features that either don't have maximum utility at the moment and or are outdated were decided to be paused, or removed. This lead to a lot of no routes, no imports, or code that depended on provider integrations.

Carolina also asked that we remove learning path code, my courses, my progress, and the resident Programs page bug was fixed, so that it now will at least display the residents current programs.

Also worth noting, I did manually go through and test everything with dept, facility, and resident scoped users, everything seems to work as expected, but, just make sure to test thoroughly. Worst case scenario we pull back in a file from an earlier commit, just don't want to miss anything.

Pages

frontend/src/pages/student/StudentDashboard.tsx

The old "Learning Path" page for residents, which depended on 'ProviderAccess' feature flag and displayed provider-integrated course content.

frontend/src/pages/learning/MyCourses.tsx

"My Courses" page, listed enrolled courses from provider integrations, provider integrations were not ported so, essentially no need for this anymore.

frontend/src/pages/learning/MyProgress.tsx

Showed learning progress across provider platforms, same reason, provider platforms weren't ported, no need for this currently.

frontend/src/pages/learning/CourseCatalog.tsx

Another provider platform reliant page

frontend/src/pages/insights/LearningInsights.tsx

Admin analytics page fro learning/provider activity, once again, no provider integration, no need for this currently.

frontend/src/pages/admin/ProviderPlatformManagement.tsx

Admin page for managing kolibri/Canvas/Brightspace provider platform connections. Provider management intentionally excluded in redesign, so removed.

frontend/src/pages/admin/ProviderUserManagemetn.tsx

Admin page for managing users on external provider platforms. Same reason as ProviderPlatformManagement. No route, no imports.

frontend/src/pages/TakeAttendance.tsx

Old standalone attendance page. Replaced entirely by the EventAttendance system (class-based event attendance with date params). The new router uses program-classes/:class_id/events/:event_id/attendance/ — no route pointing to the old page, no imports.

frontend/src/pages/Welcome.tsx

Deprecated onboarding/welcome page. No route in the new router, zero references anywhere in the codebase.

frontend/src/pages/insights/KnowledgeInsights.tsx

Insights for knowledge center activity, intentionally not included, so removed

Components

frontend/src/components/student/CatalogCourseCard.tsx

Only ever imported by CourseCatalog.tsx which was deleted

frontend/src/components/student/EnrolledCourseCard.tsx

Card component for an enrolled provider course, only 2 pages that imported this component were deleted, so removed it.

frontend/src/components/dashboard/WeeklyActivity.tsx

Only ever imported by studentDashboard.tsx which was deleted, so removed

hooks

frontend/src/hooks/useCheckResponse.tsx

No callers anywhere in the codebase, verified with ast-grep across all import patterns including dynamic imports, type imports, and re-exports. So removed.

Routes

frontend/src/routes/provider-routes.tsx

Entire provider/learning route file, all provider routes, no use for it anymore

Modified Files

frontend/src/routes/index.tsx
Removed ProviderPlatformRoutes import and its entry in the router array. Required after deleting provider-routes.tsx — the import would have crashed the app.

frontend/src/auth/useAuth.ts
Removed the ProviderAccess branch from getResidentLink(). The old logic redirected residents with ProviderAccess to /learning-path. That page is deleted; the feature flag no longer maps to any route. Residents now route to /home (OpenContent), /resident-programs (ProgramAccess), or /temp-home (neither).

frontend/src/layouts/AuthenticatedLayout.tsx
Removed /learning-path, /my-courses, /my-progress from the isResidentPage array used for layout/padding logic. Those routes no longer exist.

frontend/src/components/navigation/Sidebar.tsx
Four removals:

  1. Unused icon imports: LightBulbIcon, GlobeAltIcon, BookmarkIcon, TrophyIcon, RocketLaunchIcon (only referenced by deleted nav items)
  2. const hasProvider = hasFeature(user, FeatureAccess.ProviderAccess) variable (no longer used)
  3. The {hasProvider && <> ... </>} block containing Learning Path, My Courses, My Progress nav links
  4. The "Connected Learning" CollapsibleSection in AdminNav (contained learning-insights and learning-platforms links)
  5. Fixed: !hasProvider && !hasProgram!hasProgram in the temp-home fallback condition (removing the now-undefined hasProvider reference)

frontend/src/pages/learning/ResidentOverview.tsx (bug fix, not removal)
Fixed a React Rules of Hooks violation. Two useMemo calls and two useSWR calls were placed after an early if (!user) return null guard, which is illegal — hooks must not be called conditionally. Moved all four hooks above the early return and added null-conditional SWR keys (user ? \/api/users/${user.id}/...` : null`) so they no-op safely when user is undefined.

Verification Method

All deletions were verified with ast-grep structural pattern matching before removal. The final pass covered 10 search patterns per file:

  1. Named imports: import { $X } from '$PATH'
  2. Default imports: import $X from '$PATH'
  3. Dynamic imports: import('$PATH')
  4. Type imports: import type { $X } from '$PATH'
  5. Re-exports: export { $X } from '$PATH'
  6. TSX usage: <$Component
  7. Router <Link to="$ROUTE"> references
  8. navigate('$ROUTE') call sites
  9. window.location assignments to the route
  10. Variable assignments referencing the component/function

@CK-7vn CK-7vn requested a review from a team as a code owner May 12, 2026 19:51
@CK-7vn CK-7vn requested review from corypride and removed request for a team May 12, 2026 19:51
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c61ce86c-41ba-4b7c-8b28-cf7564eb7b35

📥 Commits

Reviewing files that changed from the base of the PR and between 6ffd0cd and 98b14d9.

📒 Files selected for processing (20)
  • frontend/src/auth/useAuth.ts
  • frontend/src/components/dashboard/WeeklyActivity.tsx
  • frontend/src/components/navigation/Sidebar.tsx
  • frontend/src/components/student/CatalogCourseCard.tsx
  • frontend/src/components/student/EnrolledCourseCard.tsx
  • frontend/src/hooks/useCheckResponse.ts
  • frontend/src/layouts/AuthenticatedLayout.tsx
  • frontend/src/pages/TakeAttendance.tsx
  • frontend/src/pages/Welcome.tsx
  • frontend/src/pages/admin/ProviderPlatformManagement.tsx
  • frontend/src/pages/admin/ProviderUserManagement.tsx
  • frontend/src/pages/insights/KnowledgeInsights.tsx
  • frontend/src/pages/insights/LearningInsights.tsx
  • frontend/src/pages/learning/CourseCatalog.tsx
  • frontend/src/pages/learning/MyCourses.tsx
  • frontend/src/pages/learning/MyProgress.tsx
  • frontend/src/pages/learning/ResidentOverview.tsx
  • frontend/src/pages/student/StudentDashboard.tsx
  • frontend/src/routes/index.tsx
  • frontend/src/routes/provider-routes.tsx
💤 Files with no reviewable changes (18)
  • frontend/src/hooks/useCheckResponse.ts
  • frontend/src/pages/admin/ProviderPlatformManagement.tsx
  • frontend/src/auth/useAuth.ts
  • frontend/src/pages/Welcome.tsx
  • frontend/src/components/dashboard/WeeklyActivity.tsx
  • frontend/src/pages/learning/MyCourses.tsx
  • frontend/src/pages/admin/ProviderUserManagement.tsx
  • frontend/src/pages/learning/MyProgress.tsx
  • frontend/src/pages/TakeAttendance.tsx
  • frontend/src/pages/learning/CourseCatalog.tsx
  • frontend/src/pages/insights/LearningInsights.tsx
  • frontend/src/pages/insights/KnowledgeInsights.tsx
  • frontend/src/components/student/CatalogCourseCard.tsx
  • frontend/src/routes/provider-routes.tsx
  • frontend/src/components/navigation/Sidebar.tsx
  • frontend/src/pages/student/StudentDashboard.tsx
  • frontend/src/components/student/EnrolledCourseCard.tsx
  • frontend/src/routes/index.tsx

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Removed provider-based learning features including course catalogs, learning paths, and course progress tracking
    • Simplified navigation by eliminating provider-related menu sections
    • Updated routing to prioritize knowledge center and program-based access pathways
    • Streamlined authenticated user experience by refocusing resident page routing

Walkthrough

This PR removes provider platform and provider-based learning features from the frontend, replacing provider route registration with knowledge center routes. The change simplifies resident routing to only check OpenContentAccess and ProgramAccess flags, removes all provider administration UIs and student learning path pages, and updates sidebar navigation and layout conditions to reflect the narrower feature set.

Changes

Feature Access Routing Simplification

Layer / File(s) Summary
Resident routing and feature flag logic
frontend/src/auth/useAuth.ts
getResidentLink removes the ProviderAccess/learning-path branch, leaving only OpenContentAccess/home, ProgramAccess/resident-programs, and /temp-home fallback.

Route Configuration and Navigation Updates

Layer / File(s) Summary
Route group registration
frontend/src/routes/index.tsx
Imports and registers KnowledgeCenterRoutes and KnowledgeCenterAdminRoutes from ./knowledge-routes, replacing the removed ProviderPlatformRoutes.
Sidebar and layout adaptations
frontend/src/components/navigation/Sidebar.tsx, frontend/src/layouts/AuthenticatedLayout.tsx
AdminNav removes the "Connected Learning" collapsible section; StudentNav removes hasProvider checks and provider-gated "Learning Path / My Courses / My Progress" block. AuthenticatedLayout narrows isResidentPage matching to only /resident-programs and /home.

Removed Provider Management Pages

Layer / File(s) Summary
Provider admin UIs
frontend/src/pages/admin/ProviderPlatformManagement.tsx, frontend/src/pages/admin/ProviderUserManagement.tsx
Deletes provider platform listing, edit/archive/token-refresh actions, and OIDC client management; removes provider user import and account association workflows.

Removed Provider-Based Student Learning Pages

Layer / File(s) Summary
Learning path and course management
frontend/src/pages/learning/CourseCatalog.tsx, frontend/src/pages/learning/MyCourses.tsx, frontend/src/pages/learning/MyProgress.tsx
Removes provider-scoped catalog browsing, enrolled course management, and progress tracking pages.
Landing and legacy routes
frontend/src/pages/Welcome.tsx, frontend/src/routes/provider-routes.tsx
Deletes the welcome/login landing page and the entire provider route configuration tree.

Dashboard and Component Cleanup

Layer / File(s) Summary
Dashboard and activity components
frontend/src/pages/student/StudentDashboard.tsx, frontend/src/components/dashboard/WeeklyActivity.tsx, frontend/src/components/student/CatalogCourseCard.tsx, frontend/src/components/student/EnrolledCourseCard.tsx, frontend/src/hooks/useCheckResponse.ts
Removes student dashboard with recent activity table, weekly activity chart, course card layouts, and the response-checking hook.
Insights pages
frontend/src/pages/insights/KnowledgeInsights.tsx, frontend/src/pages/insights/LearningInsights.tsx
Removes knowledge and learning insights pages.
Resident data gating
frontend/src/pages/learning/ResidentOverview.tsx
Adds conditional SWR keys and early return for unauthenticated users, preventing programs and calendar event fetches without an authenticated user.
Legacy attendance page
frontend/src/pages/TakeAttendance.tsx
Removes the attendance marking workflow including roster attendance tracking and per-user status/time entry.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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 'fix: remove unused code' accurately summarizes the main objective of the PR, which is to remove dead/deprecated code and clean up unused imports and components.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining why code is being removed, what files are affected, and verification methods used.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/.husky/staged-files (1)

1-12: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove .husky/staged-files from the PR and add it to .gitignore.

This file is a temporary artifact that was accidentally committed to version control. It contains stale file paths, including references to a non-existent frontend-v2/ directory and backend files that are not actually modified in this PR. The .husky directory is not part of the Husky framework (there is no Husky configuration in package.json), and staged-files is not a standard hook file.

Remove this file from the commit and ensure .husky/ is added to .gitignore to prevent accidental commits of temporary files.

🤖 Prompt for 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.

In `@frontend/.husky/staged-files` around lines 1 - 12, Remove the accidental
.husky/staged-files from the change set and prevent recurrence by adding .husky/
to .gitignore; specifically, delete the file from the PR (git rm --cached
.husky/staged-files or remove it and amend the commit) and add a line ".husky/"
to .gitignore, then commit the changes so the temporary artifact is not tracked
going forward.
🤖 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.

Outside diff comments:
In `@frontend/.husky/staged-files`:
- Around line 1-12: Remove the accidental .husky/staged-files from the change
set and prevent recurrence by adding .husky/ to .gitignore; specifically, delete
the file from the PR (git rm --cached .husky/staged-files or remove it and amend
the commit) and add a line ".husky/" to .gitignore, then commit the changes so
the temporary artifact is not tracked going forward.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0cace44b-b709-4675-9c65-364db3e184b1

📥 Commits

Reviewing files that changed from the base of the PR and between ddab0d2 and 6ffd0cd.

📒 Files selected for processing (21)
  • frontend/.husky/staged-files
  • frontend/src/auth/useAuth.ts
  • frontend/src/components/dashboard/WeeklyActivity.tsx
  • frontend/src/components/navigation/Sidebar.tsx
  • frontend/src/components/student/CatalogCourseCard.tsx
  • frontend/src/components/student/EnrolledCourseCard.tsx
  • frontend/src/hooks/useCheckResponse.ts
  • frontend/src/layouts/AuthenticatedLayout.tsx
  • frontend/src/pages/TakeAttendance.tsx
  • frontend/src/pages/Welcome.tsx
  • frontend/src/pages/admin/ProviderPlatformManagement.tsx
  • frontend/src/pages/admin/ProviderUserManagement.tsx
  • frontend/src/pages/insights/KnowledgeInsights.tsx
  • frontend/src/pages/insights/LearningInsights.tsx
  • frontend/src/pages/learning/CourseCatalog.tsx
  • frontend/src/pages/learning/MyCourses.tsx
  • frontend/src/pages/learning/MyProgress.tsx
  • frontend/src/pages/learning/ResidentOverview.tsx
  • frontend/src/pages/student/StudentDashboard.tsx
  • frontend/src/routes/index.tsx
  • frontend/src/routes/provider-routes.tsx
💤 Files with no reviewable changes (18)
  • frontend/src/components/dashboard/WeeklyActivity.tsx
  • frontend/src/pages/admin/ProviderUserManagement.tsx
  • frontend/src/pages/admin/ProviderPlatformManagement.tsx
  • frontend/src/auth/useAuth.ts
  • frontend/src/pages/insights/LearningInsights.tsx
  • frontend/src/pages/insights/KnowledgeInsights.tsx
  • frontend/src/pages/learning/MyProgress.tsx
  • frontend/src/pages/learning/CourseCatalog.tsx
  • frontend/src/pages/student/StudentDashboard.tsx
  • frontend/src/pages/Welcome.tsx
  • frontend/src/pages/learning/MyCourses.tsx
  • frontend/src/routes/provider-routes.tsx
  • frontend/src/hooks/useCheckResponse.ts
  • frontend/src/routes/index.tsx
  • frontend/src/pages/TakeAttendance.tsx
  • frontend/src/components/student/CatalogCourseCard.tsx
  • frontend/src/components/student/EnrolledCourseCard.tsx
  • frontend/src/components/navigation/Sidebar.tsx

Copy link
Copy Markdown
Contributor

@carddev81 carddev81 left a comment

Choose a reason for hiding this comment

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

Looks good. Just had one comment, but this is good to go.

Comment thread frontend/.husky/staged-files Outdated
@CK-7vn CK-7vn force-pushed the CK-7vn/deadcode branch from 6ffd0cd to 98b14d9 Compare May 13, 2026 22:32
@CK-7vn CK-7vn merged commit 96c36e4 into CK-7vn/total-refactor May 13, 2026
9 checks passed
@CK-7vn CK-7vn deleted the CK-7vn/deadcode branch May 13, 2026 22:45
CFF added a commit to AlleyCorpNord/UnlockEdv2 that referenced this pull request May 20, 2026
Reconcile local digital-transcript work with remote's frontend-v2 to frontend
rename and the unused-code cleanup from PR UnlockedLabs#1127.

Hidden developer menu: kept the new DevCommandMenu and componentLibraryCatalog
under frontend/src/components/dev/. Quick-access palette for browsing the local
component library, not surfaced in production navigation.

Two-direction Programs routing: in both useAuth.getResidentLink and the Sidebar
Programs entry, users with EITHER FeatureAccess.ProgramAccess OR
FeatureAccess.ProviderAccess now land on /resident-programs. The remote had
dropped the Provider direction; restoring it keeps both populations on the same
Programs hub (hasProgramsHub = hasProgram || hasProvider).

Other resolutions:
- 33 new transcript-flow files (achievement form, learning record export,
  resident programs index/layout, demo data, etc.) redirected to frontend/.
- 6 files deleted by PR UnlockedLabs#1127 stay deleted; the local edits were mechanical
  bg-muted to bg-canvas class renames and are obsolete in the new layout.
- AuthenticatedLayout: kept startsWith('/resident-programs') for isResidentPage
  and added isAdmins to the isFullBleed list (from remote).
- ResidentOverview: took the rewritten 397-line version (active/archive tabs,
  demo programs, embedded mode) over remote's 155-line variant.
- CaptureToFigmaButton and transcriptSurveyValidation stay deleted.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants