update ui

This commit is contained in:
2025-11-13 22:35:33 +08:00
parent c6062efb00
commit f0bb00a2ce
4 changed files with 89 additions and 103 deletions

View File

@@ -398,41 +398,89 @@ const [currentMode, setCurrentMode] = useState('vertical');
} }
}} }}
> >
{/* 标题和搜索部分 - 一体化单行布局 */} {/* 标题和搜索部分 - 优化版 */}
<CardHeader <CardHeader
ref={cardHeaderRef} ref={cardHeaderRef}
position="relative" position="relative"
zIndex={1} zIndex={1}
pb={4} pb={3}
> >
{/* 一体化标题栏:左侧标题+badges | 中间筛选组件 | 右侧通知+时间 */} <VStack spacing={3} align="stretch">
<Flex {/* 第一行:标题 + 通知开关 + 更新时间 */}
justify="space-between" <Flex justify="space-between" align="center">
align="center" {/* 左侧:标题 */}
gap={4} <Heading size="md">
bg={useColorModeValue('gray.50', 'gray.800')}
borderRadius="lg"
p={3}
borderWidth="1px"
borderColor={borderColor}
>
{/* 左侧:标题 + Badges */}
<HStack spacing={3} minW="200px" flexShrink={0}>
<Heading size="md" whiteSpace="nowrap">
<HStack spacing={2}> <HStack spacing={2}>
<TimeIcon /> <TimeIcon />
<Text>实时要闻</Text> <Text>实时要闻·动态追踪</Text>
</HStack> </HStack>
</Heading> </Heading>
<HStack spacing={1}>
<Badge colorScheme="red" fontSize="xs">实时</Badge>
<Badge colorScheme="green" fontSize="xs">盘中</Badge>
<Badge colorScheme="blue" fontSize="xs">快讯</Badge>
</HStack>
</HStack>
{/* 中间:筛选组件(占据剩余空间) */} {/* 右侧:通知开关 + 更新时间 */}
<Box flex="1" minW={0}> <HStack spacing={3}>
{/* 通知开关 */}
<Tooltip
label={browserPermission === 'granted'
? '浏览器通知已开启'
: '开启实时推送通知'}
placement="left"
hasArrow
>
<HStack
spacing={2}
px={3}
py={1.5}
borderRadius="md"
bg={browserPermission === 'granted'
? useColorModeValue('green.50', 'green.900')
: useColorModeValue('gray.50', 'gray.700')}
borderWidth="1px"
borderColor={browserPermission === 'granted'
? useColorModeValue('green.200', 'green.700')
: useColorModeValue('gray.200', 'gray.600')}
cursor="pointer"
_hover={{
borderColor: browserPermission === 'granted'
? useColorModeValue('green.300', 'green.600')
: useColorModeValue('blue.300', 'blue.600'),
}}
transition="all 0.2s"
onClick={handleNotificationToggle}
>
<Icon
as={BellIcon}
boxSize={3.5}
color={browserPermission === 'granted'
? useColorModeValue('green.600', 'green.300')
: useColorModeValue('gray.500', 'gray.400')}
/>
<Text
fontSize="sm"
fontWeight="medium"
color={browserPermission === 'granted'
? useColorModeValue('green.700', 'green.200')
: useColorModeValue('gray.600', 'gray.300')}
>
{browserPermission === 'granted' ? '已开启' : '开启通知'}
</Text>
<Switch
size="sm"
isChecked={browserPermission === 'granted'}
pointerEvents="none"
colorScheme="green"
/>
</HStack>
</Tooltip>
{/* 更新时间 */}
<Text fontSize="xs" color="gray.500" whiteSpace="nowrap">
最后更新: {lastUpdateTime?.toLocaleTimeString() || '--'}
</Text>
</HStack>
</Flex>
{/* 第二行:筛选组件 */}
<Box>
<CompactSearchBox <CompactSearchBox
onSearch={onSearch} onSearch={onSearch}
onSearchFocus={onSearchFocus} onSearchFocus={onSearchFocus}
@@ -442,69 +490,7 @@ const [currentMode, setCurrentMode] = useState('vertical');
trackingFunctions={trackingFunctions} trackingFunctions={trackingFunctions}
/> />
</Box> </Box>
</VStack>
{/* 右侧:通知开关 + 更新时间 */}
<VStack align="end" spacing={1} minW="140px" flexShrink={0}>
{/* 通知开关 - 紧凑版 */}
<Tooltip
label={browserPermission === 'granted'
? '浏览器通知已开启'
: '开启实时推送通知'}
placement="left"
hasArrow
>
<HStack
spacing={2}
px={2}
py={1}
borderRadius="md"
bg={browserPermission === 'granted'
? useColorModeValue('green.50', 'green.900')
: useColorModeValue('gray.100', 'gray.700')}
borderWidth="1px"
borderColor={browserPermission === 'granted'
? useColorModeValue('green.200', 'green.700')
: useColorModeValue('gray.300', 'gray.600')}
cursor="pointer"
_hover={{
borderColor: browserPermission === 'granted'
? useColorModeValue('green.300', 'green.600')
: useColorModeValue('blue.300', 'blue.600'),
}}
transition="all 0.2s"
onClick={handleNotificationToggle}
>
<Icon
as={BellIcon}
boxSize={3}
color={browserPermission === 'granted'
? useColorModeValue('green.600', 'green.300')
: useColorModeValue('gray.500', 'gray.400')}
/>
<Text
fontSize="xs"
fontWeight="medium"
color={browserPermission === 'granted'
? useColorModeValue('green.700', 'green.200')
: useColorModeValue('gray.600', 'gray.300')}
>
{browserPermission === 'granted' ? '已开启' : '开启通知'}
</Text>
<Switch
size="sm"
isChecked={browserPermission === 'granted'}
pointerEvents="none"
colorScheme="green"
/>
</HStack>
</Tooltip>
{/* 更新时间 */}
<Text fontSize="xs" color="gray.500" whiteSpace="nowrap">
更新: {lastUpdateTime?.toLocaleTimeString() || '--'}
</Text>
</VStack>
</Flex>
</CardHeader> </CardHeader>
{/* 主体内容 */} {/* 主体内容 */}

View File

@@ -33,9 +33,9 @@ const VerticalModeLayout = ({
// 详情面板重置 key预留用于未来功能 // 详情面板重置 key预留用于未来功能
const [detailPanelKey] = useState(0); const [detailPanelKey] = useState(0);
// 固定布局比例:左侧更窄3右侧更宽7 // 固定布局比例:左侧4右侧6- 平衡布局,确保左侧有足够空间显示内容
const leftFlex = '3'; const leftFlex = '4';
const rightFlex = '7'; const rightFlex = '6';
return ( return (
<Flex <Flex

View File

@@ -13,35 +13,35 @@ import moment from 'moment';
*/ */
const EventTimeline = ({ createdAt, timelineStyle, borderColor, minHeight = '40px' }) => { const EventTimeline = ({ createdAt, timelineStyle, borderColor, minHeight = '40px' }) => {
return ( return (
<VStack spacing={0} align="center" minW="90px"> <VStack spacing={0} align="center" minW="65px">
{/* 时间长方形卡片 */} {/* 时间长方形卡片 - 更紧凑 */}
<Box <Box
{...(timelineStyle.bgGradient ? { bgGradient: timelineStyle.bgGradient } : { bg: timelineStyle.bg })} {...(timelineStyle.bgGradient ? { bgGradient: timelineStyle.bgGradient } : { bg: timelineStyle.bg })}
borderWidth={timelineStyle.borderWidth} borderWidth={timelineStyle.borderWidth}
borderColor={timelineStyle.borderColor} borderColor={timelineStyle.borderColor}
borderRadius="md" borderRadius="md"
px={2} px={1.5}
py={2} py={1.5}
minW="85px" minW="60px"
textAlign="center" textAlign="center"
boxShadow={timelineStyle.boxShadow} boxShadow={timelineStyle.boxShadow}
transition="all 0.3s ease" transition="all 0.3s ease"
> >
{/* 日期 YYYY-MM-DD */} {/* 日期 MM-DD */}
<Text <Text
fontSize="xs" fontSize="10px"
fontWeight="bold" fontWeight="bold"
color={timelineStyle.textColor} color={timelineStyle.textColor}
lineHeight="1.3" lineHeight="1.2"
> >
{moment(createdAt).format('YYYY-MM-DD')} {moment(createdAt).format('MM-DD')}
</Text> </Text>
{/* 时间 HH:mm */} {/* 时间 HH:mm */}
<Text <Text
fontSize="xs" fontSize="10px"
fontWeight="bold" fontWeight="bold"
color={timelineStyle.textColor} color={timelineStyle.textColor}
lineHeight="1.3" lineHeight="1.2"
mt={0.5} mt={0.5}
> >
{moment(createdAt).format('HH:mm')} {moment(createdAt).format('HH:mm')}

View File

@@ -144,7 +144,7 @@ const Community = () => {
return ( return (
<Box minH="100vh" bg={bgColor}> <Box minH="100vh" bg={bgColor}>
{/* 主内容区域 */} {/* 主内容区域 */}
<Container ref={containerRef} maxW="container.xl" pt={6} pb={8}> <Container ref={containerRef} maxW="1400px" pt={6} pb={8}>
{/* 通知权限提示横幅 */} {/* 通知权限提示横幅 */}
{showNotificationBanner && ( {showNotificationBanner && (
<Alert <Alert