Files
iboard/src/pages/macro/FinanceCategoryView.jsx
T
jif2.zhang afbb9bc603
Docker Build and Push / build-image (push) Successful in 2m37s
feat(宏观): ifinance 分类动态挂载为宏观 tab, 报警迁入监控, 下线油价/本地经济数据/策略研究
- 宏观只保留本地 新闻/经济文章, 外接 ifinance categories[] 动态成为 tab (纯前端直连, CORS/_headers, https)
- 报警从宏观迁到监控第 4 个 tab (保留 Alert 模块, 供未来新增报警源)
- 彻底删除油价/经济数据/策略研究: 前端组件+api、后端 apizero/data 路由、cron、fetchers、种子数据
- 新增迁移 DROP Indicator/IndicatorPoint/Strategy/OilPriceHistory; 重新生成 Prisma Client
- CSP 放开 *.honor3.com (含端口通配), 避免新增子域反复重装外壳
2026-10-30 17:17:10 +08:00

40 lines
1.5 KiB
React

import { useNavigate } from 'react-router-dom'
import { List, DotLoading } from 'antd-mobile'
import { useIfinanceInfo } from '../../lib/ifinance.js'
// 外接模块分类列表 (ifinance categories[].items[])
// - 数据来源: info.json (运行时动态拉取), 当前分类由 MacroPage 传入
// - 点击条目 → /macro/finance/:catId/:itemId 打开该条目独立 HTML
const KIND_LABEL = { indicator: '指标', strategy: '策略', dashboard: '看板' }
export default function FinanceCategoryView({ category }) {
const navigate = useNavigate()
const { info, loading, error } = useIfinanceInfo()
// MacroPage 拿到的 category 可能来自缓存; 若为空则用 hook 里的最新数据兜底
const cat = category || (info?.categories || []).find((c) => c.id === category?.id)
const items = cat?.items || []
if (!cat && loading) return <div className="loading"><DotLoading /> 加载中...</div>
if (!cat && error) return <div className="error-banner">{error}</div>
if (!items.length) return <div className="empty">暂无内容</div>
return (
<div className="list-page">
<List>
{items.map((it) => (
<List.Item
key={it.id}
title={it.title || it.id}
description={it.subtitle || ''}
extra={<span className="finance-kind">{KIND_LABEL[it.kind] || it.kind || ''}</span>}
arrowIcon
clickable
onClick={() => navigate('/macro/finance/' + cat.id + '/' + it.id)}
/>
))}
</List>
</div>
)
}