diff --git a/ng-app/src/lib/components/CopyToClipboard.svelte b/ng-app/src/lib/components/CopyToClipboard.svelte index 586a158..3c057cc 100644 --- a/ng-app/src/lib/components/CopyToClipboard.svelte +++ b/ng-app/src/lib/components/CopyToClipboard.svelte @@ -11,7 +11,8 @@ -
+

{$t("pages.scan_qr.scanning")}

diff --git a/ng-app/src/routes/WalletInfo.svelte b/ng-app/src/routes/WalletInfo.svelte index 799147b..01fd3ff 100644 --- a/ng-app/src/routes/WalletInfo.svelte +++ b/ng-app/src/routes/WalletInfo.svelte @@ -28,6 +28,7 @@ Link, Camera, CheckBadge, + ExclamationTriangle, } from "svelte-heros-v2"; import { onDestroy, onMount, tick } from "svelte"; import { Sidebar, SidebarGroup, SidebarWrapper } from "flowbite-svelte"; @@ -43,8 +44,7 @@ } from "../store"; import { default as ng } from "../api"; - - let WebQRScannerClassPromise: Promise; + import CopyToClipboard from "../lib/components/CopyToClipboard.svelte"; let tauri_platform = import.meta.env.TAURI_PLATFORM; let error; @@ -55,12 +55,13 @@ let sub_menu: "scan_qr" | "generate_qr" | "text_code" | null = null; - let generation_state: "loading" | "generated" | null = null; - let generated_qr: string | undefined = undefined; + let generation_state: "before_start" | "loading" | "generated" = + "before_start"; + let generated_qr: string | undefined = undefined; let generated_text_code: string | null = null; - let scanner_state: null | "scanned" | "success" = null; + let scanner_state: "before_start" | "scanned" | "success" = "before_start"; async function scrollToTop() { await tick(); @@ -85,19 +86,19 @@ async function open_gen_menu() { sub_menu = "generate_qr"; - generation_state = null; + generation_state = "before_start"; } function open_textcode_menu() { sub_menu = "text_code"; - scanner_state = null; + scanner_state = "before_start"; } async function generate_qr_code() { generation_state = "loading"; generated_qr = await ng.wallet_export_get_qrcode( $active_session.session_id, - container.clientWidth + Math.ceil(container.clientWidth * 0.9) ); generation_state = "generated"; } @@ -129,7 +130,8 @@ sub_menu = null; generated_qr = undefined; generated_text_code = null; - generation_state = null; + generation_state = "before_start"; + scanner_state = "before_start"; } let downloading = false; @@ -399,7 +401,7 @@ - -
  • - {@html $t("pages.wallet_info.scan_qr.notes")} -
  • - - - {#if !$online} + {#if scanner_state === "before_start"} +
  • - - {@html $t("wallet_sync.offline_warning")} - + {@html $t("pages.wallet_info.scan_qr.notes")} +
    + {@html $t("wallet_sync.server_transfer_notice")}
  • - {/if} - {#if !scanner_state} + + {#if !$online} +
  • + + {@html $t("wallet_sync.offline_warning")} + +
  • + {/if} + + {:else if generation_state === "loading"} + {:else}
    @@ -534,8 +536,8 @@ {$t("buttons.back")} - -
    + +
    {@html $t("wallet_sync.textcode.usage_warning")} @@ -543,35 +545,32 @@ {#if !$online} -
  • +
  • {@html $t("wallet_sync.offline_warning")}
  • {/if} - {#if generation_state !== "generated"} - - {:else} - -
    -