diff --git a/frontend/src/components/AddCarButton.tsx b/frontend/src/components/AddCarButton.tsx new file mode 100644 index 0000000..3959320 --- /dev/null +++ b/frontend/src/components/AddCarButton.tsx @@ -0,0 +1,39 @@ +import React from "react"; +import AddCar from "../pages/AddCar"; +import { DriverWithVandC } from "../types/datatypes"; + +const AddCarButton = ({ + activeSection, + driver, + vehicleModalActive, + setVehicleModalActive, +}: { + activeSection: string; + driver: DriverWithVandC; + vehicleModalActive: boolean; + setVehicleModalActive: React.Dispatch>; +}) => { + const handleAddVehicle = () => { + setVehicleModalActive(true); + }; + return ( + <> + {activeSection === "vehicle" && ( + + )} + {vehicleModalActive && ( + + )} + + ); +}; + +export default AddCarButton; diff --git a/frontend/src/pages/HomePage.tsx b/frontend/src/pages/HomePage.tsx index a865252..7543563 100644 --- a/frontend/src/pages/HomePage.tsx +++ b/frontend/src/pages/HomePage.tsx @@ -59,7 +59,7 @@ const HomePage = () => { {/* Typewriter animation */}
-

+

Thank you for registering as a driver. Our team is reviewing your details to validate your registration.

diff --git a/frontend/src/pages/ViewProfile.tsx b/frontend/src/pages/ViewProfile.tsx index b7f73e7..5c0498b 100644 --- a/frontend/src/pages/ViewProfile.tsx +++ b/frontend/src/pages/ViewProfile.tsx @@ -9,7 +9,7 @@ import useGetDriver from "../hooks/driver-hooks/useGetDriver"; import { AuthContextType } from "../types/user.types"; import useAuth from "../hooks/context-hooks/useAuth"; import Loading from "../components/Loading"; -import AddCar from "./AddCar"; +import AddCarButton from "../components/AddCarButton"; const ViewProfile = () => { const { driverId } = useParams<{ driverId: string }>(); @@ -18,10 +18,6 @@ const ViewProfile = () => { const { auth }: AuthContextType = useAuth(); const [vehicleModalActive, setVehicleModalActive] = useState(false); - const handleAddVehicle = () => { - setVehicleModalActive(true); - }; - if (loading) { return ; } @@ -76,26 +72,13 @@ const ViewProfile = () => { )}
- {activeSection === "vehicle" && ( - - )} - {activeSection === "violation" && ( - - )} - - {vehicleModalActive && ( - - )} + ); };