2026-09-01 13:37:19 +08:00
|
|
|
import { lazy, Suspense } from "react"
|
2026-08-10 10:07:55 +08:00
|
|
|
import { Database, Search } from "lucide-react"
|
2026-09-01 13:37:19 +08:00
|
|
|
import { useSelectionChart } from "../api/selection.query"
|
2026-08-10 10:07:55 +08:00
|
|
|
|
|
|
|
|
import { Badge } from "@/shared/ui/badge"
|
|
|
|
|
import { Card } from "@/shared/ui/card"
|
|
|
|
|
|
2026-08-28 11:39:05 +08:00
|
|
|
import type { SelectionStockResult } from "../api/selection.types"
|
2026-08-31 16:14:16 +08:00
|
|
|
import { PatternScoreDetails } from "./pattern-score"
|
2026-08-27 13:17:51 +08:00
|
|
|
import { categoryToneClass, getCategoryLabel } from "./selection-presentation"
|
|
|
|
|
import { SignalDetails } from "./signal-details"
|
2026-09-01 13:37:19 +08:00
|
|
|
import { PatternCaseImage } from "./pattern-case-image"
|
|
|
|
|
|
|
|
|
|
const SelectionChart = lazy(() =>
|
|
|
|
|
import("./selection-chart").then((module) => ({
|
|
|
|
|
default: module.SelectionChart,
|
|
|
|
|
})),
|
|
|
|
|
)
|
2026-08-10 10:07:55 +08:00
|
|
|
|
|
|
|
|
interface SignalDetailPanelProps {
|
2026-08-28 11:39:05 +08:00
|
|
|
stock: SelectionStockResult | undefined
|
2026-08-10 10:07:55 +08:00
|
|
|
}
|
|
|
|
|
|
2026-08-28 11:39:05 +08:00
|
|
|
export function SignalDetailPanel({ stock }: SignalDetailPanelProps) {
|
2026-09-01 13:37:19 +08:00
|
|
|
const chartQuery = useSelectionChart(stock?.ts_code, stock?.target_trade_date)
|
|
|
|
|
|
2026-08-28 11:39:05 +08:00
|
|
|
if (!stock) {
|
2026-08-10 10:07:55 +08:00
|
|
|
return (
|
|
|
|
|
<Card
|
|
|
|
|
aria-label="当前股票详情"
|
2026-08-10 16:58:16 +08:00
|
|
|
className="hidden min-h-0 overflow-auto rounded-md border-border/80 bg-card p-3 md:flex md:flex-col md:justify-center"
|
2026-08-10 10:07:55 +08:00
|
|
|
>
|
|
|
|
|
<div className="space-y-2 text-center">
|
|
|
|
|
<Search
|
|
|
|
|
className="mx-auto size-5 text-muted-foreground"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
/>
|
2026-08-28 11:39:05 +08:00
|
|
|
<p className="font-medium">暂无选中股票</p>
|
2026-08-10 10:07:55 +08:00
|
|
|
<p className="text-xs leading-5 text-muted-foreground">
|
2026-08-28 11:39:05 +08:00
|
|
|
从左侧列表选择一只股票查看详情。
|
2026-08-10 10:07:55 +08:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<aside
|
|
|
|
|
aria-label="当前股票详情"
|
2026-08-10 16:58:16 +08:00
|
|
|
className="hidden min-h-0 overflow-auto rounded-md border border-border/80 bg-card p-3 md:block"
|
2026-08-10 10:07:55 +08:00
|
|
|
>
|
|
|
|
|
<p className="text-[10px] font-bold tracking-[0.08em] text-muted-foreground uppercase">
|
2026-08-28 11:39:05 +08:00
|
|
|
Selected stock
|
2026-08-10 10:07:55 +08:00
|
|
|
</p>
|
|
|
|
|
<div className="mt-2 flex items-start justify-between gap-3">
|
|
|
|
|
<div className="min-w-0">
|
|
|
|
|
<h2 className="truncate text-xl font-semibold tracking-tight">
|
2026-08-28 11:39:05 +08:00
|
|
|
{stock.name}
|
2026-08-10 10:07:55 +08:00
|
|
|
</h2>
|
|
|
|
|
<p className="font-mono text-xs text-muted-foreground">
|
2026-08-28 11:39:05 +08:00
|
|
|
{stock.ts_code}
|
2026-08-10 10:07:55 +08:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<Database
|
|
|
|
|
className="mt-1 size-4 shrink-0 text-muted-foreground"
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-08-10 13:42:53 +08:00
|
|
|
<p className="mt-4 text-3xl font-semibold tabular-nums tracking-tight">
|
2026-08-28 11:39:05 +08:00
|
|
|
¥ {stock.close.toFixed(2)}
|
2026-08-10 10:07:55 +08:00
|
|
|
</p>
|
|
|
|
|
|
2026-08-28 11:39:05 +08:00
|
|
|
<div className="mt-3 flex flex-wrap gap-1">
|
|
|
|
|
{stock.signals.map((signal) => (
|
|
|
|
|
<Badge
|
|
|
|
|
key={signal.category}
|
|
|
|
|
className={categoryToneClass(signal.category)}
|
|
|
|
|
variant="outline"
|
|
|
|
|
>
|
|
|
|
|
{getCategoryLabel(signal.category)}
|
|
|
|
|
</Badge>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-08-10 10:07:55 +08:00
|
|
|
|
2026-08-27 13:17:51 +08:00
|
|
|
<dl className="mt-4 divide-y divide-border/60 border-y border-border/60 text-xs">
|
2026-08-10 10:07:55 +08:00
|
|
|
<div className="flex items-center justify-between gap-3 py-2.5">
|
|
|
|
|
<dt className="text-muted-foreground">目标交易日</dt>
|
|
|
|
|
<dd className="font-medium tabular-nums">
|
2026-08-28 11:39:05 +08:00
|
|
|
{stock.target_trade_date}
|
2026-08-10 10:07:55 +08:00
|
|
|
</dd>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center justify-between gap-3 py-2.5">
|
|
|
|
|
<dt className="text-muted-foreground">策略</dt>
|
|
|
|
|
<dd className="font-medium">知行 B1</dd>
|
|
|
|
|
</div>
|
|
|
|
|
</dl>
|
2026-08-27 13:17:51 +08:00
|
|
|
|
2026-08-31 16:14:16 +08:00
|
|
|
<section className="mt-4" aria-labelledby="pattern-score-details">
|
|
|
|
|
<h3
|
|
|
|
|
className="mb-2 text-xs font-medium text-muted-foreground"
|
|
|
|
|
id="pattern-score-details"
|
|
|
|
|
>
|
|
|
|
|
图形相似度评分
|
|
|
|
|
</h3>
|
|
|
|
|
<PatternScoreDetails score={stock.score} />
|
|
|
|
|
</section>
|
|
|
|
|
|
2026-09-01 13:37:19 +08:00
|
|
|
<section className="mt-4" aria-labelledby="technical-chart">
|
|
|
|
|
<h3
|
|
|
|
|
className="mb-2 text-xs font-medium text-muted-foreground"
|
|
|
|
|
id="technical-chart"
|
|
|
|
|
>
|
|
|
|
|
技术图表
|
|
|
|
|
</h3>
|
|
|
|
|
{chartQuery.isPending ? (
|
|
|
|
|
<p className="text-xs text-muted-foreground">正在加载行情图表…</p>
|
|
|
|
|
) : chartQuery.isError ? (
|
|
|
|
|
<p className="text-xs text-destructive">行情图表暂时不可用。</p>
|
|
|
|
|
) : chartQuery.data?.points.length ? (
|
|
|
|
|
<Suspense
|
|
|
|
|
fallback={
|
|
|
|
|
<p className="text-xs text-muted-foreground">正在加载图表组件…</p>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<SelectionChart chart={chartQuery.data} />
|
|
|
|
|
</Suspense>
|
|
|
|
|
) : (
|
|
|
|
|
<p className="text-xs text-muted-foreground">暂无可用行情数据。</p>
|
|
|
|
|
)}
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<PatternCaseImage score={stock.score} />
|
|
|
|
|
|
2026-08-27 13:17:51 +08:00
|
|
|
<section className="mt-4" aria-labelledby="signal-detail-metrics">
|
|
|
|
|
<h3
|
|
|
|
|
className="mb-2 text-xs font-medium text-muted-foreground"
|
|
|
|
|
id="signal-detail-metrics"
|
|
|
|
|
>
|
|
|
|
|
关键指标
|
|
|
|
|
</h3>
|
2026-08-28 11:39:05 +08:00
|
|
|
<div className="space-y-4">
|
|
|
|
|
{stock.signals.map((signal) => (
|
|
|
|
|
<section key={signal.category} className="space-y-2">
|
|
|
|
|
<h4 className="text-xs font-medium text-foreground">
|
|
|
|
|
{getCategoryLabel(signal.category)}
|
|
|
|
|
</h4>
|
|
|
|
|
<SignalDetails details={signal.details} />
|
|
|
|
|
</section>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-08-27 13:17:51 +08:00
|
|
|
</section>
|
2026-08-10 10:07:55 +08:00
|
|
|
</aside>
|
|
|
|
|
)
|
|
|
|
|
}
|