Reformat all project files to use the prettier config file.

This commit is contained in:
Patrick Fic
2024-03-27 15:35:07 -07:00
parent b161530381
commit e1df64d592
873 changed files with 111387 additions and 125473 deletions

View File

@@ -1,47 +1,46 @@
import {useBeforeUnload, useBlocker} from "react-router-dom";
import {useCallback, useEffect, useRef} from "react";
import { useBeforeUnload, useBlocker } from "react-router-dom";
import { useCallback, useEffect, useRef } from "react";
function usePrompt(message, {beforeUnload} = {}) {
let blocker = useBlocker(
useCallback(
(location) => {
// This has been put in, so it does not affect transitions between the same page
if (location.currentLocation.pathname === location.nextLocation.pathname) {
return false;
}
return typeof message === "string" ? !window.confirm(message) : false;
},
[message]
)
);
let prevState = useRef(blocker.state);
useEffect(() => {
if (blocker.state === "blocked") {
blocker.reset();
function usePrompt(message, { beforeUnload } = {}) {
let blocker = useBlocker(
useCallback(
(location) => {
// This has been put in, so it does not affect transitions between the same page
if (location.currentLocation.pathname === location.nextLocation.pathname) {
return false;
}
prevState.current = blocker.state;
}, [blocker]);
return typeof message === "string" ? !window.confirm(message) : false;
},
[message]
)
);
useBeforeUnload(
useCallback(
(event) => {
if (beforeUnload && typeof message === "string") {
event.preventDefault();
event.returnValue = message;
}
},
[message, beforeUnload]
),
{capture: true}
);
let prevState = useRef(blocker.state);
useEffect(() => {
if (blocker.state === "blocked") {
blocker.reset();
}
prevState.current = blocker.state;
}, [blocker]);
useBeforeUnload(
useCallback(
(event) => {
if (beforeUnload && typeof message === "string") {
event.preventDefault();
event.returnValue = message;
}
},
[message, beforeUnload]
),
{ capture: true }
);
}
function Prompt({when, message, ...props}) {
usePrompt(when ? message : false, props);
return null;
function Prompt({ when, message, ...props }) {
usePrompt(when ? message : false, props);
return null;
}
export default Prompt;
export default Prompt;