pref: 去掉无用代码
This commit is contained in:
@@ -4,13 +4,9 @@
|
|||||||
import React, { useRef, useCallback } from 'react';
|
import React, { useRef, useCallback } from 'react';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Flex,
|
|
||||||
useColorModeValue
|
useColorModeValue
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import PaginationControl from './PaginationControl';
|
|
||||||
import VirtualizedFourRowGrid from './VirtualizedFourRowGrid';
|
import VirtualizedFourRowGrid from './VirtualizedFourRowGrid';
|
||||||
import PageNavigationButton from './PageNavigationButton';
|
|
||||||
import ModeToggleButtons from './ModeToggleButtons';
|
|
||||||
import VerticalModeLayout from './VerticalModeLayout';
|
import VerticalModeLayout from './VerticalModeLayout';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,32 +75,8 @@ const EventScrollList = ({
|
|||||||
}
|
}
|
||||||
}, [onPageChange, currentPage]);
|
}, [onPageChange, currentPage]);
|
||||||
|
|
||||||
return (
|
|
||||||
<Box>
|
|
||||||
{/* 横向滚动区域 */}
|
|
||||||
<Box position="relative">
|
|
||||||
|
|
||||||
{/* 翻页导航按钮(平铺模式不显示,使用无限滚动) */}
|
|
||||||
{mode !== 'four-row' && (
|
|
||||||
<>
|
|
||||||
<PageNavigationButton
|
|
||||||
direction="prev"
|
|
||||||
currentPage={currentPage}
|
|
||||||
totalPages={totalPages}
|
|
||||||
onPageChange={onPageChange}
|
|
||||||
mode={mode}
|
|
||||||
/>
|
|
||||||
<PageNavigationButton
|
|
||||||
direction="next"
|
|
||||||
currentPage={currentPage}
|
|
||||||
totalPages={totalPages}
|
|
||||||
onPageChange={onPageChange}
|
|
||||||
mode={mode}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* 事件卡片容器 */}
|
{/* 事件卡片容器 */}
|
||||||
|
return (
|
||||||
<Box
|
<Box
|
||||||
ref={scrollContainerRef}
|
ref={scrollContainerRef}
|
||||||
overflowX="hidden"
|
overflowX="hidden"
|
||||||
@@ -134,8 +106,8 @@ const EventScrollList = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* 平铺网格模式 - 使用虚拟滚动 + 双向无限滚动 */}
|
{/* 平铺网格模式 - 使用虚拟滚动 + 双向无限滚动 */}
|
||||||
{mode === 'four-row' && (
|
|
||||||
<VirtualizedFourRowGrid
|
<VirtualizedFourRowGrid
|
||||||
|
display={mode === 'four-row' ? 'block' : 'none'}
|
||||||
columnsPerRow={4} // 每行显示4列
|
columnsPerRow={4} // 每行显示4列
|
||||||
events={displayEvents || events} // 使用累积列表(如果有)
|
events={displayEvents || events} // 使用累积列表(如果有)
|
||||||
selectedEvent={selectedEvent}
|
selectedEvent={selectedEvent}
|
||||||
@@ -151,11 +123,10 @@ const EventScrollList = ({
|
|||||||
error={error} // 错误状态
|
error={error} // 错误状态
|
||||||
onRetry={handleRetry} // 重试回调
|
onRetry={handleRetry} // 重试回调
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
|
|
||||||
{/* 纵向分栏模式 */}
|
{/* 纵向分栏模式 */}
|
||||||
{mode === 'vertical' && (
|
|
||||||
<VerticalModeLayout
|
<VerticalModeLayout
|
||||||
|
display={mode === 'vertical' ? 'block' : 'none'}
|
||||||
events={events}
|
events={events}
|
||||||
selectedEvent={selectedEvent}
|
selectedEvent={selectedEvent}
|
||||||
onEventSelect={onEventSelect}
|
onEventSelect={onEventSelect}
|
||||||
@@ -167,9 +138,6 @@ const EventScrollList = ({
|
|||||||
totalPages={totalPages}
|
totalPages={totalPages}
|
||||||
onPageChange={onPageChange}
|
onPageChange={onPageChange}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user