diff --git a/apps/governance/src/lib/tranches/tranches-store.tsx b/apps/governance/src/lib/tranches/tranches-store.tsx index 6b48ed913..475851a79 100644 --- a/apps/governance/src/lib/tranches/tranches-store.tsx +++ b/apps/governance/src/lib/tranches/tranches-store.tsx @@ -50,7 +50,16 @@ export const useTranches = create()((set) => ({ ?.map((t) => { const tranche_progress = t.duration !== 0 ? (now - t.cliff_start) / t.duration : 0; - const lockedDecimal = tranche_progress < 0 ? 1 : 1 - tranche_progress; + const lockedDecimal = + t.duration !== 0 + ? tranche_progress < 0 + ? 1 + : 1 - tranche_progress + : now < t.cliff_start + ? 1 + : 0; + const clampedLockedDecimal = Math.max(0, Math.min(1, lockedDecimal)); + return { tranche_id: t.tranche_id, tranche_start: secondsToDate(t.cliff_start), @@ -60,7 +69,7 @@ export const useTranches = create()((set) => ({ toBigNum(t.current_balance, decimals) ), locked_amount: toBigNum(t.initial_balance, decimals).times( - lockedDecimal + clampedLockedDecimal ), users: t.users, }; diff --git a/apps/governance/src/routes/redemption/tranche-item.tsx b/apps/governance/src/routes/redemption/tranche-item.tsx index fd9056815..9b2677a7a 100644 --- a/apps/governance/src/routes/redemption/tranche-item.tsx +++ b/apps/governance/src/routes/redemption/tranche-item.tsx @@ -54,22 +54,16 @@ export const TrancheItem = ({ {formatNumber(total, 2)} - - - - - - - - - - - -
{t('Starts unlocking')} - {format(tranche.tranche_start, DATE_FORMAT_LONG)} -
{t('Fully unlocked')} - {format(tranche.tranche_end, DATE_FORMAT_LONG)} -
+
+
+ {t('Starts unlocking')}:{' '} + {format(tranche.tranche_start, DATE_FORMAT_LONG)} +
+
+ {t('Fully unlocked')}:{' '} + {format(tranche.tranche_end, DATE_FORMAT_LONG)} +
+