Skip to content

Commit

Permalink
feat: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
evavirseda committed Mar 22, 2024
1 parent 6c1a104 commit f8a77d3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
16 changes: 5 additions & 11 deletions packages/desktop/components/AccountManagementDetails.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -171,8 +166,7 @@
{/if}
</right-pane-title>
<div class="flex flex-row space-x-2 w-1/2">
<!-- TODO: Remove this if when calculate the balance of an account output https://github.com/iotaledger/firefly/issues/8080 -->
{#if !accountId}
{#if isImplicitAccount}
<Tile>
<div class="flex flex-col space-y-2 items-center justify-center w-full">
<Text type={TextType.h3}>
Expand Down
6 changes: 5 additions & 1 deletion packages/desktop/views/dashboard/Dashboard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion packages/shared/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f8a77d3

Please sign in to comment.