From c3ad6a60cc94847b0edef6cea832eabab8394388 Mon Sep 17 00:00:00 2001 From: Laurin Weger Date: Thu, 4 Jul 2024 17:19:03 +0200 Subject: [PATCH] rm copy to clipboard for tauri and fix invisible icons --- .../src/lib/components/CopyToClipboard.svelte | 90 +++++++++++-------- ng-app/src/routes/WalletCreate.svelte | 3 +- 2 files changed, 53 insertions(+), 40 deletions(-) diff --git a/ng-app/src/lib/components/CopyToClipboard.svelte b/ng-app/src/lib/components/CopyToClipboard.svelte index b30efae..49f226d 100644 --- a/ng-app/src/lib/components/CopyToClipboard.svelte +++ b/ng-app/src/lib/components/CopyToClipboard.svelte @@ -4,11 +4,21 @@ let has_success: boolean = false; + const tauri_platform = import.meta.env.TAURI_PLATFORM; + const setClipboard = async (text: string) => { + if (tauri_platform) { + // TODO: this won't work for tauri platform. + // const { writeText } = await import("@tauri-apps/api/clipboard"); + // await writeText(text); + } else { + navigator.clipboard.writeText(text); + } + }; + const on_click = (e) => { has_success = true; setTimeout(() => (has_success = false), 2_000); - - navigator.clipboard.writeText(value); + setClipboard(value); }; @@ -22,44 +32,46 @@ disabled readonly /> - + + + + + + {/if} diff --git a/ng-app/src/routes/WalletCreate.svelte b/ng-app/src/routes/WalletCreate.svelte index 2373c9b..5181901 100644 --- a/ng-app/src/routes/WalletCreate.svelte +++ b/ng-app/src/routes/WalletCreate.svelte @@ -10,6 +10,7 @@ -->