0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 16:22:44 +00:00

Merge branch 'master' into addAdminFixScriptTool-#3801

This commit is contained in:
G.Ambatte
2024-11-10 19:34:17 +13:00
committed by GitHub
3 changed files with 90 additions and 79 deletions

View File

@@ -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 }) {
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 (
<dialog ref={dialogRef} onCancel={dismiss} {...rest}>
{rest.children}