From ee33f7ffd763c055a80722cbaa777eb9483fc1f6 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Mon, 8 Dec 2025 12:09:24 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=20Community=20?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=EF=BC=8C=E5=B0=86=E5=85=AC=E5=85=B1=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=BF=81=E7=A7=BB=E5=88=B0=20src/components/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 迁移 klineDataCache.js 到 src/utils/stock/(被 StockChart 使用) - 迁移 InvestmentCalendar 到 src/components/InvestmentCalendar/(被 Navbar、Dashboard 使用) - 迁移 DynamicNewsDetail 到 src/components/EventDetailPanel/(被 EventDetail 使用) - 更新所有相关导入路径,使用路径别名 - 保持 Community 目录其余结构不变 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../EventDetailPanel}/CollapsibleHeader.js | 2 +- .../EventDetailPanel}/CollapsibleSection.js | 2 +- .../EventDetailPanel}/CompactMetaBar.js | 2 +- .../EventDetailPanel}/CompactStockItem.js | 2 +- .../DynamicNewsDetailPanel.js | 4 ++-- .../EventDescriptionSection.js | 2 +- .../EventDetailPanel}/EventHeaderInfo.js | 2 +- .../EventDetailPanel}/MiniKLineChart.js | 4 ++-- .../EventDetailPanel}/MiniLineChart.js | 2 +- .../RelatedConceptsSection/ConceptStockItem.js | 2 +- .../DetailedConceptCard.js | 2 +- .../SimpleConceptCard.js | 2 +- .../RelatedConceptsSection/TradingDateInfo.js | 2 +- .../RelatedConceptsSection/index.js | 2 +- .../EventDetailPanel}/RelatedStocksSection.js | 6 +++--- .../EventDetailPanel}/StockListItem.js | 4 ++-- src/components/EventDetailPanel/index.js | 6 ++++++ .../InvestmentCalendar}/InvestmentCalendar.css | 0 .../InvestmentCalendar/index.js} | 18 +++++++++--------- .../Navbars/components/CalendarButton.js | 2 +- .../StockChart/TimelineChartModal.tsx | 2 +- .../StockChart/hooks/useKLineData.ts | 2 +- src/utils/stock/index.js | 12 ++++++++++++ .../utils => utils/stock}/klineDataCache.js | 0 .../Community/components/DynamicNewsCard.js | 2 +- .../components/DynamicNewsDetail/index.js | 5 ----- .../Community/components/EventDetailModal.tsx | 2 +- .../components/MiniTimelineChart.js | 2 +- .../Dashboard/components/CalendarPanel.tsx | 2 +- src/views/EventDetail/index.js | 2 +- 30 files changed, 56 insertions(+), 43 deletions(-) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/CollapsibleHeader.js (98%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/CollapsibleSection.js (97%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/CompactMetaBar.js (97%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/CompactStockItem.js (97%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/DynamicNewsDetailPanel.js (98%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/EventDescriptionSection.js (92%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/EventHeaderInfo.js (98%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/MiniKLineChart.js (98%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/MiniLineChart.js (97%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/RelatedConceptsSection/ConceptStockItem.js (96%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/RelatedConceptsSection/DetailedConceptCard.js (98%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/RelatedConceptsSection/SimpleConceptCard.js (96%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/RelatedConceptsSection/TradingDateInfo.js (93%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/RelatedConceptsSection/index.js (99%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/RelatedStocksSection.js (97%) rename src/{views/Community/components/DynamicNewsDetail => components/EventDetailPanel}/StockListItem.js (99%) create mode 100644 src/components/EventDetailPanel/index.js rename src/{views/Community/components => components/InvestmentCalendar}/InvestmentCalendar.css (100%) rename src/{views/Community/components/InvestmentCalendar.js => components/InvestmentCalendar/index.js} (98%) create mode 100644 src/utils/stock/index.js rename src/{views/Community/components/StockDetailPanel/utils => utils/stock}/klineDataCache.js (100%) delete mode 100644 src/views/Community/components/DynamicNewsDetail/index.js diff --git a/src/views/Community/components/DynamicNewsDetail/CollapsibleHeader.js b/src/components/EventDetailPanel/CollapsibleHeader.js similarity index 98% rename from src/views/Community/components/DynamicNewsDetail/CollapsibleHeader.js rename to src/components/EventDetailPanel/CollapsibleHeader.js index 6872296f..77799a64 100644 --- a/src/views/Community/components/DynamicNewsDetail/CollapsibleHeader.js +++ b/src/components/EventDetailPanel/CollapsibleHeader.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/CollapsibleHeader.js +// src/components/EventDetailPanel/CollapsibleHeader.js // 可折叠模块标题组件 import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/CollapsibleSection.js b/src/components/EventDetailPanel/CollapsibleSection.js similarity index 97% rename from src/views/Community/components/DynamicNewsDetail/CollapsibleSection.js rename to src/components/EventDetailPanel/CollapsibleSection.js index 48d641e1..beb8827d 100644 --- a/src/views/Community/components/DynamicNewsDetail/CollapsibleSection.js +++ b/src/components/EventDetailPanel/CollapsibleSection.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/CollapsibleSection.js +// src/components/EventDetailPanel/CollapsibleSection.js // 通用可折叠区块组件 import React, { useState } from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/CompactMetaBar.js b/src/components/EventDetailPanel/CompactMetaBar.js similarity index 97% rename from src/views/Community/components/DynamicNewsDetail/CompactMetaBar.js rename to src/components/EventDetailPanel/CompactMetaBar.js index d8d9c1ea..525355b5 100644 --- a/src/views/Community/components/DynamicNewsDetail/CompactMetaBar.js +++ b/src/components/EventDetailPanel/CompactMetaBar.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/CompactMetaBar.js +// src/components/EventDetailPanel/CompactMetaBar.js // 精简信息栏组件(无头部模式下右上角显示) import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/CompactStockItem.js b/src/components/EventDetailPanel/CompactStockItem.js similarity index 97% rename from src/views/Community/components/DynamicNewsDetail/CompactStockItem.js rename to src/components/EventDetailPanel/CompactStockItem.js index b7c35204..60be69cb 100644 --- a/src/views/Community/components/DynamicNewsDetail/CompactStockItem.js +++ b/src/components/EventDetailPanel/CompactStockItem.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/CompactStockItem.js +// src/components/EventDetailPanel/CompactStockItem.js // 精简模式股票卡片组件(浮动卡片样式) import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/DynamicNewsDetailPanel.js b/src/components/EventDetailPanel/DynamicNewsDetailPanel.js similarity index 98% rename from src/views/Community/components/DynamicNewsDetail/DynamicNewsDetailPanel.js rename to src/components/EventDetailPanel/DynamicNewsDetailPanel.js index 6e96beef..f4100416 100644 --- a/src/views/Community/components/DynamicNewsDetail/DynamicNewsDetailPanel.js +++ b/src/components/EventDetailPanel/DynamicNewsDetailPanel.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/DynamicNewsDetailPanel.js +// src/components/EventDetailPanel/DynamicNewsDetailPanel.js // 动态新闻详情面板主组件(组装所有子组件) import React, { useState, useCallback, useEffect, useReducer } from 'react'; @@ -16,7 +16,7 @@ import { } from '@chakra-ui/react'; import { getImportanceConfig } from '@constants/importanceLevels'; import { eventService } from '@services/eventService'; -import { useEventStocks } from '../StockDetailPanel/hooks/useEventStocks'; +import { useEventStocks } from '@views/Community/components/StockDetailPanel/hooks/useEventStocks'; import { toggleEventFollow, selectEventFollowStatus } from '@store/slices/communityDataSlice'; import { useAuth } from '@contexts/AuthContext'; import EventHeaderInfo from './EventHeaderInfo'; diff --git a/src/views/Community/components/DynamicNewsDetail/EventDescriptionSection.js b/src/components/EventDetailPanel/EventDescriptionSection.js similarity index 92% rename from src/views/Community/components/DynamicNewsDetail/EventDescriptionSection.js rename to src/components/EventDetailPanel/EventDescriptionSection.js index 353b5c2f..facfd0fd 100644 --- a/src/views/Community/components/DynamicNewsDetail/EventDescriptionSection.js +++ b/src/components/EventDetailPanel/EventDescriptionSection.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/EventDescriptionSection.js +// src/components/EventDetailPanel/EventDescriptionSection.js // 事件描述区组件 import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/EventHeaderInfo.js b/src/components/EventDetailPanel/EventHeaderInfo.js similarity index 98% rename from src/views/Community/components/DynamicNewsDetail/EventHeaderInfo.js rename to src/components/EventDetailPanel/EventHeaderInfo.js index 64b08a06..06bd12aa 100644 --- a/src/views/Community/components/DynamicNewsDetail/EventHeaderInfo.js +++ b/src/components/EventDetailPanel/EventHeaderInfo.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/EventHeaderInfo.js +// src/components/EventDetailPanel/EventHeaderInfo.js // 事件头部信息区组件 import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/MiniKLineChart.js b/src/components/EventDetailPanel/MiniKLineChart.js similarity index 98% rename from src/views/Community/components/DynamicNewsDetail/MiniKLineChart.js rename to src/components/EventDetailPanel/MiniKLineChart.js index 92d0074c..b378f2e6 100644 --- a/src/views/Community/components/DynamicNewsDetail/MiniKLineChart.js +++ b/src/components/EventDetailPanel/MiniKLineChart.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/MiniKLineChart.js +// src/components/EventDetailPanel/MiniKLineChart.js import React, { useState, useEffect, useMemo, useRef } from 'react'; import ReactECharts from 'echarts-for-react'; import dayjs from 'dayjs'; @@ -6,7 +6,7 @@ import { fetchKlineData, getCacheKey, klineDataCache -} from '../StockDetailPanel/utils/klineDataCache'; +} from '@utils/stock/klineDataCache'; /** * 迷你K线图组件 diff --git a/src/views/Community/components/DynamicNewsDetail/MiniLineChart.js b/src/components/EventDetailPanel/MiniLineChart.js similarity index 97% rename from src/views/Community/components/DynamicNewsDetail/MiniLineChart.js rename to src/components/EventDetailPanel/MiniLineChart.js index 1d869273..c75801a8 100644 --- a/src/views/Community/components/DynamicNewsDetail/MiniLineChart.js +++ b/src/components/EventDetailPanel/MiniLineChart.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/MiniLineChart.js +// src/components/EventDetailPanel/MiniLineChart.js // Mini 折线图组件(用于股票卡片) import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/ConceptStockItem.js b/src/components/EventDetailPanel/RelatedConceptsSection/ConceptStockItem.js similarity index 96% rename from src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/ConceptStockItem.js rename to src/components/EventDetailPanel/RelatedConceptsSection/ConceptStockItem.js index d7ff59c3..ea732d21 100644 --- a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/ConceptStockItem.js +++ b/src/components/EventDetailPanel/RelatedConceptsSection/ConceptStockItem.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/ConceptStockItem.js +// src/components/EventDetailPanel/RelatedConceptsSection/ConceptStockItem.js // 概念股票列表项组件 import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/DetailedConceptCard.js b/src/components/EventDetailPanel/RelatedConceptsSection/DetailedConceptCard.js similarity index 98% rename from src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/DetailedConceptCard.js rename to src/components/EventDetailPanel/RelatedConceptsSection/DetailedConceptCard.js index 8ebabd89..24728d60 100644 --- a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/DetailedConceptCard.js +++ b/src/components/EventDetailPanel/RelatedConceptsSection/DetailedConceptCard.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/DetailedConceptCard.js +// src/components/EventDetailPanel/RelatedConceptsSection/DetailedConceptCard.js // 详细概念卡片组件 import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/SimpleConceptCard.js b/src/components/EventDetailPanel/RelatedConceptsSection/SimpleConceptCard.js similarity index 96% rename from src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/SimpleConceptCard.js rename to src/components/EventDetailPanel/RelatedConceptsSection/SimpleConceptCard.js index f89a9d3a..3b547cd3 100644 --- a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/SimpleConceptCard.js +++ b/src/components/EventDetailPanel/RelatedConceptsSection/SimpleConceptCard.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/SimpleConceptCard.js +// src/components/EventDetailPanel/RelatedConceptsSection/SimpleConceptCard.js // 简单概念卡片组件(横向卡片) import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/TradingDateInfo.js b/src/components/EventDetailPanel/RelatedConceptsSection/TradingDateInfo.js similarity index 93% rename from src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/TradingDateInfo.js rename to src/components/EventDetailPanel/RelatedConceptsSection/TradingDateInfo.js index 6a8b159c..a3a406a4 100644 --- a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/TradingDateInfo.js +++ b/src/components/EventDetailPanel/RelatedConceptsSection/TradingDateInfo.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/TradingDateInfo.js +// src/components/EventDetailPanel/RelatedConceptsSection/TradingDateInfo.js // 交易日期信息提示组件 import React from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/index.js b/src/components/EventDetailPanel/RelatedConceptsSection/index.js similarity index 99% rename from src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/index.js rename to src/components/EventDetailPanel/RelatedConceptsSection/index.js index f0581be4..3beb40d5 100644 --- a/src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/index.js +++ b/src/components/EventDetailPanel/RelatedConceptsSection/index.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/RelatedConceptsSection/index.js +// src/components/EventDetailPanel/RelatedConceptsSection/index.js // 相关概念区组件(主组件) import React, { useState, useEffect } from 'react'; diff --git a/src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js b/src/components/EventDetailPanel/RelatedStocksSection.js similarity index 97% rename from src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js rename to src/components/EventDetailPanel/RelatedStocksSection.js index fe5c97e4..590cd139 100644 --- a/src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js +++ b/src/components/EventDetailPanel/RelatedStocksSection.js @@ -1,12 +1,12 @@ -// src/views/Community/components/DynamicNewsDetail/RelatedStocksSection.js +// src/components/EventDetailPanel/RelatedStocksSection.js // 相关股票列表区组件(纯内容,不含标题) import React, { useState, useEffect, useMemo } from 'react'; import { VStack } from '@chakra-ui/react'; import dayjs from 'dayjs'; import StockListItem from './StockListItem'; -import { fetchBatchKlineData, klineDataCache, getCacheKey } from '../StockDetailPanel/utils/klineDataCache'; -import { logger } from '../../../../utils/logger'; +import { fetchBatchKlineData, klineDataCache, getCacheKey } from '@utils/stock/klineDataCache'; +import { logger } from '@utils/logger'; /** * 相关股票列表区组件(纯内容部分) diff --git a/src/views/Community/components/DynamicNewsDetail/StockListItem.js b/src/components/EventDetailPanel/StockListItem.js similarity index 99% rename from src/views/Community/components/DynamicNewsDetail/StockListItem.js rename to src/components/EventDetailPanel/StockListItem.js index 8e3b2a52..9ac9bb25 100644 --- a/src/views/Community/components/DynamicNewsDetail/StockListItem.js +++ b/src/components/EventDetailPanel/StockListItem.js @@ -1,4 +1,4 @@ -// src/views/Community/components/DynamicNewsDetail/StockListItem.js +// src/components/EventDetailPanel/StockListItem.js // 股票卡片组件(融合表格功能的卡片样式) import React, { useState } from 'react'; @@ -20,7 +20,7 @@ import { StarIcon } from '@chakra-ui/icons'; import { Tag } from 'antd'; import { RobotOutlined } from '@ant-design/icons'; import { selectIsMobile } from '@store/slices/deviceSlice'; -import MiniTimelineChart from '../StockDetailPanel/components/MiniTimelineChart'; +import MiniTimelineChart from '@views/Community/components/StockDetailPanel/components/MiniTimelineChart'; import MiniKLineChart from './MiniKLineChart'; import TimelineChartModal from '@components/StockChart/TimelineChartModal'; import KLineChartModal from '@components/StockChart/KLineChartModal'; diff --git a/src/components/EventDetailPanel/index.js b/src/components/EventDetailPanel/index.js new file mode 100644 index 00000000..1318bb5d --- /dev/null +++ b/src/components/EventDetailPanel/index.js @@ -0,0 +1,6 @@ +// src/components/EventDetailPanel/index.js +// 统一导出事件详情面板组件 + +export { default } from './DynamicNewsDetailPanel'; +export { default as DynamicNewsDetailPanel } from './DynamicNewsDetailPanel'; +export { default as EventDetailPanel } from './DynamicNewsDetailPanel'; diff --git a/src/views/Community/components/InvestmentCalendar.css b/src/components/InvestmentCalendar/InvestmentCalendar.css similarity index 100% rename from src/views/Community/components/InvestmentCalendar.css rename to src/components/InvestmentCalendar/InvestmentCalendar.css diff --git a/src/views/Community/components/InvestmentCalendar.js b/src/components/InvestmentCalendar/index.js similarity index 98% rename from src/views/Community/components/InvestmentCalendar.js rename to src/components/InvestmentCalendar/index.js index 03ade6cd..a24a16e9 100644 --- a/src/views/Community/components/InvestmentCalendar.js +++ b/src/components/InvestmentCalendar/index.js @@ -1,4 +1,4 @@ -// src/views/Community/components/InvestmentCalendar.js +// src/components/InvestmentCalendar/index.js import React, { useState, useEffect, useCallback } from 'react'; import { Card, Calendar, Badge, Modal, Table, Tabs, Tag, Button, List, Spin, Empty, @@ -10,14 +10,14 @@ import { } from '@ant-design/icons'; import dayjs from 'dayjs'; import ReactMarkdown from 'react-markdown'; -import { eventService, stockService } from '../../../services/eventService'; -import KLineChartModal from '../../../components/StockChart/KLineChartModal'; -import { useSubscription } from '../../../hooks/useSubscription'; -import SubscriptionUpgradeModal from '../../../components/SubscriptionUpgradeModal'; -import CitationMark from '../../../components/Citation/CitationMark'; -import CitedContent from '../../../components/Citation/CitedContent'; -import { processCitationData } from '../../../utils/citationUtils'; -import { logger } from '../../../utils/logger'; +import { eventService, stockService } from '@services/eventService'; +import KLineChartModal from '@components/StockChart/KLineChartModal'; +import { useSubscription } from '@hooks/useSubscription'; +import SubscriptionUpgradeModal from '@components/SubscriptionUpgradeModal'; +import CitationMark from '@components/Citation/CitationMark'; +import CitedContent from '@components/Citation/CitedContent'; +import { processCitationData } from '@utils/citationUtils'; +import { logger } from '@utils/logger'; import './InvestmentCalendar.css'; const { TabPane } = Tabs; diff --git a/src/components/Navbars/components/CalendarButton.js b/src/components/Navbars/components/CalendarButton.js index 90da16d0..8b2f7a12 100644 --- a/src/components/Navbars/components/CalendarButton.js +++ b/src/components/Navbars/components/CalendarButton.js @@ -10,7 +10,7 @@ import { ModalCloseButton } from '@chakra-ui/react'; import { FiCalendar } from 'react-icons/fi'; -import InvestmentCalendar from '../../../views/Community/components/InvestmentCalendar'; +import InvestmentCalendar from '@components/InvestmentCalendar'; /** * 投资日历按钮组件 diff --git a/src/components/StockChart/TimelineChartModal.tsx b/src/components/StockChart/TimelineChartModal.tsx index 5328e551..7981b098 100644 --- a/src/components/StockChart/TimelineChartModal.tsx +++ b/src/components/StockChart/TimelineChartModal.tsx @@ -19,7 +19,7 @@ import { } from '@chakra-ui/react'; import * as echarts from 'echarts'; import dayjs from 'dayjs'; -import { klineDataCache, getCacheKey, fetchKlineData } from '@views/Community/components/StockDetailPanel/utils/klineDataCache'; +import { klineDataCache, getCacheKey, fetchKlineData } from '@utils/stock/klineDataCache'; import { selectIsMobile } from '@store/slices/deviceSlice'; import { StockInfo } from './types'; diff --git a/src/components/StockChart/hooks/useKLineData.ts b/src/components/StockChart/hooks/useKLineData.ts index 96ea3feb..8ce4680c 100644 --- a/src/components/StockChart/hooks/useKLineData.ts +++ b/src/components/StockChart/hooks/useKLineData.ts @@ -9,7 +9,7 @@ import type { Chart } from 'klinecharts'; import type { ChartType, KLineDataPoint, RawDataPoint } from '../types'; import { processChartData } from '../utils/dataAdapter'; import { stockService } from '@services/eventService'; -import { klineDataCache, getCacheKey } from '@views/Community/components/StockDetailPanel/utils/klineDataCache'; +import { klineDataCache, getCacheKey } from '@utils/stock/klineDataCache'; export interface UseKLineDataOptions { /** KLineChart 实例 */ diff --git a/src/utils/stock/index.js b/src/utils/stock/index.js new file mode 100644 index 00000000..d1206b3c --- /dev/null +++ b/src/utils/stock/index.js @@ -0,0 +1,12 @@ +// src/utils/stock/index.js +// K线数据缓存工具 +export { + klineDataCache, + getCacheKey, + fetchKlineData, + fetchBatchKlineData, + preloadBatchKlineData, + clearCache, + clearAllCache, + getCacheStats, +} from './klineDataCache'; diff --git a/src/views/Community/components/StockDetailPanel/utils/klineDataCache.js b/src/utils/stock/klineDataCache.js similarity index 100% rename from src/views/Community/components/StockDetailPanel/utils/klineDataCache.js rename to src/utils/stock/klineDataCache.js diff --git a/src/views/Community/components/DynamicNewsCard.js b/src/views/Community/components/DynamicNewsCard.js index b9e28205..8642f07c 100644 --- a/src/views/Community/components/DynamicNewsCard.js +++ b/src/views/Community/components/DynamicNewsCard.js @@ -34,7 +34,7 @@ import { useNotification } from '../../../contexts/NotificationContext'; import EventScrollList from './DynamicNewsCard/EventScrollList'; import ModeToggleButtons from './DynamicNewsCard/ModeToggleButtons'; import PaginationControl from './DynamicNewsCard/PaginationControl'; -import DynamicNewsDetailPanel from './DynamicNewsDetail'; +import DynamicNewsDetailPanel from '@components/EventDetailPanel'; import CompactSearchBox from './CompactSearchBox'; import { fetchDynamicNews, diff --git a/src/views/Community/components/DynamicNewsDetail/index.js b/src/views/Community/components/DynamicNewsDetail/index.js deleted file mode 100644 index 7ebd7ce1..00000000 --- a/src/views/Community/components/DynamicNewsDetail/index.js +++ /dev/null @@ -1,5 +0,0 @@ -// src/views/Community/components/DynamicNewsDetail/index.js -// 统一导出 DynamicNewsDetailPanel 组件 - -export { default } from './DynamicNewsDetailPanel'; -export { default as DynamicNewsDetailPanel } from './DynamicNewsDetailPanel'; diff --git a/src/views/Community/components/EventDetailModal.tsx b/src/views/Community/components/EventDetailModal.tsx index 315e6846..fe1e6b71 100644 --- a/src/views/Community/components/EventDetailModal.tsx +++ b/src/views/Community/components/EventDetailModal.tsx @@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'; import { Drawer } from 'antd'; import { CloseOutlined } from '@ant-design/icons'; import { selectIsMobile } from '@store/slices/deviceSlice'; -import DynamicNewsDetailPanel from './DynamicNewsDetail/DynamicNewsDetailPanel'; +import DynamicNewsDetailPanel from '@components/EventDetailPanel'; import './EventDetailModal.less'; interface EventDetailModalProps { diff --git a/src/views/Community/components/StockDetailPanel/components/MiniTimelineChart.js b/src/views/Community/components/StockDetailPanel/components/MiniTimelineChart.js index 89561b1a..83eb843c 100644 --- a/src/views/Community/components/StockDetailPanel/components/MiniTimelineChart.js +++ b/src/views/Community/components/StockDetailPanel/components/MiniTimelineChart.js @@ -8,7 +8,7 @@ import { getCacheKey, klineDataCache, batchPendingRequests -} from '../utils/klineDataCache'; +} from '@utils/stock/klineDataCache'; /** * 迷你分时图组件 diff --git a/src/views/Dashboard/components/CalendarPanel.tsx b/src/views/Dashboard/components/CalendarPanel.tsx index f8a8f11e..354e707e 100644 --- a/src/views/Dashboard/components/CalendarPanel.tsx +++ b/src/views/Dashboard/components/CalendarPanel.tsx @@ -29,7 +29,7 @@ import type { InvestmentEvent } from '@/types'; import './InvestmentCalendar.less'; // 懒加载投资日历组件 -const InvestmentCalendar = lazy(() => import('@/views/Community/components/InvestmentCalendar')); +const InvestmentCalendar = lazy(() => import('@components/InvestmentCalendar')); dayjs.locale('zh-cn'); diff --git a/src/views/EventDetail/index.js b/src/views/EventDetail/index.js index 0fc6ce8a..ab2efc94 100644 --- a/src/views/EventDetail/index.js +++ b/src/views/EventDetail/index.js @@ -12,7 +12,7 @@ import { } from '@chakra-ui/react'; import { decodeEventId } from '@/utils/idEncoder'; import { eventService } from '@/services/eventService'; -import { DynamicNewsDetailPanel } from '@/views/Community/components/DynamicNewsDetail'; +import { DynamicNewsDetailPanel } from '@components/EventDetailPanel'; import { logger } from '@/utils/logger'; import ErrorPage from '@/components/ErrorPage';