mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-07 14:04:10 +03:00
18 lines
420 B
TypeScript
18 lines
420 B
TypeScript
import copy from "copy-to-clipboard";
|
|
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);
|
|
toast.success(t("toast.copyUrlToClipboard", { ns: "common" }), {
|
|
position: "top-center",
|
|
});
|
|
}
|
|
}
|