diff --git a/src/components/BMDashboard/Equipment/DailyActivityLog/EDailyActivityLog.jsx b/src/components/BMDashboard/Equipment/DailyActivityLog/EDailyActivityLog.jsx index 935294cff8..b9ee69f3b6 100644 --- a/src/components/BMDashboard/Equipment/DailyActivityLog/EDailyActivityLog.jsx +++ b/src/components/BMDashboard/Equipment/DailyActivityLog/EDailyActivityLog.jsx @@ -1,6 +1,6 @@ import { useEffect, useMemo, useState } from 'react'; import { connect, useDispatch, useSelector } from 'react-redux'; -import { Button, ButtonGroup, Table } from 'reactstrap'; +import { Button, Table, UncontrolledTooltip } from 'reactstrap'; import Select from 'react-select'; import { fetchBMProjects } from '~/actions/bmdashboard/projectActions'; @@ -11,6 +11,8 @@ import { import { getHeaderData } from '~/actions/authActions'; import { getUserProfile } from '~/actions/userProfile'; +import styles from './EDailyActivityLog.module.css'; + // Helper function to get today's date in YYYY-MM-DD format const getToday = () => { const now = new Date(); @@ -61,17 +63,76 @@ const buildRows = list => }; }); +const getSelectStyles = (darkMode, isTableSelect = false) => ({ + container: base => ({ + ...base, + width: isTableSelect ? 300 : '100%', + minWidth: isTableSelect ? 300 : 'auto', + maxWidth: isTableSelect ? 300 : 'none', + }), + control: base => ({ + ...base, + backgroundColor: darkMode ? '#2a3f5f' : '#fff', + borderColor: darkMode ? '#3a506b' : '#ced4da', + color: darkMode ? '#ffffff' : '#000', // Changed to pure white + }), + singleValue: base => ({ + ...base, + color: darkMode ? '#ffffff' : '#000', // Changed to pure white + }), + input: base => ({ + ...base, + color: darkMode ? '#ffffff' : '#000', // Changed to pure white + }), + menu: base => ({ + ...base, + backgroundColor: darkMode ? '#2a3f5f' : '#fff', + zIndex: 9999, + }), + option: (base, state) => ({ + ...base, + backgroundColor: state.isFocused + ? darkMode + ? '#3a506b' + : '#e9ecef' + : darkMode + ? '#2a3f5f' + : '#fff', + color: darkMode ? '#ffffff' : '#000', // Changed to pure white + cursor: 'pointer', + }), + placeholder: base => ({ + ...base, + color: darkMode ? '#ffffff' : '#6c757d', // Changed to pure white + opacity: 0.7, // Kept the opacity so it still looks like a placeholder + }), + multiValue: base => ({ + ...base, + backgroundColor: darkMode ? '#3a506b' : '#e9ecef', + }), + multiValueLabel: base => ({ + ...base, + color: darkMode ? '#ffffff' : '#000', // Changed to pure white + }), + multiValueRemove: base => ({ + ...base, + color: darkMode ? '#ffffff' : '#000', // Changed to pure white + ':hover': { + backgroundColor: 'red', + color: 'white', + }, + }), +}); + function EDailyActivityLog(props) { const dispatch = useDispatch(); - /* redux slices */ const bmProjects = useSelector(s => s.bmProjects || []); const equipments = useSelector(s => s.bmEquipments?.equipmentslist || []); const darkMode = useSelector(state => state.theme.darkMode); const { user } = props.auth; - /* local state */ const [selectedProject, setSelectedProject] = useState(null); const [date, setDate] = useState(getToday()); const [logType, setLogType] = useState('check-in'); // 'check-in' | 'check-out' @@ -82,14 +143,12 @@ function EDailyActivityLog(props) { dispatch(fetchBMProjects()); }, [dispatch]); - /* fetch equipments whenever project changes */ useEffect(() => { if (selectedProject?.value) { dispatch(fetchAllEquipments(selectedProject.value)); } }, [selectedProject, dispatch]); - /* build rows whenever equipments slice updates */ const derived = useMemo(() => buildRows(equipments), [equipments]); useEffect(() => setRows(derived), [derived]); @@ -145,12 +204,12 @@ function EDailyActivityLog(props) { dispatch(updateMultipleEquipmentLogs(selectedProject.value, payload)); }; + const projectSelectStyles = getSelectStyles(darkMode, false); + const tableSelectStyles = getSelectStyles(darkMode, true); + return ( -
- {/* Custom dark mode table row and header hover style: dark background, light text */} +
+ {/* Custom dark mode styling for native date pickers and specific table hovers */} {darkMode && ( )} - {/* Also add light mode styles */} {!darkMode && (