imporved mobile styling and started dependecy injection for backend

This commit is contained in:
subnub
2024-07-02 12:17:34 -04:00
parent 9bdad8cc94
commit 09cb81f96d
14 changed files with 774 additions and 42 deletions
+15 -7
View File
@@ -30,7 +30,10 @@ export const useUtils = () => {
return { isHome, isTrash, isMedia, isSettings };
};
export const useClickOutOfBounds = (outOfBoundsCallback: (e: any) => any) => {
export const useClickOutOfBounds = (
outOfBoundsCallback: (e: any) => any,
shouldCheck = true
) => {
const wrapperRef = useRef<HTMLDivElement>(null);
// TODO: Remove this any
const outOfBoundsClickCheck = useCallback(
@@ -44,15 +47,20 @@ export const useClickOutOfBounds = (outOfBoundsCallback: (e: any) => any) => {
useEffect(() => {
console.log("useeffect");
document.addEventListener("mousedown", outOfBoundsClickCheck);
document.addEventListener("touchstart", outOfBoundsClickCheck);
return () => {
console.log("remove listener");
if (shouldCheck) {
document.addEventListener("mousedown", outOfBoundsClickCheck);
document.addEventListener("touchstart", outOfBoundsClickCheck);
} else {
document.removeEventListener("mousedown", outOfBoundsClickCheck);
document.removeEventListener("touchstart", outOfBoundsClickCheck);
}
return () => {
if (shouldCheck) {
document.removeEventListener("mousedown", outOfBoundsClickCheck);
document.removeEventListener("touchstart", outOfBoundsClickCheck);
}
};
}, [outOfBoundsCallback, outOfBoundsClickCheck]);
}, [outOfBoundsCallback, outOfBoundsClickCheck, shouldCheck]);
return {
wrapperRef,