feat(pool): add claimable unvested amount#865
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 8 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis pull request adds support for displaying a "claimable unvested amount" metric in the Incentivize Pool history UI. Changes span localization strings across 8 languages, the history display component, data mapping pipeline, model definitions, and response interfaces to introduce and flow this new field from API response through to UI rendering. Changes
Sequence DiagramsequenceDiagram
participant API as API Response
participant Mapper as PoolStakingMapper
participant Model as PoolStakingModel
participant Container as IncentivizePoolHistoryContainer
participant Converter as AmountConverter
participant UI as IncentivizePoolHistoryBox
API->>Mapper: PoolStakingResponse {claimablePenaltyAmount, estimatedPenaltyAmount, ...}
Mapper->>Model: Map claimablePenaltyAmount → claimableUnvestedAmount
Model->>Container: PoolStakingModel with claimableUnvestedAmount
Container->>Container: Compute displayable claimableUnvestedAmount<br/>(shiftToDisplay or "0")
Container->>Converter: Raw claimableUnvestedAmount value
Converter->>Converter: Convert using rewardToken.decimals
Converter->>UI: Formatted claimableUnvestedAmount
UI->>UI: Render row with localized label, tooltip,<br/>formatted amount + symbol
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
packages/web/public/locales/en/IncentivizePool.json (1)
70-90:⚠️ Potential issue | 🔴 CriticalRemove duplicate
claimableUnvestedAmountkeys.
claimableUnvestedAmountis declared twice in bothlabel(lines 71 and 73) andtooltip(lines 83 and 85). Biome flags both aslint/suspicious/noDuplicateObjectKeysand JSON parsers will silently keep only the last occurrence — this will also likely fail CI on the lint step.🔧 Proposed fix
"label": { - "claimableUnvestedAmount": "Claimable Unvested Amount", "depositAmount": "Deposit Amount", "claimableUnvestedAmount": "Claimable Unvested Amount", "endDate": "End Date", "incentivizedAmount": "Incentivized Amount", "pool": "Pool", "remainingAmount": "Remaining Amount", "startDate": "Start Date", "token": "Token", "unvestedAmount": "Unvested Amount" }, "tooltip": { - "claimableUnvestedAmount": "The amount currently claimable by the provider after the incentivization has been ended.", "depositAmount": "The amount of tokens deposited when<br />\nthis incentivization was created. It's fully<br />\nrefundable upon the completion of the<br />\nincentivization.", "claimableUnvestedAmount": "The amount currently claimable by the provider after the incentivization has been ended.",Note: also consider moving
claimableUnvestedAmountto the top of each block for alphabetical consistency with other locales (ru/es/de/fr/ja all have it first), then re-run i18nexus sync to propagate.packages/web/public/locales/ja/IncentivizePool.json (1)
71-82:⚠️ Potential issue | 🟡 MinorMinor: terminology inconsistency with
unvestedAmounttranslation.
unvestedAmountis translated as "未給付額" (line 79), but the newclaimableUnvestedAmountuses "未投資額" (line 71) for the same "unvested" concept. Since both refer to the unvested concept, using consistent terminology (e.g., "請求可能な未給付額") would read more naturally and match the existing field. The tooltip at line 82 is fine.Consider aligning the term when you next sync from i18nexus.
packages/web/public/locales/ko/IncentivizePool.json (1)
70-90:⚠️ Potential issue | 🟠 MajorDuplicate JSON keys — one translation will be silently dropped.
claimableUnvestedAmountis declared twice in bothlabel(lines 71 and 73) andtooltip(lines 83 and 85).JSON.parsekeeps only the last occurrence, so lines 71 and 83 are effectively dead and the resulting UI will use lines 73 and 85. This is also flagged by Biome (lint/suspicious/noDuplicateObjectKeys).Additionally, line 71 translates "unvested" as
미투자("not invested"), which is inconsistent with how the rest of this file renders the unvested concept —unvestedAmounton line 80 uses미분배 수량("undistributed amount"). The surviving duplicate on line 73 (미분배 수량) is the terminology-consistent choice; the dead one should be removed.🛠️ Proposed fix
"label": { - "claimableUnvestedAmount": "청구 가능한 미투자 금액", + "claimableUnvestedAmount": "청구 가능 미분배 수량", "depositAmount": "예치 수량", - "claimableUnvestedAmount": "청구 가능 미분배 수량", "endDate": "종료 날짜", @@ "tooltip": { - "claimableUnvestedAmount": "인센티브가 종료된 후 현재 공급자가 청구할 수 있는 금액입니다.", + "claimableUnvestedAmount": "인센티브 종료 후 제공자가 현재 청구할 수 있는 미분배 수량입니다.", "depositAmount": "인센티브가 생성될 때 예치된 토큰의 수량입니다. <br />\n인센티브 기간이 종료되면 전액 환급받을 수 있습니다.", - "claimableUnvestedAmount": "인센티브 종료 후 제공자가 현재 청구할 수 있는 미분배 수량입니다.", "incentivizedAmount": "풀에 인센티브로 제공되는 토큰의 수량입니다.",Please also double-check (or re-run the i18nexus pull) which of the two Korean variants is the intended canonical translation — the diff suggests both came from the sync, which may indicate a duplicated source entry upstream.
🧹 Nitpick comments (2)
packages/web/src/repositories/pool/response/pool-staking-response.ts (1)
14-18: Consider marking the new penalty fields optional for backward/forward compatibility.
penaltyAmountwas relaxed to optional (good for older responses), but the four new fields (estimatedPenaltyAmount,totalPenaltyAmount,collectedPenaltyAmount,claimablePenaltyAmount) are declared required. If the API hasn't fully rolled out these fields yet (or regresses one of them), responses will silently violate this contract at runtime — TypeScript won't catch it since the response object is typically cast from JSON.The mapper in
packages/web/src/models/pool/mapper/pool-staking-mapper.tsalready defends against missing values (poolStaking.claimablePenaltyAmount || "0"and the fallback chain forunvestedAmount), so making these fields optional here would better reflect the actual runtime contract and match the intent of that fallback logic.Suggested change
- penaltyAmount?: string; - estimatedPenaltyAmount: string; - totalPenaltyAmount: string; - collectedPenaltyAmount: string; - claimablePenaltyAmount: string; + penaltyAmount?: string; + estimatedPenaltyAmount?: string; + totalPenaltyAmount?: string; + collectedPenaltyAmount?: string; + claimablePenaltyAmount?: string;Please confirm with the API team (or check the latest API schema/swagger) whether these four fields are guaranteed to be present in every
PoolStakingResponse.packages/web/src/layouts/pool/pool-incentivize/components/incentivize-pool-history/incentivize-pool-history-box/IncentivizePoolHistoryBox.tsx (1)
183-200: Formatting inconsistency and likely >120 char line.Line 189 puts the entire
<Trans>on one line, while the adjacentunvestedAmountrow (lines 155–170) and all other rows breakns,components, andi18nKeyacross multiple lines. At ~18 spaces of indentation plus the attributes, line 189 exceeds the 120-char print width and is likely to be rewritten by the formatter anyway — please format it the same way as the surrounding rows for consistency.✏️ Proposed formatting
- <Tooltip - FloatingContent={ - <span css={historyTooltipContent}> - <Trans ns="IncentivizePool" components={{ br: <br /> }} i18nKey={"incentiPool.history.tooltip.claimableUnvestedAmount"} /> - </span> - } - placement="top" - > + <Tooltip + FloatingContent={ + <span css={historyTooltipContent}> + <Trans + ns="IncentivizePool" + components={{ br: <br /> }} + i18nKey={"incentiPool.history.tooltip.claimableUnvestedAmount"} + /> + </span> + } + placement="top" + >As per coding guidelines: "Keep print width to 120 characters per line".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 66b24a65-7e6e-432d-9a0c-08e78a264e1f
📒 Files selected for processing (14)
packages/web/public/locales/de/IncentivizePool.jsonpackages/web/public/locales/en/IncentivizePool.jsonpackages/web/public/locales/es/IncentivizePool.jsonpackages/web/public/locales/fr/IncentivizePool.jsonpackages/web/public/locales/ja/IncentivizePool.jsonpackages/web/public/locales/ko/IncentivizePool.jsonpackages/web/public/locales/ru/IncentivizePool.jsonpackages/web/public/locales/zh/IncentivizePool.jsonpackages/web/src/layouts/pool/pool-incentivize/components/incentivize-pool-history/incentivize-pool-history-box/IncentivizePoolHistoryBox.tsxpackages/web/src/layouts/pool/pool-incentivize/containers/incentivize-pool-history-container/IncentivizePoolHistoryContainer.tsxpackages/web/src/models/pool/mapper/pool-staking-mapper.tspackages/web/src/models/pool/pool-staking.tspackages/web/src/repositories/pool/response/pool-staking-response.tspackages/web/src/services/converters/pool/pool.converter.ts
|



Summary
unvestedterminology inside the interface layerValidation
GSW-2622-interface-collectable-penaltySummary by CodeRabbit
Release Notes