frigate/web/src/utils/browserUtil.ts

18 lines
402 B
TypeScript
Raw Normal View History

import copy from "copy-to-clipboard";
2025-03-14 20:10:32 +03:00
import { t } from "i18next";
import { toast } from "sonner";
export function shareOrCopy(url: string, title?: string) {
if (window.isSecureContext && "share" in navigator) {
navigator.share({
url: url,
title: title,
});
} else {
copy(url);
2025-03-14 20:10:32 +03:00
toast.success(t("toast.copyUrlToClipboard"), {
position: "top-center",
});
}
}