add ResetUserSettings component and integrate it into SystemConfigFields

This commit is contained in:
2026-01-07 09:52:01 +00:00
parent 71e23c7d45
commit bec28b91e1
2 changed files with 16 additions and 6 deletions

View File

@@ -8,7 +8,7 @@ import { useDNSSettings, useSystemConfig } from "../../../hooks/useSystemConfig"
import { ValidateIPaddress, isUtcOutOfSync } from "../../../utils/utils"; import { ValidateIPaddress, isUtcOutOfSync } from "../../../utils/utils";
import { toast } from "sonner"; import { toast } from "sonner";
import { useSystemStatus } from "../../../hooks/useSystemStatus"; import { useSystemStatus } from "../../../hooks/useSystemStatus";
// import ResetUserSettings from "./resetUserSettings/ResetUserSettings"; import ResetUserSettings from "./resetUserSettings/ResetUserSettings";
const SystemConfigFields = () => { const SystemConfigFields = () => {
const { saveSystemSettings, systemSettingsData, saveSystemSettingsLoading } = useSystemConfig(); const { saveSystemSettings, systemSettingsData, saveSystemSettingsLoading } = useSystemConfig();
@@ -218,7 +218,7 @@ const SystemConfigFields = () => {
> >
{hardRebootMutation.isPending || isSubmitting ? "Rebooting" : "Hardware Reboot"} {hardRebootMutation.isPending || isSubmitting ? "Rebooting" : "Hardware Reboot"}
</button> </button>
{/* <ResetUserSettings /> */} <ResetUserSettings />
</Form> </Form>
)} )}
</Formik> </Formik>

View File

@@ -1,4 +1,5 @@
import { useSoundContext } from "../../../../context/SoundContext"; import { useSoundContext } from "../../../../context/SoundContext";
import { useCameraBlackboard } from "../../../../hooks/useCameraBlackboard";
import ModalComponent from "../../../UI/ModalComponent"; import ModalComponent from "../../../UI/ModalComponent";
type ResetUserSettingsModalProps = { type ResetUserSettingsModalProps = {
@@ -10,14 +11,22 @@ const ResetUserSettingsModal = ({
isUserSettingsModalOpen, isUserSettingsModalOpen,
setIsUserSettingsModalOpen, setIsUserSettingsModalOpen,
}: ResetUserSettingsModalProps) => { }: ResetUserSettingsModalProps) => {
const { dispatch } = useSoundContext(); const { state, dispatch } = useSoundContext();
const { mutation } = useCameraBlackboard();
const handleClose = () => { const handleClose = () => {
setIsUserSettingsModalOpen(false); setIsUserSettingsModalOpen(false);
}; };
const handleResetAll = () => { const handleResetAll = async () => {
// Logic to reset all user settings goes here // Logic to reset all user settings goes here
dispatch({ type: "RESET" }); dispatch({ type: "RESET" });
await mutation.mutateAsync({
operation: "INSERT",
path: "soundSettings",
value: state,
});
handleClose(); handleClose();
}; };
return ( return (
@@ -31,9 +40,10 @@ const ResetUserSettingsModal = ({
This will <span className="font-bold">RESET ALL</span> user settings including{" "} This will <span className="font-bold">RESET ALL</span> user settings including{" "}
<span className="text-blue-400">Uploaded user sounds</span> , <span className="text-blue-400">Uploaded user sounds</span> ,
<span className="text-emerald-400"> Hotlist Sound hits</span> and{" "} <span className="text-emerald-400"> Hotlist Sound hits</span> and{" "}
<span className="text-amber-600">NPED Sound hits</span>. It will also reset any customized settings within <span className="text-amber-600">NPED Sound hits</span>.
{/* It will also reset any customized settings within
the app to their original defaults and Clear out the session data and{" "} the app to their original defaults and Clear out the session data and{" "}
<span className="text-rose-400">alert history sightings.</span> <span className="text-rose-400">alert history sightings.</span> */}
</p> </p>
</div> </div>
<div className="flex justify-end gap-4"> <div className="flex justify-end gap-4">