Fix logic

This commit is contained in:
Nicolas Mowen 2024-09-12 08:33:39 -06:00
parent 4cbabdcc39
commit e832ba57fe
2 changed files with 10 additions and 4 deletions

View File

@ -87,12 +87,14 @@ export default function SearchDetailDialog({
}, [config, search]); }, [config, search]);
useEffect(() => { useEffect(() => {
if (!searchTabs.includes(page)) { if (searchTabs.length == 0) {
return;
}
if (!searchTabs.includes(pageToggle)) {
setPage("details"); setPage("details");
} }
// we know that these deps are correct }, [pageToggle, searchTabs]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchTabs]);
if (!search) { if (!search) {
return; return;

View File

@ -1,4 +1,5 @@
import copy from "copy-to-clipboard"; import copy from "copy-to-clipboard";
import { toast } from "sonner";
export function shareOrCopy(url: string, title?: string) { export function shareOrCopy(url: string, title?: string) {
if (window.isSecureContext && "share" in navigator) { if (window.isSecureContext && "share" in navigator) {
@ -8,5 +9,8 @@ export function shareOrCopy(url: string, title?: string) {
}); });
} else { } else {
copy(url); copy(url);
toast.success("Copied to clipboard.", {
position: "top-center",
});
} }
} }