Full build: Vite/React acid-terminal frontend (BEARER design system, Panchang/Sentient/Fragment Mono, neon layer, palette audit script), HoodquidityVaults Foundry contracts (single+dual deposits via Chainlink-style feeds, hybrid exit, 10% platform fee, boost, Genesis LP), Reown AppKit wallet connect with Robinhood Chain testnet (46630), live data from Dexscreener and onchain reads, partner portal, design-sync setup for claude.ai/design. Deploy: static via Forgejo Actions platform, BUILD_DIR=apps/web/dist (.env). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
export function fmtUsd(value: number, compact = true): string {
|
|
return new Intl.NumberFormat("en-US", {
|
|
style: "currency",
|
|
currency: "USD",
|
|
notation: compact && Math.abs(value) >= 10_000 ? "compact" : "standard",
|
|
maximumFractionDigits: Math.abs(value) >= 10_000 ? 1 : 2,
|
|
}).format(value);
|
|
}
|
|
|
|
export function fmtPct(value: number, digits = 2): string {
|
|
return `${(value * 100).toFixed(digits)}%`;
|
|
}
|
|
|
|
export function fmtAprPct(value: number): string {
|
|
const pct = value * 100;
|
|
if (pct > 9_999) return ">9,999%";
|
|
if (pct >= 1_000) return `${Math.round(pct).toLocaleString("en-US")}%`;
|
|
return `${pct.toFixed(1)}%`;
|
|
}
|
|
|
|
export function fmtNum(value: number): string {
|
|
return new Intl.NumberFormat("en-US", {
|
|
notation: Math.abs(value) >= 10_000 ? "compact" : "standard",
|
|
maximumFractionDigits: 1,
|
|
}).format(value);
|
|
}
|
|
|
|
export function fmtCountdown(untilSec: number): string {
|
|
const s = Math.max(untilSec - Math.floor(Date.now() / 1000), 0);
|
|
const d = Math.floor(s / 86_400);
|
|
const h = Math.floor((s % 86_400) / 3_600);
|
|
const m = Math.floor((s % 3_600) / 60);
|
|
if (d > 0) return `${d}d ${h}h`;
|
|
if (h > 0) return `${h}h ${m}m`;
|
|
return `${m}m`;
|
|
}
|