feat(portal): centralize position valuation and presence utilities with test coverage - #129
feat(portal): centralize position valuation and presence utilities with test coverage#129yeziR4 wants to merge 1 commit into
Conversation
|
@renoschubert is attempting to deploy a commit to the autonomys Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6fb99ae. Configure here.
| totalStaked={operator.totalStaked} | ||
| totalStorageFund={operator.totalStorageFund} | ||
| currentStakedValue={operator.totalStaked} | ||
| storageFeeDeposit={operator.totalStorageFeeDeposit} |
There was a problem hiding this comment.
Broken operator pool breakdown props
Medium Severity
OperatorPoolBreakdown is given currentStakedValue and storageFeeDeposit, but it expects totalStaked and totalStorageFund. It also reads operator.totalStorageFeeDeposit, which is not on the Operator type (totalStorageFund is). The tooltip therefore always shows zeroed staked, storage, and total values, while OperatorTable and OperatorSummary still pass the correct props.
Reviewed by Cursor Bugbot for commit 6fb99ae. Configure here.
|
@jim-counter Opened this PR to centralize position valuation and presence checking utilities across the portal:
Ready for review whenever you have time Thanks |
| (userPosition.pendingDeposit?.amount || 0), | ||
| 2, | ||
| )} | ||
| {formatAI3(calculateTotalPositionValue(userPosition), 2)} |
There was a problem hiding this comment.
Are you missing an import for this?
|
@yeziR4 you will want to rebase on main as I've just fixed the type checking and test runner there. |
6fb99ae to
3a7ab30
Compare
|
@jim-counter Updated
Running |
| <span className="text-lg font-bold text-foreground font-mono whitespace-nowrap"> | ||
| {formatAI3(operator.totalStaked)} | ||
| </span> |
There was a problem hiding this comment.
This changes the no-data branch from a muted -- to formatAI3(operator.totalStaked), which renders a staked-only figure under the "Operator Total Value" label on the next line. When totalPoolValue is absent the storage fund is excluded, so the number understates the pool rather than signalling "no data".
It also diverges from the other two views, which still show -- in this branch - OperatorTable.tsx:123 and OperatorSummary.tsx:98. Same operator, three different renderings.
Suggest restoring the placeholder, keeping the new text-lg/span styling and using the muted colour to match the siblings:
| <span className="text-lg font-bold text-foreground font-mono whitespace-nowrap"> | |
| {formatAI3(operator.totalStaked)} | |
| </span> | |
| <span className="text-lg font-bold text-muted-foreground font-mono whitespace-nowrap"> | |
| -- | |
| </span> |
If the intent was actually to always show something here, that's a reasonable product call - but it should land as its own change that updates all three views together, rather than inside the utils refactor.


Overview
This PR centralizes position valuation and presence checking utilities across the portal:
position-utils.ts): CreatedhasUserPositionandcalculateTotalPositionValuehelpers to eliminate copy-pasted position checks inOperatorCard.tsx,OperatorTable.tsx, andOperatorSummary.tsx.position-utils.test.ts): Added 7 unit tests covering position presence checks (shares, storage deposit, pending deposits), pending withdrawal omission, and position value summations.Verification
yarn workspace @auto-portal/portal type-checkpasses with 0 errors.