diff --git a/package.json b/package.json index 3ffc1cd..438c54f 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "react-router": "^7.8.0", "react-swipeable": "^7.0.2", "react-tabs": "^6.1.0", + "sonner": "^2.0.7", "tailwindcss": "^4.1.11" }, "devDependencies": { diff --git a/src/components/CameraSettings/CameraSettingFields.tsx b/src/components/CameraSettings/CameraSettingFields.tsx index f9b99f6..3d6bdf6 100644 --- a/src/components/CameraSettings/CameraSettingFields.tsx +++ b/src/components/CameraSettings/CameraSettingFields.tsx @@ -3,6 +3,7 @@ import type { CameraSettingErrorValues, CameraSettingValues, } from "../../types/types"; +import { toast } from "sonner"; const CameraSettingFields = () => { const initialValues: CameraSettingValues = { @@ -24,6 +25,7 @@ const CameraSettingFields = () => { const handleSubmit = (values: CameraSettingValues) => { // post values to endpoint + toast("Settings Saved"); console.log(values); }; diff --git a/src/components/SettingForms/NPED/NPEDCard.tsx b/src/components/SettingForms/NPED/NPEDCard.tsx index c55acef..e7f222f 100644 --- a/src/components/SettingForms/NPED/NPEDCard.tsx +++ b/src/components/SettingForms/NPED/NPEDCard.tsx @@ -1,10 +1,12 @@ import Card from "../../UI/Card"; import CardHeader from "../../UI/CardHeader"; +import NPEDFields from "./NPEDFields"; const NPEDCard = () => { return ( - + + ); }; diff --git a/src/components/SettingForms/NPED/NPEDFields.tsx b/src/components/SettingForms/NPED/NPEDFields.tsx index e69de29..cc4d33f 100644 --- a/src/components/SettingForms/NPED/NPEDFields.tsx +++ b/src/components/SettingForms/NPED/NPEDFields.tsx @@ -0,0 +1,60 @@ +import { Form, Formik, Field } from "formik"; +import FormGroup from "../components/FormGroup"; +import type { NPEDFieldType } from "../../../types/types"; + +const NPEDFields = () => { + const initialValues = { + username: "", + password: "", + clientId: "", + }; + + const handleSubmit = (values: NPEDFieldType) => { + alert(JSON.stringify(values)); + }; + + return ( + + + + Username + + + + Password + + + + Client ID + + + + Login + + + + ); +}; + +export default NPEDFields; diff --git a/src/components/SettingForms/NPED/NPEDHotlist.tsx b/src/components/SettingForms/NPED/NPEDHotlist.tsx new file mode 100644 index 0000000..7e07e8d --- /dev/null +++ b/src/components/SettingForms/NPED/NPEDHotlist.tsx @@ -0,0 +1,49 @@ +import { Form, Formik } from "formik"; +import type { HotlistUploadType } from "../../../types/types"; + +const NPEDHotlist = () => { + const initialValue = { + file: null, + }; + + const handleSubmit = (values: HotlistUploadType) => console.log(values.file); + + return ( + + {({ setFieldValue, setErrors, errors }) => { + return ( + + { + if (e.target.files) { + if (e.target.files[0].type !== "text/csv") { + setErrors({ + file: "This file is not a CSV, please select a different one", + }); + + return; + } + setFieldValue("file", e.target.files[0]); + } + }} + /> + + Upload + + {errors && errors.file} + + ); + }} + + ); +}; + +export default NPEDHotlist; diff --git a/src/components/SettingForms/NPED/NPEDHotlistCard.tsx b/src/components/SettingForms/NPED/NPEDHotlistCard.tsx new file mode 100644 index 0000000..92582e0 --- /dev/null +++ b/src/components/SettingForms/NPED/NPEDHotlistCard.tsx @@ -0,0 +1,14 @@ +import Card from "../../UI/Card"; +import CardHeader from "../../UI/CardHeader"; +import NPEDHotlist from "./NPEDHotlist"; + +const NPEDHotlistCard = () => { + return ( + + + + + ); +}; + +export default NPEDHotlistCard; diff --git a/src/components/UI/Footer.tsx b/src/components/UI/Footer.tsx index 3cacc12..a950c87 100644 --- a/src/components/UI/Footer.tsx +++ b/src/components/UI/Footer.tsx @@ -2,7 +2,7 @@ import Logo from "/MAV.svg"; const Footer = () => { return ( -
{errors && errors.file}