From 4640c1c966d37b7fc22e4ebfcb244d03da1d6d82 Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Thu, 18 Apr 2024 06:14:28 -0400 Subject: [PATCH 1/3] hotfix --- lib/api/archiveHandler.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/api/archiveHandler.ts b/lib/api/archiveHandler.ts index 08a35b5..aaf1c98 100644 --- a/lib/api/archiveHandler.ts +++ b/lib/api/archiveHandler.ts @@ -58,7 +58,10 @@ export default async function archiveHandler(link: LinksAndCollectionAndOwner) { ? await validateUrlSize(link.url) : undefined; - if (validatedUrl === null) + if ( + validatedUrl === null && + process.env.IGNORE_URL_SIZE_LIMIT !== "true" + ) throw "Something went wrong while retrieving the file size."; const contentType = validatedUrl?.get("content-type"); From 8278878673126e7c2fe98df76783a4ac4a6c78ac Mon Sep 17 00:00:00 2001 From: QAComet Date: Thu, 18 Apr 2024 11:34:29 -0600 Subject: [PATCH 2/3] feat: add close button and data-testids to toast messages --- pages/_app.tsx | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/pages/_app.tsx b/pages/_app.tsx index b965941..3cdd0f5 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -5,7 +5,8 @@ import { SessionProvider } from "next-auth/react"; import type { AppProps } from "next/app"; import Head from "next/head"; import AuthRedirect from "@/layouts/AuthRedirect"; -import { Toaster } from "react-hot-toast"; +import toast from "react-hot-toast"; +import { Toaster, ToastBar } from "react-hot-toast"; import { Session } from "next-auth"; import { isPWA } from "@/lib/client/utils"; @@ -61,7 +62,30 @@ export default function App({ className: "border border-sky-100 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white", }} - /> + > + {(t) => ( + + {({ icon, message }) => ( +
+ {icon} + {message} + {t.type !== "loading" && ( + + )} +
+ )} +
+ )} + From b702aa04015bf96f76441892bffc203ab721040b Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Sat, 20 Apr 2024 10:49:06 -0400 Subject: [PATCH 3/3] small improvement --- components/ClickAwayHandler.tsx | 31 +++++++++++++++++++++++++------ pages/_app.tsx | 1 + 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/components/ClickAwayHandler.tsx b/components/ClickAwayHandler.tsx index 63378a1..e8e8878 100644 --- a/components/ClickAwayHandler.tsx +++ b/components/ClickAwayHandler.tsx @@ -8,19 +8,38 @@ type Props = { onMount?: (rect: DOMRect) => void; }; +function getZIndex(element: HTMLElement): number { + let zIndex = 0; + while (element) { + const zIndexStyle = window + .getComputedStyle(element) + .getPropertyValue("z-index"); + const numericZIndex = Number(zIndexStyle); + if (zIndexStyle !== "auto" && !isNaN(numericZIndex)) { + zIndex = numericZIndex; + break; + } + element = element.parentElement as HTMLElement; + } + return zIndex; +} + function useOutsideAlerter( ref: RefObject, onClickOutside: Function ) { useEffect(() => { - function handleClickOutside(event: Event) { - if ( - ref.current && - !ref.current.contains(event.target as HTMLInputElement) - ) { - onClickOutside(event); + function handleClickOutside(event: MouseEvent) { + const clickedElement = event.target as HTMLElement; + if (ref.current && !ref.current.contains(clickedElement)) { + const refZIndex = getZIndex(ref.current); + const clickedZIndex = getZIndex(clickedElement); + if (clickedZIndex <= refZIndex) { + onClickOutside(event); + } } } + document.addEventListener("mousedown", handleClickOutside); return () => { document.removeEventListener("mousedown", handleClickOutside); diff --git a/pages/_app.tsx b/pages/_app.tsx index 3cdd0f5..0ece19d 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -75,6 +75,7 @@ export default function App({ {message} {t.type !== "loading" && (