feat: 模式切花移动到标题恻,通知UI调整

This commit is contained in:
zdl
2025-11-26 19:11:33 +08:00
parent a8d4245595
commit a90158239b

View File

@@ -538,72 +538,49 @@ const [currentMode, setCurrentMode] = useState('vertical');
pb={3} pb={3}
> >
<VStack spacing={3} align="stretch"> <VStack spacing={3} align="stretch">
{/* 第一行:标题 + 通知开关 + 更新时间 */} {/* 第一行:标题 + 模式切换 + 通知开关 + 更新时间 */}
<Flex justify="space-between" align="center"> <Flex justify="space-between" align="center">
{/* 左侧:标题 */} {/* 左侧:标题 + 模式切换按钮 */}
<HStack spacing={4}>
<Heading size="md" color={PROFESSIONAL_COLORS.text.primary}> <Heading size="md" color={PROFESSIONAL_COLORS.text.primary}>
<HStack spacing={2}> <HStack spacing={2}>
<TimeIcon color={PROFESSIONAL_COLORS.gold[500]} /> <TimeIcon color={PROFESSIONAL_COLORS.gold[500]} />
<Text bgGradient={PROFESSIONAL_COLORS.gradients.gold} bgClip="text">实时要闻·动态追踪</Text> <Text bgGradient={PROFESSIONAL_COLORS.gradients.gold} bgClip="text">实时要闻·动态追踪</Text>
</HStack> </HStack>
</Heading> </Heading>
{/* 模式切换按钮(移动端隐藏) */}
{!isMobile && <ModeToggleButtons mode={mode} onModeChange={handleModeToggle} />}
</HStack>
{/* 右侧:通知开关 + 更新时间 */} {/* 右侧:通知开关 + 更新时间 */}
<HStack spacing={3}> <HStack spacing={3}>
{/* 通知开关 - 移动端隐藏 */} {/* 通知开关 - 移动端隐藏 */}
{!isMobile && ( {!isMobile && (
<Tooltip
label={browserPermission === 'granted'
? '浏览器通知已开启'
: '开启实时推送通知'}
placement="left"
hasArrow
>
<HStack <HStack
spacing={2} 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" cursor="pointer"
_hover={{
borderColor: browserPermission === 'granted'
? useColorModeValue('green.300', 'green.600')
: useColorModeValue('blue.300', 'blue.600'),
}}
transition="all 0.2s"
onClick={handleNotificationToggle} onClick={handleNotificationToggle}
_hover={{ opacity: 0.8 }}
transition="opacity 0.2s"
> >
<Icon <Icon
as={BellIcon} as={BellIcon}
boxSize={3.5} boxSize={3.5}
color={browserPermission === 'granted' color={PROFESSIONAL_COLORS.gold[500]}
? useColorModeValue('green.600', 'green.300')
: useColorModeValue('gray.500', 'gray.400')}
/> />
<Text <Text
fontSize="sm" fontSize="sm"
fontWeight="medium" color={PROFESSIONAL_COLORS.text.secondary}
color={browserPermission === 'granted'
? useColorModeValue('green.700', 'green.200')
: useColorModeValue('gray.600', 'gray.300')}
> >
{browserPermission === 'granted' ? '已开启' : '开启通知'} 实时消息推送{browserPermission === 'granted' ? '已开启' : '开启'}
</Text> </Text>
<Switch <Switch
size="sm" size="sm"
isChecked={browserPermission === 'granted'} isChecked={browserPermission === 'granted'}
pointerEvents="none" pointerEvents="none"
colorScheme="green" colorScheme="yellow"
/> />
</HStack> </HStack>
</Tooltip>
)} )}
{/* 更新时间 */} {/* 更新时间 */}
@@ -622,6 +599,7 @@ const [currentMode, setCurrentMode] = useState('vertical');
mode={mode} mode={mode}
pageSize={pageSize} pageSize={pageSize}
trackingFunctions={trackingFunctions} trackingFunctions={trackingFunctions}
isMobile={isMobile}
/> />
</Box> </Box>
</VStack> </VStack>
@@ -637,37 +615,6 @@ const [currentMode, setCurrentMode] = useState('vertical');
overflow="visible" overflow="visible"
zIndex={1} zIndex={1}
> >
{/* 顶部控制栏:模式切换按钮 + 分页控制器(移动端隐藏) */}
{!isMobile && (
<Box
position="sticky"
top="0"
zIndex={10}
bg={cardBg}
py={2}
mb={2}
borderBottom="1px solid"
borderColor={borderColor}
mx={-6}
px={6}
boxShadow="sm"
>
<Flex justify="space-between" align="center" flexWrap="wrap" gap={2}>
{/* 左侧:模式切换按钮 */}
<ModeToggleButtons mode={mode} onModeChange={handleModeToggle} />
{/* 右侧:分页控制器(仅在纵向模式显示) */}
{mode === 'vertical' && totalPages > 1 && (
<PaginationControl
currentPage={currentPage}
totalPages={totalPages}
onPageChange={handlePageChangeWithScroll}
/>
)}
</Flex>
</Box>
)}
{/* 内容区域 - 撑满剩余高度 */} {/* 内容区域 - 撑满剩余高度 */}
<Box flex="1" minH={0} position="relative"> <Box flex="1" minH={0} position="relative">
{/* Loading 蒙层 - 数据请求时显示 */} {/* Loading 蒙层 - 数据请求时显示 */}