diff --git a/src/app/[locale]/vaults/page.tsx b/src/app/[locale]/vaults/page.tsx index 417f481..21a76fd 100644 --- a/src/app/[locale]/vaults/page.tsx +++ b/src/app/[locale]/vaults/page.tsx @@ -31,6 +31,8 @@ import { } from "../../../lib/api/vaults"; import { useFlag } from "../../../lib/flags"; +const ABSENT = "—"; + /** Metrics where a smaller value is the better one, so the first click sorts ascending. */ const SORT_DEFAULT_DIR: Record = { apy: "desc", @@ -66,6 +68,7 @@ const TH_STYLE = { const TD_STYLE = { padding: "10px", fontSize: 12, color: "var(--text-mid)", borderBottom: "1px solid var(--border-subtle)", whiteSpace: "nowrap" } as const; function VaultsIndex() { + const vaultsEnabled = useFlag("vaults"); const router = useRouter(); const pathname = usePathname(); const searchParams = useSearchParams(); @@ -74,9 +77,9 @@ function VaultsIndex() { const [error, setError] = useState(null); const [attempt, setAttempt] = useState(0); const [apyTooltip, setApyTooltip] = useState(null); - const vaultsEnabled = useFlag("vaults"); useEffect(() => { + if (!vaultsEnabled) return; let cancelled = false; setError(null); fetchVaults({ enabled: vaultsEnabled }) @@ -120,7 +123,7 @@ function VaultsIndex() { }; const hasFilters = Boolean(query.strategy || query.underlying || query.status || query.risk) || query.tenor !== null; - const loading = vaults === null && error === null; + const loading = vaultsEnabled && vaults === null && error === null; return (
@@ -142,16 +145,17 @@ function VaultsIndex() {

Earn passive yield by providing liquidity to automated option-writing strategies. Premiums are collected each epoch and compounded into your share price. - {process.env.NEXT_PUBLIC_VAULTS !== "live" && ( - - (mock data — contracts not yet deployed) - - )}

+ {!vaultsEnabled && ( +
+ Vaults are not available on this deployment. +
+ )} + {/* Filters */} - {vaults && ( + {vaultsEnabled && vaults && (
update({ strategy: (v || null) as VaultStrategy | null })} options={Object.entries(VAULT_STRATEGY_LABELS).map(([value, label]) => ({ value, label }))} /> @@ -174,7 +178,7 @@ function VaultsIndex() { )} {/* Compare bar */} - {vaults && ( + {vaultsEnabled && vaults && (
{query.ids.length === 0 @@ -203,7 +207,7 @@ function VaultsIndex() { )} {/* Error with retry */} - {error && ( + {vaultsEnabled && error && (
Failed to load vaults: {error}