diff --git a/frontend/__test__/pages/LoginPage.test.tsx b/frontend/__test__/pages/LoginPage.test.tsx index 34a663a..9f09890 100644 --- a/frontend/__test__/pages/LoginPage.test.tsx +++ b/frontend/__test__/pages/LoginPage.test.tsx @@ -17,9 +17,9 @@ describe("registered user login, register as a driver", () => { (useLogin as Mock).mockReturnValue({ loading: false, submitLogin: vi.fn(), - }); - }); - it("should show the text 'Log in to the monitor'", async () => { + }) + }) + it("should render the sign up button'", async () => { render(, { wrapper: BrowserRouter }); const signUpButtonElement = await screen.findByTestId("signup-button"); diff --git a/frontend/src/pages/AddViolationPage.tsx b/frontend/src/pages/AddViolationPage.tsx index 58cc438..da60502 100644 --- a/frontend/src/pages/AddViolationPage.tsx +++ b/frontend/src/pages/AddViolationPage.tsx @@ -2,17 +2,17 @@ import { useNavigate } from "react-router-dom"; import AdminHeader from "../components/AdminHeader"; import { useState } from "react"; import { toast } from "react-toastify"; -import useCheckLicenseNumber from "../hooks/car-hooks/useCheckLicenseNumber"; // import the hook +import useCheckLicenseNumber from "../hooks/car-hooks/useCheckLicenseNumber"; import { DriverWithVandC } from "../types/datatypes"; import AddViolationComponent from "../components/AddViolationComponent"; const AddViolation = () => { const navigate = useNavigate(); - const { checkLicenseNumber, loading } = useCheckLicenseNumber(); // using the hook + const { checkLicenseNumber, loading } = useCheckLicenseNumber(); const [currentStep, setCurrentStep] = useState(1); const [licenseNumber, setLicenseNumber] = useState(""); - const [driverProfile, setDriverProfile] = useState(); // Store the driver profile + const [driverProfile, setDriverProfile] = useState(); const [violationModalActive, setViolationModalActive] = useState(false); const handleCancelButton = () => { @@ -38,70 +38,61 @@ const AddViolation = () => { }; return ( - - + + {currentStep === 1 && ( - - - - - Adding a Violation - Find the driver by searching for the license number. - + + + + Adding a Violation + Find the driver by searching for the license number. + - - - - - - License Number - - setLicenseNumber(e.target.value)} - placeholder="Enter license number" - required - /> - - - - + + + + + License Number + + setLicenseNumber(e.target.value)} + placeholder="Enter license number" + required + /> + + )} {currentStep === 2 && driverProfile && ( - - + + - Driver Found - Driver details are shown below. + Driver Found + Driver details are shown below. - - - - - - Last Name - - + + + + + Last Name + {driverProfile.last_name} - - - - First Name - - + + First Name + {driverProfile.first_name} @@ -112,41 +103,27 @@ const AddViolation = () => { {driverProfile.sex} - - - - - - Date of Birth - - + + Date of Birth + {driverProfile.date_of_birth} - - - Driver Type - - + + Driver Type + {driverProfile.driver_type} - - - - - - License Number - - + + License Number + {driverProfile.license_number} - - - License Expiration Date - - + + License Expiration Date + {driverProfile.license_expiration_date} @@ -157,41 +134,35 @@ const AddViolation = () => { )} - {currentStep === 1 && ( - - + + {currentStep === 1 && ( + <> + className="w-32 bg-buttongreen font-syke-medium text-white py-2 hover:bg-[#33471a] transition-colors rounded-sm" + onClick={handleCancelButton} + > Cancel - - - + disabled={loading} + > {loading ? "Searching..." : "Search"} - - - )} - - {currentStep === 2 && ( - - + > + )} + {currentStep === 2 && ( + <> + className="w-32 bg-buttongreen font-syke-medium text-white py-2 hover:bg-[#33471a] transition-colors rounded-sm" + onClick={handleBackClick} + > Back - - - { }; export default AddViolation; + diff --git a/frontend/src/pages/EncodePage.tsx b/frontend/src/pages/EncodePage.tsx index 706e963..5b6faed 100644 --- a/frontend/src/pages/EncodePage.tsx +++ b/frontend/src/pages/EncodePage.tsx @@ -20,18 +20,18 @@ const EncodePage = () => { What would you like to do? - + - + className="flex items-center justify-center w-72 h-40 rounded-lg cursor-pointer hover:border-textgreen hover:border-4 transition-all bg-secondgrey text-buttongreen hover:text-textgreen" + onClick={handleAddDriverButton}> + + Add Driver - {/* Add Violation Button */}
Find the driver by searching for the license number.
Driver details are shown below.