Skip to content

Conversation

@Aditya-gam
Copy link
Contributor

@Aditya-gam Aditya-gam commented Jan 17, 2026

Description

This PR fixes dark mode styling issues in the UtilizationChart component of the Building Management Dashboard. The changes ensure proper visual consistency when dark mode is enabled, including chart data label colors, date picker styling, button theming, and React DatePicker dropdown calendar appearance. Additionally, this PR updates the stylelint configuration to support modern CSS standards and CSS module naming conventions.

IssueImage

Related PRs (if any):

Main changes explained:

Updated Files:

  1. src/components/BMDashboard/UtilizationChart/UtilizationChart.jsx (+3/-3 lines)

    • Registered ChartDataLabels plugin: Added ChartDataLabels import and registration with ChartJS to enable data labels on the utilization chart bars
    • Dynamic data label colors: Updated datalabels.color configuration to dynamically switch between #ffffff (white) and #333 (dark gray) based on dark mode state
    • Removed bold font weight: Removed unnecessary weight: 'bold' from data label font configuration for cleaner appearance
    • Dark mode awareness: Chart data labels now properly respect the Redux darkMode state selector for consistent theming
  2. src/components/BMDashboard/UtilizationChart/UtilizationChart.module.css (+42/-13 lines)

    • Modern CSS color notation: Converted legacy rgba() and hex color codes to modern CSS format:
    • Changed rgba(0, 0, 0, 0.1) to rgb(0 0 0 / 10%)
    • Shortened hex codes: #ffffff#fff, #000000#000, #333333#333
    • Updated default button theme: Changed default button colors from teal (#a0e7e5/#72d6d3) to black/white (#000/#fff) for better contrast
    • DatePicker placeholder styling: Added .datepickerWrapper::placeholder with #999 color for light mode and #fff for dark mode
    • React DatePicker dark mode dropdown: Added comprehensive dark mode styling for the calendar dropdown using :global() selectors:
    • .react-datepicker: Dark background (#333), light text (#e0e0e0), subtle border (#555)
    • .react-datepicker__header: Darker header background (#444) with border separation
    • .react-datepicker__current-month, .react-datepicker__day-name, .react-datepicker__day: Consistent light text color
    • .react-datepicker__day:hover: Hover state with #555 background
    • .react-datepicker__day--selected, .react-datepicker__day--in-selecting-range, .react-datepicker__day--in-range: Selected states with brand yellow (#e8a71c) background and black text

Key Implementation Details:

  1. CSS Module Integration: The component uses CSS modules (.module.css) with camelCase class names, which is why the stylelint configuration needed to be updated to disable the selector-class-pattern rule
  2. Dark Mode State Management: Dark mode is controlled via Redux state (state.theme.darkMode) and applied conditionally using CSS class composition: ${styles.utilizationChartContainer} ${darkMode ? styles.darkMode : ''}
  3. Chart.js Plugin Integration: The chartjs-plugin-datalabels plugin displays downtime hours on each bar in the horizontal bar chart. The plugin must be registered globally with ChartJS before use
  4. Global Selector Strategy: React DatePicker renders its calendar dropdown outside the component hierarchy, requiring :global() pseudo-class selectors to style it from within the scoped CSS module
  5. Color Consistency: Dark mode colors follow the established Building Management Dashboard pattern:
    • Background: #1b2a41
    • Accent/Brand: #e8a71c (yellow)
    • Text: #fff
    • Input backgrounds: #3a506b
    • Borders: #4a5a77, #555

How to test:

  1. Check out to the branch: fix/utilization-chart-darkmode-issues
  2. Reinstall dependencies and clear cache: rm -rf node_modules && yarn cache clean
  3. Run yarn install and start the app: yarn start:local
  4. Log in as owner/admin.
  5. Navigate to the Building Management Dashboard → Utilization Chart
  6. Test Light Mode Appearance:
    • Verify chart data labels are dark gray (#333)
    • Verify the default button is black with white text
    • Verify date picker placeholder text is gray (#999)
  7. Test Dark Mode Toggle:
    • Enable dark mode via the application's theme toggle
    • Verify the UtilizationChart container background changes to #1b2a41
    • Verify chart data labels turn white (#fff)
    • Verify buttons change to yellow (#e8a71c).

Screenshots or videos of changes:

  • Light Mode:
LightMode
  • Dark Mode:
DarkMode
  • Test Video:
TestVideo.mov

Note:

  • Stylelint Configuration: The updated .stylelintrc now supports modern CSS color notation and CSS module naming conventions project-wide. This may affect other CSS files in future linting runs, but all existing files should pass with the new configuration
  • IDE Settings: .vscode/settings.json is now ignored to prevent developer-specific settings from being committed

- Update UtilizationChart.jsx: Register ChartDataLabels plugin, adjust data label colors to respect dark mode
- Update UtilizationChart.module.css: Add dark mode support for datepicker placeholder and dropdown, update button colors to black/white theme, add react-datepicker dark mode styling with modern CSS color notation
- Update .stylelintrc: Add stylelint-config-standard extension, configure selector-pseudo-class-no-unknown rule to ignore :global and :local pseudo-classes, disable selector-class-pattern to support CSS module camelCase naming
- Update .gitignore: Add .vscode/settings.json to ignore list
@netlify
Copy link

netlify bot commented Jan 17, 2026

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 6636db2
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/696b0475d32e250008f38fe1
😎 Deploy Preview https://deploy-preview-4724--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud
Copy link

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.

2 participants