mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-02 16:23:48 +03:00
Merge branch 'main' of https://github.com/hydralauncher/hydra into refactor/change-game-delete-to-soft-delete
This commit is contained in:
commit
22354f6cb5
@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useId, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import { XIcon } from "@primer/octicons-react";
|
import { XIcon } from "@primer/octicons-react";
|
||||||
|
|
||||||
@ -24,9 +24,8 @@ export function Modal({
|
|||||||
const [isClosing, setIsClosing] = useState(false);
|
const [isClosing, setIsClosing] = useState(false);
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const modalContentRef = useRef<HTMLDivElement | null>(null);
|
const modalContentRef = useRef<HTMLDivElement | null>(null);
|
||||||
const componentId = useId();
|
|
||||||
|
|
||||||
const handleCloseClick = () => {
|
const handleCloseClick = useCallback(() => {
|
||||||
setIsClosing(true);
|
setIsClosing(true);
|
||||||
const zero = performance.now();
|
const zero = performance.now();
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ export function Modal({
|
|||||||
setIsClosing(false);
|
setIsClosing(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}, [onClose]);
|
||||||
|
|
||||||
const isTopMostModal = () => {
|
const isTopMostModal = () => {
|
||||||
const openModals = document.querySelectorAll("[role=modal]");
|
const openModals = document.querySelectorAll("[role=modal]");
|
||||||
@ -57,7 +56,7 @@ export function Modal({
|
|||||||
|
|
||||||
window.addEventListener("keydown", onKeyDown);
|
window.addEventListener("keydown", onKeyDown);
|
||||||
return () => window.removeEventListener("keydown", onKeyDown);
|
return () => window.removeEventListener("keydown", onKeyDown);
|
||||||
}, []);
|
}, [handleCloseClick]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onMouseDown = (e: MouseEvent) => {
|
const onMouseDown = (e: MouseEvent) => {
|
||||||
@ -74,7 +73,7 @@ export function Modal({
|
|||||||
|
|
||||||
window.addEventListener("mousedown", onMouseDown);
|
window.addEventListener("mousedown", onMouseDown);
|
||||||
return () => window.removeEventListener("mousedown", onMouseDown);
|
return () => window.removeEventListener("mousedown", onMouseDown);
|
||||||
}, []);
|
}, [handleCloseClick]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(toggleDragging(visible));
|
dispatch(toggleDragging(visible));
|
||||||
|
Loading…
Reference in New Issue
Block a user