Files
2026-03-16 09:43:24 +08:00

63 lines
2.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Link from "next/link";
import { CandlesChart } from "@/src/components/charts/CandlesChart";
import { mockGetDailyOhlcv, mockGetQuote } from "@/src/market/providers/mockProvider";
export default async function StockPage({
params,
}: {
params: Promise<{ code: string }>;
}) {
const { code } = await params;
const bars = mockGetDailyOhlcv(code, 200);
const quote = mockGetQuote(code);
return (
<div className="space-y-4">
<div className="flex items-center justify-between gap-4">
<div>
<div className="text-xs text-black/60 dark:text-white/60"></div>
<h1 className="text-xl font-semibold">
<span className="font-mono">{code}</span>
</h1>
</div>
<Link
href="/watchlist"
className="rounded-lg border border-black/10 px-3 py-2 text-xs transition-colors hover:bg-black/[.04] dark:border-white/10 dark:hover:bg-white/[.06]"
>
</Link>
</div>
<div className="grid gap-3 md:grid-cols-3">
<div className="rounded-xl border border-black/10 p-4 dark:border-white/10">
<div className="text-xs text-black/60 dark:text-white/60"></div>
<div className="mt-1 text-lg font-semibold">{quote.price.toFixed(2)}</div>
</div>
<div className="rounded-xl border border-black/10 p-4 dark:border-white/10">
<div className="text-xs text-black/60 dark:text-white/60"></div>
<div className="mt-1 text-lg font-semibold">
{quote.changePct != null ? `${quote.changePct.toFixed(2)}%` : "-"}
</div>
</div>
<div className="rounded-xl border border-black/10 p-4 dark:border-white/10">
<div className="text-xs text-black/60 dark:text-white/60"></div>
<div className="mt-1 text-sm">{new Date(quote.asOf).toLocaleString()}</div>
</div>
</div>
<div className="rounded-xl border border-black/10 p-4 dark:border-white/10">
<div className="text-sm font-medium">线K线Mock </div>
<div className="mt-3">
<CandlesChart bars={bars} />
</div>
</div>
<div className="text-xs text-black/60 dark:text-white/60">
Mock M2 Next Route Handler
</div>
</div>
);
}