diff --git a/apps/governance/src/lib/tranches/tranches-store.tsx b/apps/governance/src/lib/tranches/tranches-store.tsx index 475851a79..6336e8719 100644 --- a/apps/governance/src/lib/tranches/tranches-store.tsx +++ b/apps/governance/src/lib/tranches/tranches-store.tsx @@ -50,14 +50,20 @@ export const useTranches = create()((set) => ({ ?.map((t) => { const tranche_progress = t.duration !== 0 ? (now - t.cliff_start) / t.duration : 0; - const lockedDecimal = - t.duration !== 0 - ? tranche_progress < 0 - ? 1 - : 1 - tranche_progress - : now < t.cliff_start - ? 1 - : 0; + let lockedDecimal; + if (t.duration !== 0) { + if (tranche_progress < 0) { + lockedDecimal = 1; + } else { + lockedDecimal = 1 - tranche_progress; + } + } else { + if (now < t.cliff_start) { + lockedDecimal = 1; + } else { + lockedDecimal = 0; + } + } const clampedLockedDecimal = Math.max(0, Math.min(1, lockedDecimal)); return {