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,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { t } from "$lib/i18n/translations";
|
||||
import { hapticConfirm } from "$lib/haptics";
|
||||
import { copyURL, openURL } from "$lib/download";
|
||||
|
||||
import CopyIcon from "$components/misc/CopyIcon.svelte";
|
||||
@@ -27,8 +28,11 @@
|
||||
})}
|
||||
on:click={() => {
|
||||
if (type === "copy") {
|
||||
copied = true;
|
||||
copyURL(address);
|
||||
if (!copied) {
|
||||
copyURL(address);
|
||||
hapticConfirm();
|
||||
copied = true;
|
||||
}
|
||||
} else {
|
||||
openURL(address);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { device } from "$lib/device";
|
||||
import locale from "$lib/i18n/locale";
|
||||
import { t } from "$lib/i18n/translations";
|
||||
import { hapticConfirm } from "$lib/haptics";
|
||||
|
||||
import { openURL, copyURL, shareURL } from "$lib/download";
|
||||
|
||||
@@ -51,8 +52,11 @@
|
||||
id="action-button-copy"
|
||||
class="action-button"
|
||||
on:click={async () => {
|
||||
copyURL(cobaltUrl);
|
||||
copied = true;
|
||||
if (!copied) {
|
||||
copyURL(cobaltUrl);
|
||||
hapticConfirm();
|
||||
copied = true;
|
||||
}
|
||||
}}
|
||||
aria-label={copied ? $t("button.copied") : ""}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user