mirror of
https://github.com/wukko/cobalt.git
synced 2025-06-13 05:37:44 +02:00
web: add haptics for all copy actions
& prevent spamming the copy action along with haptic feedback :3 should probably unify all of this cuz this is really messy
This commit is contained in:
@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { page } from "$app/stores";
|
||||
import { t } from "$lib/i18n/translations";
|
||||
import { copyURL } from "$lib/download";
|
||||
import { t } from "$lib/i18n/translations";
|
||||
import { hapticConfirm } from "$lib/haptics";
|
||||
|
||||
import CopyIcon from "$components/misc/CopyIcon.svelte";
|
||||
|
||||
@ -40,8 +41,11 @@
|
||||
? $t("button.copied")
|
||||
: $t(`button.copy${copyData ? "" : ".section"}`)}
|
||||
on:click={() => {
|
||||
copied = true;
|
||||
copyURL(copyData || sectionURL);
|
||||
if (!copied) {
|
||||
copyURL(copyData || sectionURL);
|
||||
hapticConfirm();
|
||||
copied = true;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<CopyIcon check={copied} regularIcon={!!copyData} />
|
||||
|
Reference in New Issue
Block a user