Skip to content

fix: Add missing CSS rules for dark mode theme - #47

Merged
udaycodespace merged 2 commits into
udaycodespace:mainfrom
sujalv28:fix/add-missing-CSS-rules-for-dark-mode-theme
Aug 6, 2026
Merged

fix: Add missing CSS rules for dark mode theme#47
udaycodespace merged 2 commits into
udaycodespace:mainfrom
sujalv28:fix/add-missing-CSS-rules-for-dark-mode-theme

Conversation

@sujalv28

@sujalv28 sujalv28 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes the issue #27 [Dark Mode Toggle Does Nothing] where the dark mode toggle in the NavBar had no visual effect. While the toggle correctly applied the .dark-mode class to document.body, the corresponding CSS styles were completely missing from the project.

I have added a comprehensive set of .dark-mode CSS variables/rules to the global stylesheet so the application correctly switches to a dark theme when the class is active.

Related Issue

Issue #27 [Dark Mode Does Nothing]

Closes #27 [Dark Mode Does Nothing]

What changed?

Root theming:

  • App.css - added body.dark-mode variable override block (--paper, --ink, --white, --shadow, etc.), plus new --navbar-bg, --navbar-glow, --navbar-border, --surface-dark, --footer-fg variables.
  • NavBar.jsx - removed hardcoded inline styles on navbar/settings button/settings dropdown, replaced with theme-aware classes (premium-navbar, settings-btn, settings-dropdown).

Component-local dark-mode blocks (each had its own CSS variable scope, disconnected from the global toggle):

  • PaymentRecords.css, ActivityLogs.css, CourseReviews.css, Bookmarks.css - added body.dark-mode overrides for local vars and hardcoded hex/white values on buttons, error/empty states, table headers, status badges, form inputs.

Fixed-background-paired-with-theme-variable-text bugs (same failure pattern, found in three places):

  • Footer text/logo/links used var(--paper) on a permanently dark, non-theme-switching background - introduced fixed --footer-fg constant instead.
  • Course card thumbnail badge used var(--ink) on a fixed light background - hardcoded to a fixed dark color.
  • Catalog counter "COURSES FOUND" label was hardcoded white regardless of mode - added dark-mode-specific override.

Native 'select' dropdown popups (5 instances):

  • Browser-rendered option lists were inheriting var(--ink), which is invisible against the browser's own white popup surface. Forced fixed, readable 'option' colors independent of theme in App.css, ActivityLogs.css, PaymentRecords.css, Bookmarks.css, CourseReviews.css.

Components entirely outside the theme system:

  • AdminHome.jsx — admin tab nav (Users/Payments/Activity Logs) used MUI Button with color="inherit" on a hardcoded white bar; converted to theme-aware classes with !important overrides (required to beat MUI's injected styles).
  • TeacherHome.jsx — course cards used react-bootstrap's default white Card styling, never wired to app theme; added teacher-course-card / teacher-course-enrolled classes with !important overrides (required to beat Bootstrap's own stylesheet).

Files touched: App.css, NavBar.jsx, PaymentRecords.css, ActivityLogs.css, CourseReviews.css, Bookmarks.css, AdminHome.jsx, TeacherHome.jsx.

Type

  • Bug fix
  • New feature
  • Refactor
  • Docs only
  • Tests
  • Config / workflow
  • Security
  • Breaking change

Areas touched

  • Frontend
  • Backend
  • Database
  • Docs
  • Workflow / GitHub Actions
  • Config / environment

Testing

  • Tested locally
  • Build passes
  • Lint passes
  • Tests added or updated
  • Docs only, no runtime testing needed

Test steps

  1. Pull this branch and run the application locally.
  2. Log in and navigate to the dashboard.
  3. Click the dark mode toggle button in the navbar.
  4. Verify that the page successfully transitions to the dark theme and that text/components remain legible.

Screenshots

  • Not needed
  • Added below

Before

624880776-6e3948b9-224b-4fd4-8086-29b1971ad1b5

After

Screenshot 2026-08-06 015054 Screenshot 2026-08-06 015142 Screenshot 2026-08-06 015215 Screenshot 2026-08-06 015309 Screenshot 2026-08-06 015320 Screenshot 2026-08-06 015337 Screenshot 2026-08-06 015350

Edge cases checked

  • Empty or missing data
  • Loading / slow response
  • API failure / server error
  • Rate limit / throttling
  • Invalid or unexpected input
  • Permission / access denied
  • Partial or inconsistent data
  • Mobile / small screen behavior
  • Other

Checklist

  • Read CONTRIBUTING.md
  • Linked the issue
  • Assigned before starting or approved by maintainer
  • Changes are focused on one issue
  • No debug logs or unused code
  • Documentation updated if needed
  • No new warnings or console errors
  • Changes are meaningful, not trivial

Copilot AI lite review requested due to automatic review settings August 5, 2026 20:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces the missing dark-mode styling needed for the existing NavBar toggle (which adds/removes dark-mode on document.body) to produce an actual visual theme change across the app.

Changes:

  • Adds global body.dark-mode CSS variable overrides and new theme variables/classes in App.css (navbar/admin tabs/teacher cards/footer).
  • Adds component-level body.dark-mode overrides in several feature stylesheets (admin Activity Logs / Payments, Reviews, Bookmarks), including fixes for native <select><option> popup readability.
  • Updates Admin/Teacher components to use theme-aware classnames instead of hardcoded inline colors.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
frontend/src/App.css Adds global dark-mode variable overrides and shared theme classes (navbar/admin tabs/teacher cards/footer tweaks).
frontend/src/components/common/NavBar.jsx Implements the dark-mode toggle behavior and navbar styling hooks.
frontend/src/components/admin/AdminHome.jsx Replaces hardcoded admin tab styling with theme-aware classes.
frontend/src/components/user/teacher/TeacherHome.jsx Applies new theme-aware classes to course cards and enrolled text.
frontend/src/components/admin/PaymentRecords.css Adds dark-mode variable overrides and fixes for controls/status colors in dark mode.
frontend/src/components/admin/ActivityLogs.css Adds dark-mode variable overrides and fixes for controls/table/badges in dark mode.
frontend/src/components/reviews/CourseReviews.css Adds dark-mode variable overrides and dark-mode control/background styling for reviews UI.
frontend/src/components/bookmarks/Bookmarks.css Adds dark-mode variable overrides and button/empty/error state styling for bookmarks UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +375 to +386
body.dark-mode .review-form-card textarea,
body.dark-mode .review-form-actions button,
body.dark-mode .review-owner-actions button,
body.dark-mode .review-pagination button,
body.dark-mode .reviews-toolbar select {
background: #2a2a2a;
color: var(--review-ink);
}

body.dark-mode .review-form-actions button:last-child {
color: #1a1a1a;
}
Comment thread frontend/src/App.css
Comment on lines +1288 to +1292
.premium-navbar {
backdrop-filter: blur(12px) saturate(1.2);
background: var(--navbar-bg);
border-radius: 0 0 18px 18px;
border-bottom: 1px solid var(--navbar-border);
Comment thread frontend/src/App.css
Comment on lines +1296 to +1300
.settings-btn {
background: var(--surface-dark);
color: #fff;
}

@udaycodespace

Copy link
Copy Markdown
Owner

@sujalv28 Nice work on this PR! The Copilot suggestions look worthwhile please address them, and I'll take another look.

@udaycodespace udaycodespace added ECSoC26 Required label for a PR to be eligible for Sentinel scoring good-pr PA-awarded bonus for an exceptionally executed PR — +15 XP and removed frontend fullstack labels Aug 6, 2026
@udaycodespace
udaycodespace self-requested a review August 6, 2026 02:08
@udaycodespace udaycodespace added the redo Reviewed — needs changes before it can be merged label Aug 6, 2026
@sujalv28

sujalv28 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Okk sure @udaycodespace I'll check them

@sujalv28

sujalv28 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Hello @udaycodespace, I have made the changes requested. You can review them and merge if it solve the issue.

@udaycodespace

Copy link
Copy Markdown
Owner

Hello @udaycodespace, I have made the changes requested. You can review them and merge if it solve the issue.

LGTM!

@udaycodespace udaycodespace added good-issue PA-awarded bonus for a well-written, well-scoped issue — +10 XP and removed redo Reviewed — needs changes before it can be merged frontend fullstack labels Aug 6, 2026
@udaycodespace
udaycodespace merged commit 7bf1627 into udaycodespace:main Aug 6, 2026
2 of 7 checks passed
@ecsoc-sentinel ecsoc-sentinel Bot added the ECSoC26-L2 Medium difficulty, auto-assigned by Sentinel — 10 points label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ECSoC26-L2 Medium difficulty, auto-assigned by Sentinel — 10 points ECSoC26 Required label for a PR to be eligible for Sentinel scoring good-issue PA-awarded bonus for a well-written, well-scoped issue — +10 XP good-pr PA-awarded bonus for an exceptionally executed PR — +15 XP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dark Mode Toggle Does Nothing

3 participants