diff --git a/frontend/src/components/DownloadCenter.tsx b/frontend/src/components/DownloadCenter.tsx index 5d73434..6b7137e 100644 --- a/frontend/src/components/DownloadCenter.tsx +++ b/frontend/src/components/DownloadCenter.tsx @@ -31,6 +31,7 @@ import { useMe } from "../lib/useMe"; import { api, type DownloadJob } from "../lib/api"; import { invalidateDownloads } from "../lib/downloads"; import { notify } from "../lib/notifications"; +import { copyText } from "../lib/clipboard"; import { formatBytes, formatDuration, formatEta, formatSpeed } from "../lib/format"; import { inputCls } from "./ui/form"; @@ -129,10 +130,9 @@ function displayUrl(url: string): string { function SourceRef({ url }: { url: string }) { const { t } = useTranslation(); const copy = async () => { - try { - await navigator.clipboard.writeText(url); + if (await copyText(url)) { notify({ level: "success", message: t("downloads.source.copied") }); - } catch { + } else { notify({ level: "error", message: t("downloads.source.copyFailed") }); } }; diff --git a/frontend/src/components/GlassTuner.tsx b/frontend/src/components/GlassTuner.tsx index 4b28d92..70e84d2 100644 --- a/frontend/src/components/GlassTuner.tsx +++ b/frontend/src/components/GlassTuner.tsx @@ -1,5 +1,6 @@ import { useEffect, useMemo, useState } from "react"; import Overlay from "./Overlay"; +import { copyText } from "../lib/clipboard"; import { usePrefs } from "./PrefsProvider"; /** @@ -205,11 +206,11 @@ export default function GlassTuner() { return lines.length ? `${scope} {\n${lines.join("\n")}\n}` : "/* all values at defaults */"; }, [vars, palette, themeTick]); - function copy() { - navigator.clipboard?.writeText(cssOut).then(() => { + async function copy() { + if (await copyText(cssOut)) { setCopied(true); setTimeout(() => setCopied(false), 1200); - }); + } } function persistOpen(v: boolean) { diff --git a/frontend/src/components/PlayerModal.tsx b/frontend/src/components/PlayerModal.tsx index dedff98..7d8460a 100644 --- a/frontend/src/components/PlayerModal.tsx +++ b/frontend/src/components/PlayerModal.tsx @@ -601,7 +601,7 @@ export default function PlayerModal({ playlist). Each strip sits just outside the card, spans its full height, and fades out at the ends. stopPropagation so a click steps instead of closing. Hidden on narrow screens where there's no room beside the card. */} -
+
{hasQueue && (