Skip to content

Aditya-Fix dark mode text visibility in Weekly Project Summary dashboard charts#4620

Open
Aditya-gam wants to merge 15 commits intodevelopmentfrom
Aditya-fix/dark-mode-text-visibility-pr3882
Open

Aditya-Fix dark mode text visibility in Weekly Project Summary dashboard charts#4620
Aditya-gam wants to merge 15 commits intodevelopmentfrom
Aditya-fix/dark-mode-text-visibility-pr3882

Conversation

@Aditya-gam
Copy link
Contributor

@Aditya-gam Aditya-gam commented Dec 24, 2025

Description

Fixes dark mode text visibility issues across multiple charts in the Weekly Project Summary dashboard by replacing native HTML date inputs with react-datepicker components and implementing consistent dark mode styling.

IssueDescription1 IssueDescription2 IssueDescription3

Related PRs (if any):

Main changes explained:

Key Changes:

  1. Date Input Migration (4+ components):
    • Replaced native <input type="date"> with react-datepicker for better dark mode styling
    • Updated date state from strings to Date objects
    • Added date range validation (minDate/maxDate constraints)
    • Files: ToolsAvailabilityPage.jsx, DistributionLaborHours.jsx, ExpenseBarChart.jsx, ToolsHorizontalBarChart.jsx
  2. Dark Mode Styling:
    • Standardized color scheme: #2b3344 backgrounds, #fff text, #253342 chart containers
    • Added high-specificity CSS selectors to prevent global style overrides
    • Created/updated CSS modules for consistent styling across charts
  3. Chart Components Updated:
    • Tools: Availability page, Horizontal bar chart, Tool status donut chart
    • Financials: Expense bar chart (new CSS module)
    • Labor: Distribution of Labor Hours
    • Charts: Project Risk Profile Overview, Supplier Performance, Injury Severity, Longest Open Issues
    • UI Elements: Project Status cards, Most Frequent Keywords filters
  4. Code Quality:
    • Refactored nested ternary operations for readability
    • Improved button contrast in light mode (DistributionLaborHours)
    • Maintained accessibility (ARIA labels, semantic HTML)

How to test:

  1. Checkout branch: Aditya-fix/dark-mode-text-visibility-pr3882
  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. Login as owner/admin.
  5. Navigate to BM Dashboard → Weekly Project Summary
  6. Test dark mode toggle - verify all charts switch properly
  7. Test key components:
    • Tools Availability: date range pickers, project selection
    • Distribution of Labor Hours: date filters, submit button contrast
    • Expense Bar Chart: project/category dropdowns, date filters
    • Project Risk Profile: multi-select dropdowns, chart axes visibility
    • Issues charts: background color (#253342), filter styling

Verify: All text is readable in both modes, date pickers function correctly, no console errors, consistent styling across components.

Screenshots or videos of changes:

TestVideo.mov

Note:

  • Changed date components to react-datepicker.
  • Styles for PaidLaborCost chart are fixed in PR #4496

- Update filter dropdowns to use #2b3344 background and #fff text in dark mode
- Change chart container background from #1e1e1e to #253342 in dark mode
- Set axes labels to #fff in dark mode for better visibility
- Refactor nested ternary operations for improved code readability
- Add high-specificity CSS selectors to prevent style overrides
- Update container background from #121212 to #253342 in dark mode
- Change chart background to #253342 in dark mode
- Set axes labels to #fff for better visibility
- Update filter dropdowns and date pickers to use #2b3344 background and #fff text
- Add high-specificity CSS selectors to prevent style overrides
- Refactor nested ternary operations for improved code readability
…lters

- Set date range filter placeholder text color to #fff in dark mode
- Add high-specificity CSS selectors to prevent style overrides
- Target both direct className and react-datepicker wrapper structures
- Add dark mode styles for select and date input filters with #2b3344 background and #fff text
- Use high-specificity CSS selectors to prevent style overrides from global styles
- Add white dropdown arrow for select elements in dark mode
- Create CSS module to replace inline styles for better maintainability
- Replace native HTML5 date inputs with react-datepicker components
- Update date state from strings to Date objects
- Remove native date input CSS and add react-datepicker styles
- Add dark mode styles for date picker inputs and calendar popup
- Follow pattern from InjuryCategoryBarChart for consistency
…tionLaborHours

Replace native HTML date inputs with react-datepicker components to properly support dark mode styling. Add high-specificity CSS selectors for datepicker inputs with #2b3344 background and #fff text color in dark mode, following the pattern used in InjuryCategoryBarChart.
…y Availability chart

- Replace native HTML date inputs with react-datepicker components
- Add dark and light mode styling for datepickers matching reference implementation
- Restructure filters into 2x2 grid layout for improved visual organization
- Update date state management to use Date objects instead of strings
Update button colors from black to light gray shades for better visual consistency. Hover state uses darker gray for improved feedback.
@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 80461e7
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/694c6c594346670008d783c1
😎 Deploy Preview https://deploy-preview-4620--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.

Update CustomTooltip component to accept darkMode prop and apply conditional styling for better contrast and readability in dark mode.
Extract common chart styling and utility functions into a centralized
module to eliminate code duplication across BMDashboard chart components.
This addresses SonarQube duplication violations where the codebase exceeded
the 3% duplication threshold at 15.4%.

Created src/utils/bmdashboard/chartUtils.js with shared utilities:
- toYMD(): Date formatting function for YYYY-MM-DD conversion
- getSelectStyles(): React-select styling configuration for dark/light modes
- getDatePickerStyles(): Inline styles for react-datepicker components
- getChartAxisProps(): Common Recharts axis styling props

Refactored the following components to use shared utilities:
- openIssueCharts.jsx: Removed ~100 lines of duplicated select styles
- ProjectRiskProfileOverview.jsx: Removed ~100 lines of duplicated select styles
- InjuryCategoryBarChart.jsx: Removed ~100 lines of duplicated code
- ToolsHorizontalBarChart.jsx: Removed ~60 lines of duplicated code

Total reduction: ~360+ lines of duplicated code eliminated while
maintaining existing functionality and visual appearance. All components
now share consistent styling logic, making future maintenance easier.
@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.

1 participant

Comments