import { Suspense } from "react"; import Link from "next/link"; import { connection } from "next/server"; import { StockBrowser, type StockRow } from "@/components/stock-browser"; import { Card, CardSkeleton, Empty, Page } from "@/components/ui"; import { pct } from "@/lib/format"; import { getIdeas } from "@/lib/ideas"; import { getQuotes } from "@/lib/market"; import { newsCounts } from "@/lib/news"; import { getOpenSymbols } from "@/lib/portfolio"; import { UNIVERSE } from "@/lib/universe"; async function Ideas() { await connection(); const ideas = await getIdeas(); const items = ideas?.items.slice(0, 4) ?? []; return ( filtre sans IA}> {!items.length && Les idées se calculent à l'ouverture de l'app : reviens dans une minute.} ); } async function Market() { await connection(); const [quotes, newsCount, held] = await Promise.all([getQuotes(UNIVERSE.map((s) => s.symbol)), newsCounts(48), getOpenSymbols(["sandbox", "real"])]); const rows: StockRow[] = UNIVERSE.map((s) => { const q = quotes.get(s.symbol); return { symbol: s.symbol, name: s.name, market: s.market, price: q?.price ?? null, currency: q?.currency ?? (s.market === "US" ? "USD" : "EUR"), changePct: q?.changePct ?? null, news: newsCount.get(s.symbol) ?? 0, held: held.includes(s.symbol), }; }); return ; } export default function ActionsPage() { return ( 📰 Actus } > }> }> ); }