Skip to content

feat: add native dark mode toggle to header layout#3310

Draft
Baluduvamsi2006 wants to merge 1 commit intoapache:masterfrom
Baluduvamsi2006:feat/add-dark-mode-toggle
Draft

feat: add native dark mode toggle to header layout#3310
Baluduvamsi2006 wants to merge 1 commit intoapache:masterfrom
Baluduvamsi2006:feat/add-dark-mode-toggle

Conversation

@Baluduvamsi2006
Copy link
Contributor

@Baluduvamsi2006 Baluduvamsi2006 commented Mar 1, 2026

Why submit this pull request?

  • Bugfix
  • New feature provided
  • Improve performance
  • Backport patches

What changes will this PR take into?

This PR introduces a native Dark Mode toggle switch in the dashboard header, enabling seamless switching between light and dark themes across the entire application.


Detailed Implementation

✨ Feature: Dark Mode Toggle Integration

image
  • Created a new DarkModeToggleBtn.tsx component.
  • Implemented as an ActionIcon placed in the dashboard header.
  • Utilizes Mantine’s useMantineColorScheme hook to toggle global AppShell color scheme state securely and consistently.
  • Dynamically switches icons between IconLightMode and IconDarkMode based on active theme.

🎨 Theme Consistency Improvements

  • Ensured all underlying Ant Design ProTable styling variables align correctly with Mantine’s dark theme configuration.
  • Adjusted styling to maintain true-black visual consistency.
  • Eliminated theme clashes and visual artifacts when switching between light and dark modes.

This implementation provides a clean, accessible, and fully integrated theme-switching experience across the dashboard.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a user-facing dark mode toggle in the dashboard header and aligns Ant Design (ProTable) theming with Mantine so light/dark mode styling stays consistent across the app.

Changes:

  • Introduces a new header DarkModeToggleBtn that toggles Mantine color scheme.
  • Updates Ant Design ConfigProvider theme to follow Mantine’s current color scheme (including dark algorithm + token overrides).
  • Customizes Mantine theme colors.dark scale to support a true-black dark palette.

Reviewed changes

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

File Description
src/main.tsx Defines a custom Mantine dark palette used for consistent dark-mode styling.
src/config/antdConfigProvider.tsx Bridges Mantine color scheme into Ant Design theme algorithm + background/border tokens.
src/components/Header/index.tsx Adds the dark mode toggle button into the header action group.
src/components/Header/DarkModeToggleBtn.tsx New icon-only action to toggle light/dark mode via Mantine hooks.

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.


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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.


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

@Baluduvamsi2006 Baluduvamsi2006 force-pushed the feat/add-dark-mode-toggle branch 7 times, most recently from 65a0cb8 to 279c9b5 Compare March 13, 2026 20:42
@Baluduvamsi2006 Baluduvamsi2006 force-pushed the feat/add-dark-mode-toggle branch from 279c9b5 to 58d5933 Compare March 13, 2026 20:43
- Introduces DarkModeToggleBtn component with accessible UI controls
- Toggles Mantine color scheme between light and dark modes
- Updates Header to display toggle button in action group
- Enables seamless light/dark theme switching across entire application
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

*/

import { ActionIcon, useComputedColorScheme, useMantineColorScheme } from '@mantine/core';
import { IconDarkMode, IconLightMode } from '@tabler/icons-react';
variant="light"
size="sm"
aria-label={isDark ? 'Switch to light mode' : 'Switch to dark mode'}
title={isDark ? 'Switch to light mode' : 'Switch to dark mode'}
Comment on lines 49 to 52
<Group h="100%" gap="sm">
<DarkModeToggleBtn />
<SettingModalBtn />
<LanguageMenu />
Copy link
Contributor

@Baoyuantop Baoyuantop left a comment

Choose a reason for hiding this comment

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

  1. @tabler/icons-react is not in package.json. This project uses unplugin-icons — see SettingModalBtn.tsx in the same directory. Should be import IconDarkMode from '~icons/material-symbols/dark-mode'.
  2. Hardcoded strings in aria-label / title will fail i18n lint (--max-warnings=0). Must use t() and add keys to locale files. Also title is redundant with aria-label — consider dropping it.
  3. PR description mentions Ant Design ProTable styling work that isn't in the diff. Please update to match actual changes.
  4. ProTable is used on almost every page. Without antd ConfigProvider dark theme sync, dark mode will look broken. Please include it or document as follow-up.

@Baluduvamsi2006 Baluduvamsi2006 marked this pull request as draft March 20, 2026 14:15
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