feat: 添加重要性等级说明
This commit is contained in:
@@ -55,6 +55,7 @@ import moment from 'moment';
|
|||||||
import { logger } from '../../../utils/logger';
|
import { logger } from '../../../utils/logger';
|
||||||
import { getApiBase } from '../../../utils/apiConfig';
|
import { getApiBase } from '../../../utils/apiConfig';
|
||||||
import { useEventNotifications } from '../../../hooks/useEventNotifications';
|
import { useEventNotifications } from '../../../hooks/useEventNotifications';
|
||||||
|
import { getImportanceConfig, getAllImportanceLevels } from '../../../constants/importanceLevels';
|
||||||
|
|
||||||
// ========== 工具函数定义在组件外部 ==========
|
// ========== 工具函数定义在组件外部 ==========
|
||||||
// 涨跌颜色配置(中国A股配色:红涨绿跌)- 分档次显示
|
// 涨跌颜色配置(中国A股配色:红涨绿跌)- 分档次显示
|
||||||
@@ -115,45 +116,7 @@ const getPriceChangeBorderColor = (value) => {
|
|||||||
return 'gray.300';
|
return 'gray.300';
|
||||||
};
|
};
|
||||||
|
|
||||||
// 重要性等级配置 - 金融配色方案
|
// 重要性等级配置已移至 src/constants/importanceLevels.js
|
||||||
const importanceLevels = {
|
|
||||||
'S': {
|
|
||||||
color: 'purple.600',
|
|
||||||
bgColor: 'purple.50',
|
|
||||||
borderColor: 'purple.200',
|
|
||||||
icon: WarningIcon,
|
|
||||||
label: '极高',
|
|
||||||
dotBg: 'purple.500',
|
|
||||||
},
|
|
||||||
'A': {
|
|
||||||
color: 'red.600',
|
|
||||||
bgColor: 'red.50',
|
|
||||||
borderColor: 'red.200',
|
|
||||||
icon: WarningTwoIcon,
|
|
||||||
label: '高',
|
|
||||||
dotBg: 'red.500',
|
|
||||||
},
|
|
||||||
'B': {
|
|
||||||
color: 'orange.600',
|
|
||||||
bgColor: 'orange.50',
|
|
||||||
borderColor: 'orange.200',
|
|
||||||
icon: InfoIcon,
|
|
||||||
label: '中',
|
|
||||||
dotBg: 'orange.500',
|
|
||||||
},
|
|
||||||
'C': {
|
|
||||||
color: 'green.600',
|
|
||||||
bgColor: 'green.50',
|
|
||||||
borderColor: 'green.200',
|
|
||||||
icon: CheckCircleIcon,
|
|
||||||
label: '低',
|
|
||||||
dotBg: 'green.500',
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const getImportanceConfig = (importance) => {
|
|
||||||
return importanceLevels[importance] || importanceLevels['C'];
|
|
||||||
};
|
|
||||||
|
|
||||||
// 自定义的涨跌箭头组件(修复颜色问题)
|
// 自定义的涨跌箭头组件(修复颜色问题)
|
||||||
const PriceArrow = ({ value }) => {
|
const PriceArrow = ({ value }) => {
|
||||||
@@ -558,15 +521,54 @@ const EventList = ({ events, pagination, onPageChange, onEventClick, onViewDetai
|
|||||||
{event.title}
|
{event.title}
|
||||||
</Heading>
|
</Heading>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
<Tooltip
|
||||||
|
label={
|
||||||
|
<VStack align="start" spacing={1} maxW="320px">
|
||||||
|
<Text fontWeight="bold" fontSize="sm" mb={1}>
|
||||||
|
重要性等级说明
|
||||||
|
</Text>
|
||||||
|
<Divider borderColor="gray.300" />
|
||||||
|
{getAllImportanceLevels().map((level) => (
|
||||||
|
<HStack key={level.level} spacing={2} align="center" w="full" py={0.5}>
|
||||||
|
<Circle
|
||||||
|
size="8px"
|
||||||
|
bg={level.dotBg}
|
||||||
|
flexShrink={0}
|
||||||
|
/>
|
||||||
|
<Text fontSize="xs" color="gray.700" lineHeight="1.5">
|
||||||
|
<Text as="span" fontWeight="bold">{level.level}级</Text>
|
||||||
|
{level.description}
|
||||||
|
</Text>
|
||||||
|
</HStack>
|
||||||
|
))}
|
||||||
|
</VStack>
|
||||||
|
}
|
||||||
|
placement="left"
|
||||||
|
hasArrow
|
||||||
|
bg="white"
|
||||||
|
color="gray.800"
|
||||||
|
fontSize="md"
|
||||||
|
p={3}
|
||||||
|
borderRadius="lg"
|
||||||
|
borderWidth="1px"
|
||||||
|
borderColor="gray.200"
|
||||||
|
boxShadow="lg"
|
||||||
|
>
|
||||||
<Badge
|
<Badge
|
||||||
colorScheme={importance.color.split('.')[0]}
|
colorScheme={importance.color.split('.')[0]}
|
||||||
px={3}
|
px={3}
|
||||||
py={1}
|
py={1}
|
||||||
borderRadius="full"
|
borderRadius="full"
|
||||||
fontSize="sm"
|
fontSize="sm"
|
||||||
|
cursor="help"
|
||||||
|
display="flex"
|
||||||
|
alignItems="center"
|
||||||
|
gap={1}
|
||||||
>
|
>
|
||||||
|
<InfoIcon boxSize={3} />
|
||||||
{importance.label}优先级
|
{importance.label}优先级
|
||||||
</Badge>
|
</Badge>
|
||||||
|
</Tooltip>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
{/* 元信息 */}
|
{/* 元信息 */}
|
||||||
|
|||||||
Reference in New Issue
Block a user