From 1519e2ad931ca73c93d91cfe5f5d501f21dd2647 Mon Sep 17 00:00:00 2001 From: jaanvi Date: Mon, 31 Mar 2025 10:12:42 +0530 Subject: [PATCH] Resolve minor issues --- .../AddEditUserModel/styled.css.tsx | 5 +-- src/components/CustomTable/index.tsx | 5 ++- src/components/EditStationModal/index.tsx | 2 +- .../Modals/StationViewModal/index.tsx | 2 +- src/pages/Auth/Login/index.tsx | 4 +- src/pages/StationList/index.tsx | 38 ++++++++++--------- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/components/AddEditUserModel/styled.css.tsx b/src/components/AddEditUserModel/styled.css.tsx index 7bd3874..ebed712 100644 --- a/src/components/AddEditUserModel/styled.css.tsx +++ b/src/components/AddEditUserModel/styled.css.tsx @@ -3,7 +3,7 @@ import { IconButton, TextField } from "@mui/material"; export const CustomIconButton = styled(IconButton)({ backgroundColor: "transparent", "&:hover": { - backgroundColor: "#272727", + backgroundColor: "transparent", }, "*:where([data-mui-color-scheme='dark']) &": { backgroundColor: "transparent", @@ -20,7 +20,4 @@ export const CustomTextField = styled(TextField)({ "& .MuiInputBase-root.Mui-focused .MuiInputBase-input::placeholder": { color: "darkgray", }, - }); - - diff --git a/src/components/CustomTable/index.tsx b/src/components/CustomTable/index.tsx index 4eda242..9d9703d 100644 --- a/src/components/CustomTable/index.tsx +++ b/src/components/CustomTable/index.tsx @@ -34,7 +34,7 @@ import { CustomIconButton } from "../AddEditUserModel/styled.css.tsx"; import ManagerViewModal from "../Modals/ViewManagerModal"; import UserViewModal from "../Modals/UserViewModal/index.tsx"; import { deleteUser, userList } from "../../redux/slices/userSlice.ts"; -import { deleteStation } from "../../redux/slices/stationSlice.ts"; +import { deleteStation, stationList } from "../../redux/slices/stationSlice.ts"; import StationViewModal from "../Modals/StationViewModal/index.tsx"; import { deleteSlot, @@ -183,6 +183,9 @@ const CustomTable: React.FC = ({ case "slots": dispatch(fetchAvailableSlots()); break; + case "station": + dispatch(stationList()); + break; default: console.error("Unknown table type:", tableType); return; diff --git a/src/components/EditStationModal/index.tsx b/src/components/EditStationModal/index.tsx index 12d671e..11fdc3b 100644 --- a/src/components/EditStationModal/index.tsx +++ b/src/components/EditStationModal/index.tsx @@ -132,7 +132,7 @@ const EditStationModal: React.FC = ({ ); handleClose(); reset(); - setSelectedBrands([]); // Reset brands after submit + //setSelectedBrands([]); // Reset brands after submit setSelectedVehicles([]); // Reset selected vehicles }; diff --git a/src/components/Modals/StationViewModal/index.tsx b/src/components/Modals/StationViewModal/index.tsx index b47ac08..9efc2a0 100644 --- a/src/components/Modals/StationViewModal/index.tsx +++ b/src/components/Modals/StationViewModal/index.tsx @@ -8,7 +8,7 @@ type Props = { open: boolean; setViewModal: Function; handleView: (id: string | undefined) => void; - id?: number | undefined; + id?: string | undefined; }; const style = { diff --git a/src/pages/Auth/Login/index.tsx b/src/pages/Auth/Login/index.tsx index 2a341b6..a9f82ff 100644 --- a/src/pages/Auth/Login/index.tsx +++ b/src/pages/Auth/Login/index.tsx @@ -330,9 +330,7 @@ export default function Login(props: { disableCustomTheme?: boolean }) { ? "error" : "primary" } - onMouseDown={ - togglePasswordVisibility - } + InputProps={{ endAdornment: ( diff --git a/src/pages/StationList/index.tsx b/src/pages/StationList/index.tsx index 549b10c..67dae63 100644 --- a/src/pages/StationList/index.tsx +++ b/src/pages/StationList/index.tsx @@ -2,7 +2,12 @@ import { Chip } from "@mui/material"; import AddStationModal from "../../components/AddStationModal"; import CustomTable, { Column } from "../../components/CustomTable"; import EditStationModal from "../../components/EditStationModal"; -import { createStation, stationList, toggleStatus, updateStation } from "../../redux/slices/stationSlice"; +import { + createStation, + stationList, + toggleStatus, + updateStation, +} from "../../redux/slices/stationSlice"; import { useEffect, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { RootState } from "../../redux/reducers"; @@ -20,14 +25,13 @@ export default function StationList() { const [rowData, setRowData] = useState(null); const [searchTerm, setSearchTerm] = useState(""); const dispatch = useDispatch(); + + const vehicles = useSelector( + (state: RootState) => state.vehicleReducer.vehicles + ); const stations = useSelector( (state: RootState) => state.stationReducer.stations ); - const vehicles = useSelector( - (state: RootState) => state.vehicleReducer.vehicles - ); - - useEffect(() => { dispatch(stationList()); }, [dispatch]); @@ -84,23 +88,21 @@ export default function StationList() { } }; - const handleStatusToggle = async (id: string, newStatus: number) => { await dispatch(toggleStatus({ id, status: newStatus })); }; - const filterStations = Array.isArray(stations) - ? stations.filter((station) => - station.name - .toLocaleLowerCase() - .includes(searchTerm.toLowerCase()) - ) - : []; - + // const filterStations = Array.isArray(stations) + // ? stations.filter((station) => + // station.name + // .toLocaleLowerCase() + // .includes(searchTerm.toLowerCase()) + // ) + // : []; // Mapping and formatting vehicles - const categoryRows = filterStations?.length - ? filterStations?.map((station: any, index: number) => { + const categoryRows = stations?.length + ? stations?.map((station: any, index: number) => { // Format the selected vehicles from the allowedCars array const formattedVehicles = station.allowedCars?.map( (car: any) => car.name @@ -128,7 +130,7 @@ export default function StationList() { }; }) : []; - console.log("Rowssss",categoryRows) + console.log("Rowssss", categoryRows); const categoryColumns: Column[] = [ { id: "srno", label: "Sr No" },