Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Block Explorer UI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
Block Explorer UI
Commits
db9b35ec
Commit
db9b35ec
authored
2 months ago
by
Dima Rifai
Committed by
mcfarhat
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#417
- Move account value calculations to useConvertedAccount details
parent
4c34211b
No related branches found
No related tags found
1 merge request
!529
Delrifai/#417 fix wallet bug
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/account/AccountBalanceCard.tsx
+2
-29
2 additions, 29 deletions
components/account/AccountBalanceCard.tsx
with
2 additions
and
29 deletions
components/account/AccountBalanceCard.tsx
+
2
−
29
View file @
db9b35ec
...
...
@@ -10,15 +10,6 @@ import {
grabNumericValue
,
}
from
"
@/utils/StringUtils
"
;
import
{
cn
,
formatNumber
}
from
"
@/lib/utils
"
;
import
Link
from
"
next/link
"
;
import
{
FontAwesomeIcon
}
from
"
@fortawesome/react-fontawesome
"
;
import
{
faHistory
}
from
"
@fortawesome/free-solid-svg-icons
"
;
import
{
Tooltip
,
TooltipProvider
,
TooltipTrigger
,
TooltipContent
,
}
from
"
@radix-ui/react-tooltip
"
;
type
AccountBalanceCardProps
=
{
header
:
string
;
userDetails
:
Explorer
.
FormattedAccountDetails
;
...
...
@@ -36,6 +27,7 @@ const cardNameMap = new Map([
[
"
received_vesting_shares
"
,
"
Received HP
"
],
[
"
delegated_vesting_shares
"
,
"
Delegated HP
"
],
[
"
vesting_withdraw_rate
"
,
"
Powering down HP
"
],
]);
const
unclaimedRecourses
=
new
Map
([
...
...
@@ -96,25 +88,6 @@ const AccountBalanceCard: React.FC<AccountBalanceCardProps> = ({
const
[
isBalancesHidden
,
setIsBalancesHidden
]
=
useState
(
false
);
const
[
totalBalance
,
setTotalBalance
]
=
useState
(
0
);
useEffect
(()
=>
{
const
newBalance
=
keys
.
reduce
((
acc
,
param
)
=>
{
if
(
cardNameMap
.
has
(
param
)
&&
!
skipCalculation
.
includes
(
param
))
{
const
value
=
grabNumericValue
(
userDetails
.
dollars
[
param
]);
if
(
typeof
value
===
"
number
"
&&
!
isNaN
(
value
))
{
return
acc
+
value
;
}
else
{
console
.
error
(
"
Value is not a number:
"
,
value
);
return
acc
;
}
}
return
acc
;
},
0
);
setTotalBalance
(
newBalance
);
},
[
keys
,
userDetails
]);
const
renderBalance
=
()
=>
{
return
(
<
TableRow
className
=
"border-b border-gray-700 hover:bg-inherit font-bold"
>
...
...
@@ -123,7 +96,7 @@ const AccountBalanceCard: React.FC<AccountBalanceCardProps> = ({
className
=
"text-right"
colSpan
=
{
2
}
>
{
formatNumber
(
totalBalance
,
false
,
tr
ue
)
}
$
{
changeHBDToDollarsDisplay
(
userDetails
.
dollars
.
account_val
ue
)
}
</
TableCell
>
</
TableRow
>
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment