refactor: 移除暗色模式相关代码,使用固定浅色主题
- DeepAnalysisTab: 移除 useColorModeValue,使用固定颜色值 - NewsEventsTab: 移除 useColorModeValue,简化 hover 颜色 - FinancialPanorama: 移除 useColorMode/useColorModeValue - MarketDataView: 移除 dark 主题配置,简化颜色逻辑 - StockQuoteCard: 移除 useColorModeValue,使用固定颜色 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,6 @@ import {
|
||||
VStack,
|
||||
HStack,
|
||||
Divider,
|
||||
useColorModeValue,
|
||||
Select,
|
||||
Button,
|
||||
Tooltip,
|
||||
@@ -60,7 +59,6 @@ import {
|
||||
GridItem,
|
||||
ButtonGroup,
|
||||
Stack,
|
||||
useColorMode,
|
||||
Icon,
|
||||
InputGroup,
|
||||
InputLeftElement,
|
||||
@@ -121,25 +119,6 @@ const themes = {
|
||||
border: '#CBD5E0',
|
||||
chartBg: '#FFFFFF',
|
||||
},
|
||||
dark: {
|
||||
// 夜间模式 - 黑+金
|
||||
primary: '#FFD700',
|
||||
primaryDark: '#FFA500',
|
||||
secondary: '#1A1A1A',
|
||||
secondaryDark: '#000000',
|
||||
success: '#FF4444', // 涨 - 红色
|
||||
danger: '#00C851', // 跌 - 绿色
|
||||
warning: '#FFA500',
|
||||
info: '#00BFFF',
|
||||
bgMain: '#0A0A0A',
|
||||
bgCard: '#141414',
|
||||
bgDark: '#000000',
|
||||
textPrimary: '#FFFFFF',
|
||||
textSecondary: '#FFD700',
|
||||
textMuted: '#999999',
|
||||
border: '#333333',
|
||||
chartBg: '#141414',
|
||||
}
|
||||
};
|
||||
|
||||
// API服务
|
||||
@@ -236,9 +215,9 @@ const ThemedCard = ({ children, theme, ...props }) => {
|
||||
};
|
||||
|
||||
// Markdown渲染组件
|
||||
const MarkdownRenderer = ({ children, theme, colorMode }) => {
|
||||
const MarkdownRenderer = ({ children, theme }) => {
|
||||
return (
|
||||
<Box
|
||||
<Box
|
||||
color={theme.textPrimary}
|
||||
sx={{
|
||||
'& h1, & h2, & h3, & h4, & h5, & h6': {
|
||||
@@ -269,7 +248,7 @@ const MarkdownRenderer = ({ children, theme, colorMode }) => {
|
||||
fontStyle: 'italic'
|
||||
},
|
||||
'& code': {
|
||||
backgroundColor: colorMode === 'light' ? 'rgba(0,0,0,0.05)' : 'rgba(255,255,255,0.1)',
|
||||
backgroundColor: 'rgba(0,0,0,0.05)',
|
||||
padding: '2px 4px',
|
||||
borderRadius: '4px',
|
||||
fontSize: '0.9em'
|
||||
@@ -290,13 +269,12 @@ const MarkdownRenderer = ({ children, theme, colorMode }) => {
|
||||
|
||||
// 主组件
|
||||
const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
const { colorMode } = useColorMode();
|
||||
const toast = useToast();
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const [modalContent, setModalContent] = useState(null);
|
||||
|
||||
|
||||
// 获取当前主题
|
||||
const theme = colorMode === 'light' ? themes.light : themes.dark;
|
||||
const theme = themes.light;
|
||||
|
||||
// 状态管理
|
||||
const [stockCode, setStockCode] = useState(propStockCode || '600000');
|
||||
@@ -464,7 +442,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
opacity: 0.8
|
||||
}
|
||||
},
|
||||
backgroundColor: colorMode === 'light' ? 'rgba(255,255,255,0.9)' : 'rgba(0,0,0,0.8)',
|
||||
backgroundColor: 'rgba(255,255,255,0.9)',
|
||||
borderColor: theme.primary,
|
||||
borderWidth: 1,
|
||||
textStyle: {
|
||||
@@ -682,7 +660,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'cross' },
|
||||
backgroundColor: colorMode === 'light' ? 'rgba(255,255,255,0.95)' : 'rgba(0,0,0,0.85)',
|
||||
backgroundColor: 'rgba(255,255,255,0.95)',
|
||||
borderColor: theme.primary,
|
||||
borderWidth: 1,
|
||||
textStyle: {
|
||||
@@ -889,7 +867,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
backgroundColor: colorMode === 'light' ? 'rgba(255,255,255,0.9)' : 'rgba(0,0,0,0.8)',
|
||||
backgroundColor: 'rgba(255,255,255,0.9)',
|
||||
borderColor: theme.primary,
|
||||
borderWidth: 1,
|
||||
textStyle: {
|
||||
@@ -1022,7 +1000,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
backgroundColor: colorMode === 'light' ? 'rgba(255,255,255,0.9)' : 'rgba(0,0,0,0.8)',
|
||||
backgroundColor: 'rgba(255,255,255,0.9)',
|
||||
borderColor: theme.primary,
|
||||
borderWidth: 1,
|
||||
textStyle: {
|
||||
@@ -1130,7 +1108,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<Heading size="xl" color={theme.textSecondary}>
|
||||
{summary.stock_name}
|
||||
</Heading>
|
||||
<Badge colorScheme={colorMode === 'light' ? 'blue' : 'yellow'} fontSize="lg">
|
||||
<Badge colorScheme={'blue'} fontSize="lg">
|
||||
{summary.stock_code}
|
||||
</Badge>
|
||||
</HStack>
|
||||
@@ -1236,7 +1214,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
) : (
|
||||
<Tabs
|
||||
variant="soft-rounded"
|
||||
colorScheme={colorMode === 'light' ? 'blue' : 'yellow'}
|
||||
colorScheme={'blue'}
|
||||
index={activeTab}
|
||||
onChange={setActiveTab}
|
||||
>
|
||||
@@ -1249,31 +1227,31 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
>
|
||||
<HStack justify="space-between" align="center" spacing={4}>
|
||||
<TabList overflowX="auto" border="none" flex="1">
|
||||
<Tab color={theme.textMuted} _selected={{ color: colorMode === 'light' ? 'white' : theme.secondary, bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<Tab color={theme.textMuted} _selected={{ color: 'white', bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<HStack spacing={1}>
|
||||
<Icon as={ChevronUpIcon} boxSize={4} />
|
||||
<Text>交易数据</Text>
|
||||
</HStack>
|
||||
</Tab>
|
||||
<Tab color={theme.textMuted} _selected={{ color: colorMode === 'light' ? 'white' : theme.secondary, bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<Tab color={theme.textMuted} _selected={{ color: 'white', bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<HStack spacing={1}>
|
||||
<Icon as={UnlockIcon} boxSize={4} />
|
||||
<Text>融资融券</Text>
|
||||
</HStack>
|
||||
</Tab>
|
||||
<Tab color={theme.textMuted} _selected={{ color: colorMode === 'light' ? 'white' : theme.secondary, bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<Tab color={theme.textMuted} _selected={{ color: 'white', bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<HStack spacing={1}>
|
||||
<Icon as={ArrowUpIcon} boxSize={4} />
|
||||
<Text>大宗交易</Text>
|
||||
</HStack>
|
||||
</Tab>
|
||||
<Tab color={theme.textMuted} _selected={{ color: colorMode === 'light' ? 'white' : theme.secondary, bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<Tab color={theme.textMuted} _selected={{ color: 'white', bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<HStack spacing={1}>
|
||||
<Icon as={StarIcon} boxSize={4} />
|
||||
<Text>龙虎榜</Text>
|
||||
</HStack>
|
||||
</Tab>
|
||||
<Tab color={theme.textMuted} _selected={{ color: colorMode === 'light' ? 'white' : theme.secondary, bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<Tab color={theme.textMuted} _selected={{ color: 'white', bg: theme.primary }} fontSize="sm" px={3}>
|
||||
<HStack spacing={1}>
|
||||
<Icon as={LockIcon} boxSize={4} />
|
||||
<Text>股权质押</Text>
|
||||
@@ -1301,7 +1279,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<Button
|
||||
leftIcon={<RepeatIcon />}
|
||||
variant="outline"
|
||||
colorScheme={colorMode === 'light' ? 'blue' : 'yellow'}
|
||||
colorScheme={'blue'}
|
||||
onClick={loadMarketData}
|
||||
isLoading={loading}
|
||||
size="sm"
|
||||
@@ -1323,7 +1301,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<ReactECharts
|
||||
option={getKLineOption()}
|
||||
style={{ height: '100%', width: '100%' }}
|
||||
theme={colorMode === 'light' ? 'light' : 'dark'}
|
||||
theme={'light'}
|
||||
onEvents={{
|
||||
'click': (params) => {
|
||||
if (params.seriesName === '涨幅分析' && params.data) {
|
||||
@@ -1343,7 +1321,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
</Box>
|
||||
|
||||
{analysis.main_business && (
|
||||
<Box p={4} bg={colorMode === 'light' ? 'gray.50' : 'gray.900'} borderRadius="md">
|
||||
<Box p={4} bg={'gray.50'} borderRadius="md">
|
||||
<Heading size="sm" mb={2} color={theme.primary}>主营业务</Heading>
|
||||
<Text color={theme.textPrimary}>{analysis.main_business}</Text>
|
||||
</Box>
|
||||
@@ -1351,18 +1329,18 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
|
||||
|
||||
{analysis.rise_reason_detail && (
|
||||
<Box p={4} bg={colorMode === 'light' ? 'purple.50' : 'purple.900'} borderRadius="md">
|
||||
<Box p={4} bg={'purple.50'} borderRadius="md">
|
||||
<Heading size="sm" mb={2} color={theme.primary}>详细分析</Heading>
|
||||
<MarkdownRenderer theme={theme} colorMode={colorMode}>
|
||||
<MarkdownRenderer theme={theme}>
|
||||
{analysis.rise_reason_detail}
|
||||
</MarkdownRenderer>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{analysis.announcements && analysis.announcements !== '[]' && (
|
||||
<Box p={4} bg={colorMode === 'light' ? 'orange.50' : 'orange.900'} borderRadius="md">
|
||||
<Box p={4} bg={'orange.50'} borderRadius="md">
|
||||
<Heading size="sm" mb={2} color={theme.primary}>相关公告</Heading>
|
||||
<MarkdownRenderer theme={theme} colorMode={colorMode}>
|
||||
<MarkdownRenderer theme={theme}>
|
||||
{analysis.announcements}
|
||||
</MarkdownRenderer>
|
||||
</Box>
|
||||
@@ -1370,7 +1348,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
|
||||
{/* 研报引用展示 */}
|
||||
{analysis.verification_reports && analysis.verification_reports.length > 0 && (
|
||||
<Box p={4} bg={colorMode === 'light' ? 'blue.50' : 'blue.900'} borderRadius="md">
|
||||
<Box p={4} bg={'blue.50'} borderRadius="md">
|
||||
<Heading size="sm" mb={3} color={theme.primary}>
|
||||
<HStack spacing={2}>
|
||||
<Icon as={ExternalLinkIcon} />
|
||||
@@ -1382,7 +1360,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<Box
|
||||
key={reportIdx}
|
||||
p={3}
|
||||
bg={colorMode === 'light' ? 'white' : 'gray.800'}
|
||||
bg={'white'}
|
||||
borderRadius="md"
|
||||
border="1px solid"
|
||||
borderColor={theme.border}
|
||||
@@ -1428,7 +1406,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
{report.verification_item && (
|
||||
<Box
|
||||
p={2}
|
||||
bg={colorMode === 'light' ? 'yellow.50' : 'yellow.900'}
|
||||
bg={'yellow.50'}
|
||||
borderRadius="sm"
|
||||
mb={2}
|
||||
>
|
||||
@@ -1479,7 +1457,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
当日分钟频数据
|
||||
</Heading>
|
||||
{minuteData && minuteData.trade_date && (
|
||||
<Badge colorScheme={colorMode === 'light' ? 'blue' : 'yellow'} fontSize="xs">
|
||||
<Badge colorScheme={'blue'} fontSize="xs">
|
||||
{minuteData.trade_date}
|
||||
</Badge>
|
||||
)}
|
||||
@@ -1488,7 +1466,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
leftIcon={<RepeatIcon />}
|
||||
size="sm"
|
||||
variant="outline"
|
||||
colorScheme={colorMode === 'light' ? 'blue' : 'yellow'}
|
||||
colorScheme={'blue'}
|
||||
onClick={loadMinuteData}
|
||||
isLoading={minuteLoading}
|
||||
loadingText="获取中"
|
||||
@@ -1520,7 +1498,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<ReactECharts
|
||||
option={getMinuteKLineOption()}
|
||||
style={{ height: '100%', width: '100%' }}
|
||||
theme={colorMode === 'light' ? 'light' : 'dark'}
|
||||
theme={'light'}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -1592,7 +1570,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
{/* 成交量分析 */}
|
||||
<Box
|
||||
p={4}
|
||||
bg={colorMode === 'light' ? theme.bgDark : 'rgba(255, 215, 0, 0.05)'}
|
||||
bg={theme.bgDark}
|
||||
borderRadius="lg"
|
||||
border="1px solid"
|
||||
borderColor={theme.border}
|
||||
@@ -1687,7 +1665,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{tradeData.slice(-10).reverse().map((item, idx) => (
|
||||
<Tr key={idx} _hover={{ bg: colorMode === 'light' ? theme.bgDark : 'rgba(255, 215, 0, 0.1)' }}>
|
||||
<Tr key={idx} _hover={{ bg: theme.bgDark }}>
|
||||
<Td color={theme.textPrimary}>{item.date}</Td>
|
||||
<Td isNumeric color={theme.textPrimary}>{item.open}</Td>
|
||||
<Td isNumeric color={theme.textPrimary}>{item.high}</Td>
|
||||
@@ -1718,7 +1696,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<ReactECharts
|
||||
option={getFundingOption()}
|
||||
style={{ height: '100%', width: '100%' }}
|
||||
theme={colorMode === 'light' ? 'light' : 'dark'}
|
||||
theme={'light'}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
@@ -1735,7 +1713,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<CardBody>
|
||||
<VStack spacing={3} align="stretch">
|
||||
{fundingData.slice(-5).reverse().map((item, idx) => (
|
||||
<Box key={idx} p={3} bg={colorMode === 'light' ? 'rgba(255, 68, 68, 0.05)' : 'rgba(255, 68, 68, 0.1)'} borderRadius="md">
|
||||
<Box key={idx} p={3} bg={'rgba(255, 68, 68, 0.05)'} borderRadius="md">
|
||||
<HStack justify="space-between">
|
||||
<Text color={theme.textMuted}>{item.date}</Text>
|
||||
<VStack align="end" spacing={0}>
|
||||
@@ -1762,7 +1740,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<CardBody>
|
||||
<VStack spacing={3} align="stretch">
|
||||
{fundingData.slice(-5).reverse().map((item, idx) => (
|
||||
<Box key={idx} p={3} bg={colorMode === 'light' ? 'rgba(0, 200, 81, 0.05)' : 'rgba(0, 200, 81, 0.1)'} borderRadius="md">
|
||||
<Box key={idx} p={3} bg={'rgba(0, 200, 81, 0.05)'} borderRadius="md">
|
||||
<HStack justify="space-between">
|
||||
<Text color={theme.textMuted}>{item.date}</Text>
|
||||
<VStack align="end" spacing={0}>
|
||||
@@ -1798,7 +1776,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<Box
|
||||
key={idx}
|
||||
p={4}
|
||||
bg={colorMode === 'light' ? theme.bgDark : 'rgba(255, 215, 0, 0.05)'}
|
||||
bg={theme.bgDark}
|
||||
borderRadius="lg"
|
||||
border="1px solid"
|
||||
borderColor={theme.border}
|
||||
@@ -1808,7 +1786,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
{dayStats.date}
|
||||
</Text>
|
||||
<HStack spacing={4}>
|
||||
<Badge colorScheme={colorMode === 'light' ? 'blue' : 'yellow'} fontSize="md">
|
||||
<Badge colorScheme={'blue'} fontSize="md">
|
||||
交易笔数: {dayStats.count}
|
||||
</Badge>
|
||||
<Badge colorScheme="green" fontSize="md">
|
||||
@@ -1838,7 +1816,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
</Thead>
|
||||
<Tbody>
|
||||
{dayStats.deals.map((deal, i) => (
|
||||
<Tr key={i} _hover={{ bg: colorMode === 'light' ? 'rgba(43, 108, 176, 0.05)' : 'rgba(255, 215, 0, 0.1)' }}>
|
||||
<Tr key={i} _hover={{ bg: 'rgba(43, 108, 176, 0.05)' }}>
|
||||
<Td color={theme.textPrimary} fontSize="xs" maxW="200px" isTruncated>
|
||||
<Tooltip label={deal.buyer_dept || '-'} placement="top">
|
||||
<Text>{deal.buyer_dept || '-'}</Text>
|
||||
@@ -1891,7 +1869,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<Box
|
||||
key={idx}
|
||||
p={4}
|
||||
bg={colorMode === 'light' ? theme.bgDark : 'rgba(255, 215, 0, 0.05)'}
|
||||
bg={theme.bgDark}
|
||||
borderRadius="lg"
|
||||
border="1px solid"
|
||||
borderColor={theme.border}
|
||||
@@ -1925,7 +1903,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
key={i}
|
||||
justify="space-between"
|
||||
p={2}
|
||||
bg={colorMode === 'light' ? 'rgba(255, 68, 68, 0.05)' : 'rgba(255, 68, 68, 0.1)'}
|
||||
bg={'rgba(255, 68, 68, 0.05)'}
|
||||
borderRadius="md"
|
||||
>
|
||||
<Text fontSize="sm" color={theme.textPrimary} isTruncated maxW="70%">
|
||||
@@ -1953,7 +1931,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
key={i}
|
||||
justify="space-between"
|
||||
p={2}
|
||||
bg={colorMode === 'light' ? 'rgba(0, 200, 81, 0.05)' : 'rgba(0, 200, 81, 0.1)'}
|
||||
bg={'rgba(0, 200, 81, 0.05)'}
|
||||
borderRadius="md"
|
||||
>
|
||||
<Text fontSize="sm" color={theme.textPrimary} isTruncated maxW="70%">
|
||||
@@ -1975,7 +1953,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<HStack mt={3} spacing={2}>
|
||||
<Text fontSize="sm" color={theme.textMuted}>类型:</Text>
|
||||
{dayData.info_types && dayData.info_types.map((type, i) => (
|
||||
<Badge key={i} colorScheme={colorMode === 'light' ? 'blue' : 'yellow'} fontSize="xs">
|
||||
<Badge key={i} colorScheme={'blue'} fontSize="xs">
|
||||
{type}
|
||||
</Badge>
|
||||
))}
|
||||
@@ -2002,7 +1980,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<ReactECharts
|
||||
option={getPledgeOption()}
|
||||
style={{ height: '100%', width: '100%' }}
|
||||
theme={colorMode === 'light' ? 'light' : 'dark'}
|
||||
theme={'light'}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
@@ -2032,7 +2010,7 @@ const MarketDataView = ({ stockCode: propStockCode }) => {
|
||||
<Tbody>
|
||||
{Array.isArray(pledgeData) && pledgeData.length > 0 ? (
|
||||
pledgeData.map((item, idx) => (
|
||||
<Tr key={idx} _hover={{ bg: colorMode === 'light' ? theme.bgDark : 'rgba(255, 215, 0, 0.1)' }}>
|
||||
<Tr key={idx} _hover={{ bg: theme.bgDark }}>
|
||||
<Td color={theme.textPrimary}>{item.end_date}</Td>
|
||||
<Td isNumeric color={theme.textPrimary}>{formatUtils.formatNumber(item.unrestricted_pledge, 0)}</Td>
|
||||
<Td isNumeric color={theme.textPrimary}>{formatUtils.formatNumber(item.restricted_pledge, 0)}</Td>
|
||||
|
||||
Reference in New Issue
Block a user