From 2e8368d08c43dfb647331be5ae24963263e65dee Mon Sep 17 00:00:00 2001 From: Gazook89 Date: Fri, 8 Nov 2024 21:56:35 -0600 Subject: [PATCH 1/2] give dismisskeys a default --- client/components/dialog.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/dialog.jsx b/client/components/dialog.jsx index 9e88afa33..c08cb539b 100644 --- a/client/components/dialog.jsx +++ b/client/components/dialog.jsx @@ -2,7 +2,7 @@ import React from "react"; const { useRef, useEffect } = React; -function Dialog({ dismisskeys, closeText = 'Close', blocking = false, ...rest }) { +function Dialog({ dismisskeys = [], closeText = 'Close', blocking = false, ...rest }) { const dialogRef = useRef(null); useEffect(()=>{ From b7b1981bdefcab631ea57de20a9a3c5fe8f75190 Mon Sep 17 00:00:00 2001 From: Gazook89 Date: Fri, 8 Nov 2024 21:56:45 -0600 Subject: [PATCH 2/2] lint --- client/components/dialog.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/components/dialog.jsx b/client/components/dialog.jsx index c08cb539b..0cdda2dee 100644 --- a/client/components/dialog.jsx +++ b/client/components/dialog.jsx @@ -1,25 +1,25 @@ // Dialog box, for popups and modal blocking messages -import React from "react"; +import React from 'react'; const { useRef, useEffect } = React; function Dialog({ dismisskeys = [], closeText = 'Close', blocking = false, ...rest }) { const dialogRef = useRef(null); useEffect(()=>{ - if (dismisskeys.length !== 0) { + if(dismisskeys.length !== 0) { blocking ? dialogRef.current?.showModal() : dialogRef.current?.show(); } }, [dialogRef.current, dismisskeys]); - const dismiss = () => { - dismisskeys.forEach(key => { - if (key) { + const dismiss = ()=>{ + dismisskeys.forEach((key)=>{ + if(key) { localStorage.setItem(key, 'true'); } }); dialogRef.current?.close(); }; - + return ( {rest.children}