feat(market): add CoinGecko market data panel with cached /api/market endpoint

This commit is contained in:
2026-03-09 17:55:24 +01:00
parent 3aaa6707c5
commit 1f86a5ead4
10 changed files with 521 additions and 12 deletions

View File

@@ -2,20 +2,11 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import { buildApiUrl } from "@/lib/api/url";
import { parseRatesResponse, RatesResponse } from "@/lib/rates";
const REFRESH_INTERVAL_MS = 60_000;
function buildApiUrl(path: string): string {
const base = process.env.NEXT_PUBLIC_API_BASE_URL?.trim();
if (!base) {
return path;
}
return `${base.replace(/\/$/, "")}${path}`;
}
export function useMarketRates() {
const [data, setData] = useState<RatesResponse | null>(null);
const [error, setError] = useState<string | null>(null);