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 @@ -->