From f8a77d371922a21c96a424f49f264c97b39970f2 Mon Sep 17 00:00:00 2001 From: evavirseda Date: Fri, 22 Mar 2024 10:25:44 +0100 Subject: [PATCH] feat: improvements --- .../components/AccountManagementDetails.svelte | 16 +++++----------- .../desktop/views/dashboard/Dashboard.svelte | 6 +++++- packages/shared/locales/en.json | 3 ++- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/desktop/components/AccountManagementDetails.svelte b/packages/desktop/components/AccountManagementDetails.svelte index d32fe3e8ed1..5f134cd3129 100644 --- a/packages/desktop/components/AccountManagementDetails.svelte +++ b/packages/desktop/components/AccountManagementDetails.svelte @@ -54,22 +54,17 @@ $: accountId = isAccountOutput(selectedOutput) ? (selectedOutput.output as AccountOutput)?.accountId : null $: address = accountId ? AddressConverter.addressToBech32(new AccountAddress(accountId)) : null $: isMainAccount = accountId && accountId === $selectedWalletMainAccountId - $: balance = getAccountBalance(selectedOutput, isImplicitAccount) + $: balance = getImplicitAccountBalance(selectedOutput) $: formattedBalance = balance ? formatTokenAmountBestMatch(balance, getBaseToken()) : '-' $: hasStakingFeature = hasOutputStakingFeature(selectedOutput) $: rawStakedAmount = getStakedAmount(selectedOutput) $: formattedStakedAmount = formatTokenAmountBestMatch(rawStakedAmount, getBaseToken()) $: primaryKey = $selectedWallet?.primaryKey $: listBlockKeysFeature(selectedOutput) - $: hasMainAccountNegativeBIC = $selectedWallet?.balances?.blockIssuanceCredits[$selectedWallet?.mainAccountId] < 0 + $: hasMainAccountNegativeBIC = $selectedWallet?.balances?.blockIssuanceCredits?.[$selectedWallet?.mainAccountId] < 0 - function getAccountBalance(outputData: OutputData, isImplicitAccount: boolean): number | undefined { - if (isImplicitAccount) { - return Number(outputData.output.amount) - } else { - // TODO: Calculate the balance of an account output https://github.com/iotaledger/firefly/issues/8080 - return undefined - } + function getImplicitAccountBalance(outputData: OutputData): number | undefined { + return Number(outputData.output.amount) } function onExplorerClick(): void { @@ -171,8 +166,7 @@ {/if}
- - {#if !accountId} + {#if isImplicitAccount}
diff --git a/packages/desktop/views/dashboard/Dashboard.svelte b/packages/desktop/views/dashboard/Dashboard.svelte index c3198ef5508..1b46359ff96 100644 --- a/packages/desktop/views/dashboard/Dashboard.svelte +++ b/packages/desktop/views/dashboard/Dashboard.svelte @@ -53,10 +53,14 @@ $: $nftDownloadQueue, downloadNextNftInQueue() $: $downloadingNftId && interruptNftDownloadAfterTimeout(get(selectedWalletId)) $: addselectedWalletNftsToDownloadQueue($selectedWalletId) - $: hasMainAccountNegativeBIC = $selectedWallet?.balances?.blockIssuanceCredits[$selectedWallet?.mainAccountId] < 0 + $: hasMainAccountNegativeBIC = $selectedWallet?.balances?.blockIssuanceCredits?.[$selectedWallet?.mainAccountId] < 0 $: if (hasMainAccountNegativeBIC) { $dashboardRouter.goTo(DashboardRoute.AccountManagement) + showAppNotification({ + type: 'error', + message: localize('views.accountManagement.bicNotification'), + }) } $: if (features.analytics.dashboardRoute.enabled && $dashboardRoute) diff --git a/packages/shared/locales/en.json b/packages/shared/locales/en.json index caa43da9fe1..f305e27ad72 100644 --- a/packages/shared/locales/en.json +++ b/packages/shared/locales/en.json @@ -715,7 +715,8 @@ "hint": "Your main account has a negative Block Issuance Credit (BIC). Please select another account as the main one." }, "notification": "Activate one account to access the dashboard.", - "emptyAccounts": "There are no accounts to show, activate one first." + "emptyAccounts": "There are no accounts to show, activate one first.", + "bicNotification": "There is a problem with your account BIC." }, "delegation": { "title": "Delegation",