Skip to content

Add light/dark theme toggle with full app retheme - #42

Merged
Siddharth-732 merged 2 commits into
Siddharth-732:mainfrom
Flashl3opard:feature/theme-toggle
Jul 5, 2026
Merged

Add light/dark theme toggle with full app retheme#42
Siddharth-732 merged 2 commits into
Siddharth-732:mainfrom
Flashl3opard:feature/theme-toggle

Conversation

@Flashl3opard

Copy link
Copy Markdown
Contributor

Summary

  • Adds a persisted light/dark theme system: a Zustand store (localStorage-backed, key bind-theme), an inline pre-hydration bootstrap script to avoid a flash of the wrong theme, and a Tailwind v4 @custom-variant dark + CSS-variable token system (bg-surface, text-primary, bg-brand, etc.) driving every themed color in the app.
  • Adds an animated sun/moon toggle in the sidebar nav, and rewires the previously-static Settings → Appearance tab (old non-functional "Dark/Light/Sync" mockup) into a real, working theme switcher wired to the same store — both controls stay in sync.
  • Retheme's the entire frontend to use the new tokens instead of hardcoded colors: nav rail, chat, lodge, explore, notifications, all settings tabs, every modal, shared components, and the login/register pages. First-time visitors get the OS prefers-color-scheme as the default; returning visitors get their saved choice.

Notable fixes along the way

  • Caught and fixed a first-visit dark-OS bug where the toggle/Appearance cards briefly showed the wrong selected state until a second click.
  • Two follow-up sweeps caught ~20 hardcoded colors that fell outside individual per-section edits (chat header, story labels, avatar fallbacks, several buttons) and brought them onto the token system.
  • Intentional exceptions were preserved: status colors (red/green), the fixed-dark Story Viewer lightbox, decorative role-badge cards, and the Appearance tab's fixed preview swatches.

Screenshots

image image

Copilot AI review requested due to automatic review settings July 5, 2026 09:50
@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

@Flashl3opard is attempting to deploy a commit to the Siddharth Pandey's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Flashl3opard
Flashl3opard force-pushed the feature/theme-toggle branch from 89c994c to cf4fa3e Compare July 5, 2026 09:52

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 an application-wide light/dark theme system for the Next.js frontend, including persistence, pre-hydration theme bootstrapping to prevent flashes, and a CSS-token-based Tailwind color approach to retheme major UI surfaces.

Changes:

  • Adds a persisted theme store (Zustand) and a sidebar theme toggle component.
  • Adds a pre-hydration script in the root layout and introduces CSS-variable-backed Tailwind tokens (including a custom dark variant).
  • Rethemes multiple pages/components to use bg-surface, text-primary, border-subtle, brand, and related tokens instead of hardcoded colors.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
frontend/store/useThemeStore.ts New persisted theme store that applies/remembers the .dark class.
frontend/components/ThemeToggle.tsx New animated sidebar theme toggle wired to the store.
frontend/components/PostCard.tsx Rethemes post card surfaces/typography/borders to token utilities.
frontend/components/ConfirmModal.tsx Rethemes modal surfaces, text, and hover states to tokens.
frontend/components/AvatarSelectionModal.tsx Rethemes modal UI and interactive states to tokens.
frontend/app/register/page.tsx Rethemes register flow UI to tokens.
frontend/app/page.tsx Rethemes main app shell (nav/chat/lodge/settings) and wires Settings → Appearance to the theme store.
frontend/app/login/page.tsx Rethemes login UI to tokens.
frontend/app/layout.tsx Adds inline theme bootstrap script and suppresses hydration warnings at <html>.
frontend/app/globals.css Defines CSS variable tokens for light/dark and maps them into Tailwind via @theme inline.

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

Comment thread frontend/components/ThemeToggle.tsx
Comment thread frontend/store/useThemeStore.ts
Comment thread frontend/app/login/page.tsx
Comment thread frontend/app/register/page.tsx
Comment thread frontend/app/page.tsx
Comment thread frontend/app/page.tsx
Comment thread frontend/app/page.tsx
Comment thread frontend/app/page.tsx
@Siddharth-732

Copy link
Copy Markdown
Owner

LGTM !😉

@Siddharth-732
Siddharth-732 merged commit abc17cc into Siddharth-732:main Jul 5, 2026
1 of 2 checks passed
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.

3 participants