Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
width: 100%;
}

@media (max-width: 900px) {
@media (width <= 900px) {
.filtersGrid {
grid-template-columns: 1fr;
}
Expand Down Expand Up @@ -91,9 +91,9 @@
}

.darkDateInput {
background-color: #253342;
color: #fff;
border-color: #2d4059;
background-color: #253342 !important;
color: #fff !important;
border-color: #2d4059 !important;
color-scheme: dark;
}

Expand Down Expand Up @@ -174,7 +174,7 @@
}

.varianceOverLight { color: #e74c3c !important; }
.varianceOverDark { color: #ff4444 !important; }
.varianceOverDark { color: #f44 !important; }

.varianceUnderLight { color: #2ecc71 !important; }
.varianceUnderDark { color: #4ade80 !important; }
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Select from 'react-select';
import DatePicker from 'react-datepicker';
import 'react-datepicker/dist/react-datepicker.css';
import styles from './InjuryCategoryBarChart.module.css';
import { buildChartSelectStyles } from '../sharedSelectStyles';
import { useDispatch, useSelector } from 'react-redux';
import {
fetchInjuryData,
Expand Down Expand Up @@ -48,7 +49,6 @@ function InjuryCategoryBarChart() {
const [startDate, setStartDate] = useState(null);
const [endDate, setEndDate] = useState(null);

// ✅ NEW: key to force Recharts remount when needed (fixes "renders only on hover")
const [chartKey, setChartKey] = useState(0);

useEffect(() => {
Expand Down Expand Up @@ -168,35 +168,7 @@ function InjuryCategoryBarChart() {
endDate,
]);

const selectStyles = darkMode && {
control: base => ({
...base,
backgroundColor: '#2b3e59',
color: 'white',
}),
menu: base => ({
...base,
backgroundColor: '#2b3e59',
color: 'white',
}),
option: (base, state) => ({
...base,
color: 'white',
backgroundColor: state.isSelected
? 'rgba(255, 255, 255, 0.15)'
: state.isFocused
? 'rgba(255, 255, 255, 0.1)'
: 'transparent',
'&:active': {
backgroundColor: 'rgba(255, 255, 255, 0.2)',
},
}),
singleValue: base => ({
...base,
color: 'white',
}),
};
// : {};
const selectStyles = buildChartSelectStyles(darkMode);

return (
<div className={`injury-chart-container ${darkMode && 'darkMode'}`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ export default function IssuesBreakdownChart() {
<XAxis dataKey="projectName" tick={{ fill: textColor }} />
<YAxis allowDecimals={false} tick={{ fill: textColor }} />
<Tooltip
cursor={{ fill: darkMode ? 'rgba(255, 255, 255, 0.05)' : 'rgba(0, 0, 0, 0.05)' }}
contentStyle={{
backgroundColor: tooltipBg,
border: `1px solid ${tooltipBorderColor}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@
}

.darkDateInput {
background-color: #253342;
color: #fff;
border-color: #2d4059;
background-color: #253342 !important;
color: #fff !important;
border-color: #2d4059 !important;
color-scheme: dark;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,19 @@
background: #2b2b2b;
}

.table tbody tr:hover {
background-color: #e8f0fe;
}

.darkMode .table tbody tr:hover {
background-color: #3a506b;
}

.darkMode .table tbody tr:hover .td,
.darkMode .table tbody tr:hover .tdProject {
color: #fff !important;
}

.th {
padding: 12px;
text-align: left;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { Info, Repeat } from 'lucide-react';
import { v4 as uuidv4 } from 'uuid';
import { fetchBMProjects } from '../../../../actions/bmdashboard/projectActions';
import styles from './QuantityOfMaterialsUsed.module.css';
import PropTypes from 'prop-types';
import { data } from 'jquery';

ChartJS.register(
BarElement,
Expand Down Expand Up @@ -793,7 +795,9 @@ function QuantityOfMaterialsUsed({ data }) {
maxDate={new Date()}
dateFormat="MM/dd/yy - MM/dd/yy"
placeholderText="Select Date Range one"
className={`${styles.quantityOfMaterialUsedCustomDatePicker}`}
className={`${styles.quantityOfMaterialUsedCustomDatePicker}${
darkMode ? ` ${styles.quantityOfMaterialUsedCustomDatePickerDark}` : ''
}`}
disabledKeyboardNavigation
calendarStartDay={1}
shouldCloseOnSelect={false}
Expand Down Expand Up @@ -838,7 +842,9 @@ function QuantityOfMaterialsUsed({ data }) {
maxDate={new Date()}
dateFormat="MM/dd/yy - MM/dd/yy"
placeholderText="Select Date Range two"
className={`${styles.quantityOfMaterialUsedCustomDatePicker}`}
className={`${styles.quantityOfMaterialUsedCustomDatePicker}${
darkMode ? ` ${styles.quantityOfMaterialUsedCustomDatePickerDark}` : ''
}`}
disabledKeyboardNavigation
calendarStartDay={1}
shouldCloseOnSelect={false}
Expand Down Expand Up @@ -1053,4 +1059,8 @@ function QuantityOfMaterialsUsed({ data }) {
);
}

QuantityOfMaterialsUsed.propTypes = {
data: PropTypes.array.isRequired,
};

export default QuantityOfMaterialsUsed;
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,15 @@ div.weeklyProjectSummaryCard.normalCard .dropdownItem {
border-radius: 4px;
text-align: center;
padding: 2px 6px;
background-color: var(--card-bg);
color: var(--text-color);
background-color: var(--card-bg) !important;
color: var(--text-color) !important;
transition: border-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.quantityOfMaterialUsedCustomDatePickerDark {
color-scheme: dark;
}

.quantityOfMaterialsUsedCard .customSelect_singleValue {
color: var(--text-color) !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import {
Label,
} from 'recharts';
import { useDispatch, useSelector } from 'react-redux';
import { Input } from 'reactstrap';
import Select from 'react-select';
import { fetchSupplierProjects, fetchSupplierPerformance } from '../../../actions/summaryDashboard';
import styles from './SupplierPerformanceGraph.module.css';
import { buildChartSelectStyles } from './sharedSelectStyles';

const getDateRangeOptions = () => {
const today = new Date();
Expand Down Expand Up @@ -72,12 +73,13 @@ const SupplierPerformanceDashboard = function({ height = 420, onDataLoaded }) {
const chartTheme = {
textColor: darkMode ? '#e0e0e0' : '#333',
axisColor: darkMode ? '#a0a0a0' : '#666',
// UPDATE: Set a lighter grey for dark mode so grid lines are clearly visible
gridColor: darkMode ? '#9CA3AF' : '#E2E8F0',
barColor: '#4CAF50',
labelFill: darkMode ? '#ffffff' : '#333',
};

const selectStyles = buildChartSelectStyles(darkMode);

useEffect(() => {
const loadProjects = async () => {
try {
Expand Down Expand Up @@ -124,6 +126,18 @@ const SupplierPerformanceDashboard = function({ height = 420, onDataLoaded }) {
fetchData();
}, [dispatch, selectedDateRange, selectedProject, onDataLoaded]);

// Build react-select options
const dateOptions = getDateRangeOptions().map(opt => ({ value: opt.value, label: opt.label }));
const selectedDateOption =
dateOptions.find(opt => opt.value === selectedDateRange) || dateOptions[0];

const projectOptions = [
{ value: 'all', label: 'ALL Projects' },
...projects.map(p => ({ value: p._id, label: p._id })),
];
const selectedProjectOption =
projectOptions.find(opt => opt.value === selectedProject) || projectOptions[0];

return (
<div
className={`${styles['supplier-performance-card']} ${
Expand All @@ -137,38 +151,37 @@ const SupplierPerformanceDashboard = function({ height = 420, onDataLoaded }) {
{/* Filters Row */}
<div className={styles['supplier-performance-filters']}>
<div className={styles['supplier-performance-filter-group']}>
<label htmlFor="supplier-date-select">Dates</label>
<Input
id="supplier-date-select"
type="select"
value={selectedDateRange}
onChange={e => setSelectedDateRange(e.target.value)}
className={styles['supplier-performance-select']}
>
{getDateRangeOptions().map(option => (
<option key={option.value} value={option.value}>
{option.label}
</option>
))}
</Input>
<span className={styles['supplier-performance-label']} id="supplier-date-label">
Dates
</span>
<Select
inputId="supplier-date-select"
aria-labelledby="supplier-date-label"
options={dateOptions}
value={selectedDateOption}
onChange={opt => setSelectedDateRange(opt.value)}
styles={selectStyles}
isSearchable={false}
menuPortalTarget={typeof document === 'undefined' ? null : document.body}
menuPosition="fixed"
/>
</div>

<div className={styles['supplier-performance-filter-group']}>
<label htmlFor="supplier-project-select">Project</label>
<Input
id="supplier-project-select"
type="select"
value={selectedProject}
onChange={e => setSelectedProject(e.target.value)}
className={styles['supplier-performance-select']}
>
<option value="all">ALL Projects</option>
{projects.map(project => (
<option key={project._id} value={project._id}>
{project._id}
</option>
))}
</Input>
<span className={styles['supplier-performance-label']} id="supplier-project-label">
Project
</span>
<Select
inputId="supplier-project-select"
aria-labelledby="supplier-project-label"
options={projectOptions}
value={selectedProjectOption}
onChange={opt => setSelectedProject(opt.value)}
styles={selectStyles}
isSearchable={false}
menuPortalTarget={typeof document === 'undefined' ? null : document.body}
menuPosition="fixed"
/>
</div>
</div>

Expand All @@ -178,16 +191,15 @@ const SupplierPerformanceDashboard = function({ height = 420, onDataLoaded }) {

{error && <div className={styles['supplier-performance-error']}>{error}</div>}

{!loading && !error && supplierData.length === 0 && (
{loading === false && error === null && supplierData.length === 0 && (
<div className={styles['supplier-performance-empty']}>
No supplier performance data available.
</div>
)}

{!loading && !error && supplierData.length > 0 && (
{loading === false && error === null && supplierData.length > 0 && (
<ResponsiveContainer width="100%" height={height}>
<BarChart data={supplierData} margin={{ top: 20, right: 30, left: 20, bottom: 20 }}>
{/* Added grid lines: Dotted (3 3) and custom theme color */}
<CartesianGrid strokeDasharray="3 3" stroke={chartTheme.gridColor} opacity={0.5} />

<XAxis
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,29 @@
.supplier-performance-error {
color: #f44336;
}
/* Label span styling for react-select labels */
.supplier-performance-label {
display: block;
font-size: 12px;
font-weight: 500;
margin-bottom: 4px;
color: var(--label-color, #555);
}

.supplier-performance-dark-mode .supplier-performance-label {
color: #e0e0e0;
}/* Label span styling for react-select labels */
.supplier-performance-label {
display: block;
font-size: 12px;
font-weight: 500;
margin-bottom: 4px;
color: var(--label-color, #555);
}

.supplier-performance-dark-mode .supplier-performance-label {
color: #e0e0e0;
}

@media (width <= 768px) {
.supplier-performance-filters {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ const CustomTooltip = ({

const data = payload[0];
const percentage = total > 0 ? ((data.value / total) * 100).toFixed(1) : '0.0';
const textColor = darkMode ? '#e0e0e0' : '#333';
const subTextColor = darkMode ? '#c5d0dd' : '#666';

return (
<div style={getTooltipContainerStyle(darkMode)}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
width: 95%;
margin: auto;
padding: 20px;
background: var(--bg-color);
color: var(--text-color);
}

Expand Down
Loading
Loading