fix: 适配 watchlist 新数据结构

- CompactSearchBox: 改用 Redux 获取股票列表
 - useWatchlist: 适配 { stock_code, stock_name }[] 结构
 - Center: 修复 watchlist key + H5 评论 Badge 溢出
This commit is contained in:
zdl
2025-12-05 17:23:51 +08:00
parent e8a9a6f180
commit b74d88e592
3 changed files with 30 additions and 17 deletions

View File

@@ -321,7 +321,7 @@ export default function CenterDashboard() {
<VStack align="stretch" spacing={2}>
{watchlist.slice(0, 10).map((stock) => (
<LinkBox
key={stock.id}
key={stock.stock_code}
p={3}
borderRadius="md"
_hover={{ bg: hoverBg }}
@@ -568,15 +568,22 @@ export default function CenterDashboard() {
<Text fontSize="sm" noOfLines={3}>
{comment.content}
</Text>
<HStack justify="space-between" fontSize="xs" color={secondaryText}>
<HStack>
<HStack justify="space-between" fontSize="xs" color={secondaryText} spacing={2}>
<HStack flexShrink={0}>
<Icon as={FiClock} />
<Text>{formatDate(comment.created_at)}</Text>
</HStack>
{comment.event_title && (
<Tooltip label={comment.event_title}>
<Badge variant="subtle" fontSize="xs">
{comment.event_title.slice(0, 20)}...
<Badge
variant="subtle"
fontSize="xs"
maxW={{ base: '120px', md: '180px' }}
overflow="hidden"
textOverflow="ellipsis"
whiteSpace="nowrap"
>
{comment.event_title}
</Badge>
</Tooltip>
)}