feat(selection): show stock industry and concept boards in detail panel

Add point-in-time stock membership lookup to the sector radar module
(GET /sector-radar/stocks/{ts_code}/membership) reading the existing
dc_index/dc_member snapshots, and surface industries plus concept chips
in the selection signal detail panel with graceful no-data hiding.
This commit is contained in:
yuxuanhui
2026-09-05 16:23:50 +08:00
parent 50cac3575a
commit 41a9b4eb9a
14 changed files with 825 additions and 5 deletions
@@ -4,7 +4,7 @@ import {
type InfiniteData,
} from "@tanstack/react-query"
import { getSectorRadarDates, getSectorRadarRankings } from "./sector-radar.api"
import { getSectorRadarDates, getSectorRadarRankings, getStockSectorMembership } from "./sector-radar.api"
import type {
RadarRankingsQuery,
RadarRankingsResponse,
@@ -12,6 +12,34 @@ import type {
export const sectorRadarDatesQueryKey = ["sectorRadar", "dates"] as const
export const stockSectorMembershipQueryKey = (
tsCode?: string,
tradeDate?: string,
) =>
[
"sectorRadar",
"stockMembership",
tsCode ?? "none",
tradeDate ?? "none",
] as const
/**
* Read one stock's point-in-time industries and concepts for a detail view.
*
* Disabled until both the stock code and target trade date are known; the
* query stays cached per code-date pair so switching selections refetches
* only unseen pairs.
*/
export function useStockSectorMembership(tsCode?: string, tradeDate?: string) {
return useQuery({
enabled: Boolean(tsCode && tradeDate),
queryFn: ({ signal }) =>
getStockSectorMembership(tsCode ?? "", tradeDate ?? "", signal),
queryKey: stockSectorMembershipQueryKey(tsCode, tradeDate),
staleTime: 5 * 60 * 1000,
})
}
export const sectorRadarRankingsQueryKey = (query: RadarRankingsQuery) =>
[
"sectorRadar",