Skip to content

feat(web): add global dark/light theme toggle#252

Merged
AnkanMisra merged 4 commits into
AnkanMisra:mainfrom
Sargam-Ghagre:feat/global-theme-toggle
Jul 6, 2026
Merged

feat(web): add global dark/light theme toggle#252
AnkanMisra merged 4 commits into
AnkanMisra:mainfrom
Sargam-Ghagre:feat/global-theme-toggle

Conversation

@Sargam-Ghagre

@Sargam-Ghagre Sargam-Ghagre commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes - #246

Program - GSSoC26

Summary

  • Added a global Dark/Light theme toggle to the navigation bar.
  • Implemented a global ThemeProvider using next-themes.
  • Persisted the selected theme using local storage.
  • Added smooth theme transition effects.
  • Applied theme changes across the application using existing CSS variables.
  • Ensured the implementation follows the project's existing design system without affecting existing functionality.

Screen Recording

Screen.Recording.2026-07-06.134809.-.Trim.mp4

Type Of Change

  • Bug fix
  • Feature
  • Documentation
  • Tests
  • Refactor
  • Deployment/config

Affected Areas

  • Gateway (gateway/)
  • Verifier (verifier/)
  • Web (web/)
  • E2E/tests (tests/, run_e2e.sh)
  • Benchmarks (bench/)
  • Deployment/config (deploy/, Docker, env, workflows)
  • Documentation/community files

Contributor Checklist

  • I kept the change focused and avoided unrelated refactors.
  • I updated README/service docs/OpenAPI/env examples when behavior, config, headers, status codes, or public APIs changed.
  • I did not commit secrets, private keys, funded wallets, API keys, or real production URLs.
  • I checked x402/EIP-712 field parity when touching payment context, signatures, timestamps, nonces, chain IDs, receipts, or wallet flow.
  • I checked Docker/Compose/Fly/Vercel docs when touching ports, service names, health checks, or environment variables.

Verification

List the exact commands you ran and their result.

cd web
bun run dev
bun run lint
bun run typecheck
bun run test:unit
bun run build



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **New Features**
  * Added light/dark theme support across the app.
  * Introduced a theme toggle in the top navigation for quick switching.
  * The selected theme now persists between visits.

* **Style**
  * Updated global colors and UI variables so existing layouts automatically adapt to dark mode.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

@Sargam-Ghagre is attempting to deploy a commit to the ankanmisra's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Hi @Sargam-Ghagre, thanks for opening this PR.

Every contribution helps MicroAI-Paygate grow. If you find the project useful, consider starring the repository — it helps others discover it.

Star MicroAI-Paygate on GitHub

Looking forward to reviewing this PR.

@github-actions github-actions Bot added the TypeScript TypeScript code label Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@AnkanMisra, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8328a7ba-e0f5-4b23-aa40-cb31d166ccae

📥 Commits

Reviewing files that changed from the base of the PR and between 02ab5fc and 5f04f10.

⛔ Files ignored due to path filters (1)
  • web/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • web/package.json
  • web/src/app/layout.tsx
  • web/src/components/nav.tsx
  • web/src/components/theme-provider.tsx
  • web/src/components/theme-toggle.tsx
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a global dark/light theme toggle for the web app.
Description check ✅ Passed The description covers the main template sections and change details, but the verification results and a dedicated screenshots section are only partially filled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@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.

Caution

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

⚠️ Outside diff range comments (1)
web/src/app/layout.tsx (1)

44-53: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Add suppressHydrationWarning to <html>. next-themes updates the html class/attributes before hydration, so this avoids the hydration warning on every page load.

🩹 Proposed fix
-    <html lang="en">
+    <html lang="en" suppressHydrationWarning>
🤖 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 `@web/src/app/layout.tsx` around lines 44 - 53, Add suppressHydrationWarning to
the root html element in layout.tsx so next-themes can update the html
class/attributes before hydration without triggering warnings. Update the <html>
element in the layout component that renders ThemeProvider, keeping the rest of
the structure unchanged.
🧹 Nitpick comments (1)
web/src/components/theme-toggle.tsx (1)

14-23: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add accessible toggle semantics.

The button relies solely on emoji + text content to convey state, with no aria-label or aria-pressed. As per path instructions, "Preserve accessibility for forms/buttons/status messages in the web client."

♿ Proposed fix
     <button
       onClick={() =>
         setTheme(theme === "light" ? "dark" : "light")
       }
+      aria-pressed={theme === "dark"}
+      aria-label={theme === "light" ? "Switch to dark mode" : "Switch to light mode"}
       className="border border-ink bg-paper px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.12em] text-ink transition-all duration-300 hover:bg-ink hover:text-paper"
     >

As per path instructions: "Preserve accessibility for forms/buttons/status messages in the web client; prevent hydration or uncontrolled-input issues."

🤖 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 `@web/src/components/theme-toggle.tsx` around lines 14 - 23, The theme toggle
button in theme-toggle.tsx lacks accessible state semantics. Update the button
in the ThemeToggle component to expose its toggle state with accessible
attributes such as aria-pressed and a clear aria-label that reflects the current
theme, while keeping the existing theme switching behavior in setTheme. Ensure
the button’s visible text can remain, but do not rely on it alone to convey
state.

Source: Path instructions

🤖 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 `@web/src/app/layout.tsx`:
- Around line 44-53: Add suppressHydrationWarning to the root html element in
layout.tsx so next-themes can update the html class/attributes before hydration
without triggering warnings. Update the <html> element in the layout component
that renders ThemeProvider, keeping the rest of the structure unchanged.

---

Nitpick comments:
In `@web/src/components/theme-toggle.tsx`:
- Around line 14-23: The theme toggle button in theme-toggle.tsx lacks
accessible state semantics. Update the button in the ThemeToggle component to
expose its toggle state with accessible attributes such as aria-pressed and a
clear aria-label that reflects the current theme, while keeping the existing
theme switching behavior in setTheme. Ensure the button’s visible text can
remain, but do not rely on it alone to convey state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 42a31d5a-11f3-4204-96f6-6431080d331e

📥 Commits

Reviewing files that changed from the base of the PR and between 33e7fc3 and 02ab5fc.

📒 Files selected for processing (5)
  • web/src/app/globals.css
  • web/src/app/layout.tsx
  • web/src/components/nav.tsx
  • web/src/components/theme-provider.tsx
  • web/src/components/theme-toggle.tsx

@AnkanMisra AnkanMisra added enhancement New feature or request gssoc:approved Approved for GSSoC contribution level:intermediate Moderate scope requiring project familiarity or cross-file changes. triage Needs maintainer triage. type:accessibility Accessibility, keyboard, screen-reader, or inclusive UX work. type:design Visual design, UX layout, or interaction polish. type:feature New user-facing or API-facing capability. labels Jul 6, 2026 — with ChatGPT Codex Connector
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
microai-paygate Ready Ready Preview, Comment Jul 6, 2026 2:14pm

@AnkanMisra

Copy link
Copy Markdown
Owner

@codex review

Add the missing next-themes dependency and lockfile entry so the Vercel build can resolve the theme provider imports.

Fix the theme toggle lint, hydration, and accessibility issues by deferring mount state through requestAnimationFrame, suppressing the expected root hydration warning, and exposing pressed state and labels.

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-authored-by: codex <codex@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 02ab5fc0bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread web/src/components/theme-provider.tsx
Comment thread web/src/components/theme-toggle.tsx Outdated
Comment thread web/src/app/layout.tsx
Comment thread web/src/components/nav.tsx Outdated
Allow the header action row to wrap on narrow screens and keep the theme toggle compact by showing icon-only text below the small breakpoint.

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Co-authored-by: codex <codex@users.noreply.github.com>
@AnkanMisra AnkanMisra merged commit d8d9bb9 into AnkanMisra:main Jul 6, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gssoc:approved Approved for GSSoC contribution level:intermediate Moderate scope requiring project familiarity or cross-file changes. triage Needs maintainer triage. type:accessibility Accessibility, keyboard, screen-reader, or inclusive UX work. type:design Visual design, UX layout, or interaction polish. type:feature New user-facing or API-facing capability. TypeScript TypeScript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants