diff --git a/src/routes/core-stocks.tsx b/src/routes/core-stocks.tsx index fa71c08..0704aaa 100644 --- a/src/routes/core-stocks.tsx +++ b/src/routes/core-stocks.tsx @@ -1,8 +1,8 @@ import { createFileRoute, Link } from "@tanstack/react-router"; import { useQuery } from "@tanstack/react-query"; -import { Fragment, useState } from "react"; +import { Fragment } from "react"; import { fetchActiveCoreStocks } from "@/lib/core-stock-api"; -import { ArrowLeft, RefreshCw, Flame, ChevronDown, ChevronRight } from "lucide-react"; +import { ArrowLeft, RefreshCw, Flame } from "lucide-react"; export const Route = createFileRoute("/core-stocks")({ component: CoreStocksPage, @@ -25,7 +25,6 @@ function CoreStocksPage() { const dates = data?.dates ?? []; const stocks = data?.stocks ?? []; - const [expanded, setExpanded] = useState(null); return (
@@ -76,76 +75,64 @@ function CoreStocksPage() { - {stocks.map((s) => { - const isOpen = expanded === s.stockCode; - return ( - - setExpanded(isOpen ? null : s.stockCode)} - className="border-b last:border-0 hover:bg-muted/30 cursor-pointer" - > - - - {isOpen ? : } - e.stopPropagation()} - className="font-medium hover:text-primary hover:underline" - > - {s.stockName} - - {s.stockCode} - - - {dates.map((d) => { - const g = s.dailyGains[d]; - const cls = g == null ? "text-muted-foreground/40" : g >= 0 ? "text-red-500" : "text-green-500"; - return ( - - {formatGain(g)} - - ); - })} - - {s.coverCount ?? "·"} - - - {s.lastAppear ? s.lastAppear.slice(5) : "·"} - - - - - {s.appearCount} - - - - {isOpen && ( - - -
所属题材
- {s.themes && s.themes.length > 0 ? ( -
- {s.themes.map((t) => ( - - {t.theme_name} - - ))} -
- ) : ( - 暂无题材数据 - )} + {stocks.map((s) => ( + + + + + {s.stockName} + + {s.stockCode} + + {dates.map((d) => { + const g = s.dailyGains[d]; + const cls = g == null ? "text-muted-foreground/40" : g >= 0 ? "text-red-500" : "text-green-500"; + return ( + + {formatGain(g)} - - )} - - ); - })} + ); + })} + + {s.coverCount ?? "·"} + + + {s.lastAppear ? s.lastAppear.slice(5) : "·"} + + + + + {s.appearCount} + + + + + +
所属题材
+ {s.themes && s.themes.length > 0 ? ( +
+ {s.themes.map((t) => ( + + {t.theme_name} + + ))} +
+ ) : ( + 暂无题材数据 + )} + + +
+ ))}