🌐 feat: implement left-right pagination layout with i18n support
- Add left-right pagination layout for desktop (total info on left, controls on right) - Keep mobile layout centered with pagination controls only - Implement proper i18n support for pagination text using react-i18next - Add pagination translations for Chinese and English - Standardize t function usage across all table components to use xxxData.t pattern - Update CardPro footer layout to support justify-between on desktop - Use CSS variable --semi-color-text-2 for consistent text styling - Disable built-in Pagination showTotal to avoid duplication Components updated: - CardPro: Enhanced footer layout with responsive design - createCardProPagination: Added i18n support and custom total text - All table components: Unified t function usage pattern - i18n files: Added pagination-related translations The pagination now displays "Showing X to Y of Z items" on desktop and maintains existing centered layout on mobile devices.
This commit is contained in:
@@ -163,7 +163,10 @@ const CardPro = ({
|
||||
if (!paginationArea) return null;
|
||||
|
||||
return (
|
||||
<div className="flex justify-center w-full pt-4 border-t" style={{ borderColor: 'var(--semi-color-border)' }}>
|
||||
<div
|
||||
className={`flex w-full pt-4 border-t ${isMobile ? 'justify-center' : 'justify-between items-center'}`}
|
||||
style={{ borderColor: 'var(--semi-color-border)' }}
|
||||
>
|
||||
{paginationArea}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -68,6 +68,7 @@ const ChannelsPage = () => {
|
||||
onPageChange: channelsData.handlePageChange,
|
||||
onPageSizeChange: channelsData.handlePageSizeChange,
|
||||
isMobile: isMobile,
|
||||
t: channelsData.t,
|
||||
})}
|
||||
t={channelsData.t}
|
||||
>
|
||||
|
||||
@@ -51,6 +51,7 @@ const MjLogsPage = () => {
|
||||
onPageChange: mjLogsData.handlePageChange,
|
||||
onPageSizeChange: mjLogsData.handlePageSizeChange,
|
||||
isMobile: isMobile,
|
||||
t: mjLogsData.t,
|
||||
})}
|
||||
t={mjLogsData.t}
|
||||
>
|
||||
|
||||
@@ -109,8 +109,9 @@ const RedemptionsPage = () => {
|
||||
onPageChange: redemptionsData.handlePageChange,
|
||||
onPageSizeChange: redemptionsData.handlePageSizeChange,
|
||||
isMobile: isMobile,
|
||||
t: redemptionsData.t,
|
||||
})}
|
||||
t={t}
|
||||
t={redemptionsData.t}
|
||||
>
|
||||
<RedemptionsTable {...redemptionsData} />
|
||||
</CardPro>
|
||||
|
||||
@@ -51,6 +51,7 @@ const TaskLogsPage = () => {
|
||||
onPageChange: taskLogsData.handlePageChange,
|
||||
onPageSizeChange: taskLogsData.handlePageSizeChange,
|
||||
isMobile: isMobile,
|
||||
t: taskLogsData.t,
|
||||
})}
|
||||
t={taskLogsData.t}
|
||||
>
|
||||
|
||||
@@ -111,8 +111,9 @@ const TokensPage = () => {
|
||||
onPageChange: tokensData.handlePageChange,
|
||||
onPageSizeChange: tokensData.handlePageSizeChange,
|
||||
isMobile: isMobile,
|
||||
t: tokensData.t,
|
||||
})}
|
||||
t={t}
|
||||
t={tokensData.t}
|
||||
>
|
||||
<TokensTable {...tokensData} />
|
||||
</CardPro>
|
||||
|
||||
@@ -50,6 +50,7 @@ const LogsPage = () => {
|
||||
onPageChange: logsData.handlePageChange,
|
||||
onPageSizeChange: logsData.handlePageSizeChange,
|
||||
isMobile: isMobile,
|
||||
t: logsData.t,
|
||||
})}
|
||||
t={logsData.t}
|
||||
>
|
||||
|
||||
@@ -114,8 +114,9 @@ const UsersPage = () => {
|
||||
onPageChange: usersData.handlePageChange,
|
||||
onPageSizeChange: usersData.handlePageSizeChange,
|
||||
isMobile: isMobile,
|
||||
t: usersData.t,
|
||||
})}
|
||||
t={t}
|
||||
t={usersData.t}
|
||||
>
|
||||
<UsersTable {...usersData} />
|
||||
</CardPro>
|
||||
|
||||
@@ -580,10 +580,27 @@ export const createCardProPagination = ({
|
||||
isMobile = false,
|
||||
pageSizeOpts = [10, 20, 50, 100],
|
||||
showSizeChanger = true,
|
||||
t = (key) => key,
|
||||
}) => {
|
||||
if (!total || total <= 0) return null;
|
||||
|
||||
const start = (currentPage - 1) * pageSize + 1;
|
||||
const end = Math.min(currentPage * pageSize, total);
|
||||
const totalText = `${t('显示第')} ${start} ${t('条 - 第')} ${end} ${t('条,共')} ${total} ${t('条')}`;
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* 桌面端左侧总数信息 */}
|
||||
{!isMobile && (
|
||||
<span
|
||||
className="text-sm select-none"
|
||||
style={{ color: 'var(--semi-color-text-2)' }}
|
||||
>
|
||||
{totalText}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* 右侧分页控件 */}
|
||||
<Pagination
|
||||
currentPage={currentPage}
|
||||
pageSize={pageSize}
|
||||
@@ -596,5 +613,6 @@ export const createCardProPagination = ({
|
||||
showQuickJumper={isMobile}
|
||||
showTotal
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1783,5 +1783,9 @@
|
||||
"隐藏操作项": "Hide actions",
|
||||
"显示操作项": "Show actions",
|
||||
"用户组": "User group",
|
||||
"邀请获得额度": "Invitation quota"
|
||||
"邀请获得额度": "Invitation quota",
|
||||
"显示第": "Showing",
|
||||
"条 - 第": "to",
|
||||
"条,共": "of",
|
||||
"条": "items"
|
||||
}
|
||||
Reference in New Issue
Block a user