Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch connection error views when creating a new account #140

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/miner/Miner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import type { AccountEntry } from "../../accounts";
import FirstProof from "./cards/FirstProof.svelte";
import { backlogInProgress, isTowerNewbie, tower } from "../../miner";
import type {ClientTowerStatus } from "../../miner";
import { nodeEnv } from "../../debug";
import { get } from "svelte/store";
import SyncProofs from "./cards/SyncProofs.svelte";
Expand All @@ -23,7 +24,7 @@
let isDevTest = false;
let isSendInProgress = false;
let hasProofs = false;
let minerTower;
let minerTower: ClientTowerStatus;

// unsubscribe functions
let unsubsTower;
Expand Down Expand Up @@ -77,7 +78,10 @@
</div>
{/if}
<div class="uk-grid uk-margin-small">
{#if account && account.on_chain}
{#if (account && account.on_chain) ||
// so we don't get a flash of the error card on an intermittent local network connection if we are in fact mining
(minerTower && minerTower.progress.pct_complete)
}
<div class="uk-width-1-1 uk-align-center">
<ToggleMiner />
<MinerProgress tower={minerTower} />
Expand Down
127 changes: 64 additions & 63 deletions src/components/wallet/AccountFromMnemSubmit.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,16 @@
import { _ } from "svelte-i18n";
import { navigate } from "svelte-navigator";
import { responses } from "../../debug";
import {
signingAccount,
mnem,
isInit,
} from "../../accounts";
import { signingAccount, mnem, isInit } from "../../accounts";
import type { AccountEntry } from "../../accounts";
import { raise_error } from "../../carpeError";
import { invoke } from "@tauri-apps/api/tauri";
import { notify_success } from "../../carpeNotify";
import { onDestroy, onMount } from "svelte";
import { connected, refreshWaypoint } from "../../networks";
import { addNewAccount, isCarpeInit, loadAccounts } from "../../accountActions";
import { connected, scanning_fullnodes } from "../../networks";
import { addNewAccount, loadAccounts } from "../../accountActions";
import UIkit from "uikit";
import { carpeTick } from "../../tick";

export let danger_temp_mnem: string;
export let isNewAccount: boolean = true;
Expand All @@ -27,7 +24,7 @@

onDestroy(async () => {
unsubs && unsubs();
})
});

// const re = /[0-9A-Fa-f]{32}/g;

Expand Down Expand Up @@ -56,13 +53,17 @@

// set as init so we don't get sent back to Newbie account creation.
isInit.set(true);
isCarpeInit();

// refresh waypoint check connection status of `connected`.
connected.set(true); // provisionally set to true so we don't get flashed an error page.
refreshWaypoint();
scanning_fullnodes.set(false);
carpeTick()
.then(() => {
navigate("/");
})
.catch((e) => {
raise_error(e, true, "carpeTick");
});

navigate("/");
// navigate("/");
})
.catch((error) => {
if (isNewAccount) {
Expand All @@ -74,56 +75,56 @@
}
</script>

{#if isNewAccount}
<button
class="uk-button uk-button-secondary uk-margin-small-right"
disabled={isSubmitting}
type="button"
on:click|preventDefault={openConfirmationModal}
>
{$_("wallet.keygen.btn_create_account")}
</button>
{#if isNewAccount}
<button
class="uk-button uk-button-secondary uk-margin-small-right"
disabled={isSubmitting}
type="button"
on:click|preventDefault={openConfirmationModal}
>
{$_("wallet.keygen.btn_create_account")}
</button>

<div id="submit-confirmation-modal" uk-modal>
<div class="uk-modal-dialog uk-modal-body">
<h2 class="uk-modal-title uk-text-uppercase uk-text-alert">
{$_("wallet.account_from_mnem_submit.title")}
</h2>
<p>{@html $_("wallet.account_from_mnem_submit.body")}</p>
<p class="uk-text-right">
<button
class="uk-button uk-button-default uk-modal-close"
type="button"
disabled={isSubmitting}
>
<div id="submit-confirmation-modal" uk-modal>
<div class="uk-modal-dialog uk-modal-body">
<h2 class="uk-modal-title uk-text-uppercase uk-text-alert">
{$_("wallet.account_from_mnem_submit.title")}
</h2>
<p>{@html $_("wallet.account_from_mnem_submit.body")}</p>
<p class="uk-text-right">
<button
class="uk-button uk-button-default uk-modal-close"
type="button"
disabled={isSubmitting}
>
{$_("wallet.account_from_mnem_submit.btn_cancel")}
</button>
<button
class="uk-button uk-button-primary"
type="button"
disabled={isSubmitting}
on:click|preventDefault={handleAdd}
>
{#if isSubmitting}
{$_("wallet.account_from_mnem_submit.btn_submiting")}
{:else}
{$_("wallet.account_from_mnem_submit.btn_submit")}
{/if}
</button>
</p>
</div>
</button>
<button
class="uk-button uk-button-primary"
type="button"
disabled={isSubmitting}
on:click|preventDefault={handleAdd}
>
{#if isSubmitting}
{$_("wallet.account_from_mnem_submit.btn_submiting")}
{:else}
{$_("wallet.account_from_mnem_submit.btn_submit")}
{/if}
</button>
</p>
</div>
{:else}
<button
class="uk-button uk-button-primary"
type="button"
disabled={isSubmitting}
on:click|preventDefault={handleAdd}
>
{#if isSubmitting}
{$_("wallet.account_from_mnem_submit.btn_submiting")}...
{:else}
{$_("wallet.account_from_mnem_submit.btn_submit")}
{/if}
</button>
{/if}
</div>
{:else}
<button
class="uk-button uk-button-primary"
type="button"
disabled={isSubmitting}
on:click|preventDefault={handleAdd}
>
{#if isSubmitting}
{$_("wallet.account_from_mnem_submit.btn_submiting")}...
{:else}
{$_("wallet.account_from_mnem_submit.btn_submit")}
{/if}
</button>
{/if}