diff --git a/src/components/SettingForms/System/Upload.ts b/src/components/SettingForms/System/Upload.ts index 1403722..39123e0 100644 --- a/src/components/SettingForms/System/Upload.ts +++ b/src/components/SettingForms/System/Upload.ts @@ -14,9 +14,6 @@ export async function sendBlobFileUpload({ file, opts }: BlobFileUpload): Promis if (!file) throw new Error("No file supplied"); if (!opts?.uploadUrl) throw new Error("No URL supplied"); - if (file?.type !== "text/csv") { - throw new Error("This file is not supported, please upload a CSV file."); - } const timeoutMs = opts?.timeoutMs ?? 30000; const fieldName = opts?.fieldName ?? "upload"; const fileName = opts?.overrideFileName ?? file?.name; diff --git a/src/components/SettingForms/WiFi&Modem/WiFiSettingsForm.tsx b/src/components/SettingForms/WiFi&Modem/WiFiSettingsForm.tsx index aa2aa71..457482f 100644 --- a/src/components/SettingForms/WiFi&Modem/WiFiSettingsForm.tsx +++ b/src/components/SettingForms/WiFi&Modem/WiFiSettingsForm.tsx @@ -5,6 +5,7 @@ import { useWifiAndModem } from "../../../hooks/useCameraWifiandModem"; import { useState } from "react"; import { faEyeSlash, faEye } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { toast, Toaster } from "sonner"; const WiFiSettingsForm = () => { const [showPwd, setShowPwd] = useState(false); @@ -19,6 +20,13 @@ const WiFiSettingsForm = () => { encryption: "WPA2", }; + const validatePassword = (password: string) => { + if (password.length < 8) { + toast.error("Password must be at least 8 characters long", { id: "password" }); + return "Password must be at least 8 characters long"; + } + }; + const handleSubmit = async (values: WifiSettingValues) => { const wifiConfig = { id: "ModemAndWifiManager-wifi", @@ -37,66 +45,71 @@ const WiFiSettingsForm = () => { await wifiMutation.mutateAsync(wifiConfig); }; return ( - - {({ isSubmitting }) => ( - - - - SSID - - - - - - Password - - + <> + + {({ isSubmitting }) => ( + + + + SSID + - setShowPwd((s) => !s)} - icon={showPwd ? faEyeSlash : faEye} - /> - - - - - WPA/Encryption Type - - + + + Password + + + + + setShowPwd((s) => !s)} + icon={showPwd ? faEyeSlash : faEye} + /> + + + + + WPA/Encryption Type + + + WPA2 + WPA3 + WEP + None + + + - WPA2 - WPA3 - WEP - None - - - - {isSubmitting || wifiMutation.isPending ? "Saving..." : " Save WiFi settings"} - - - )} - + {isSubmitting || wifiMutation.isPending ? "Saving..." : " Save WiFi settings"} + + + )} + + + > ); };