diff --git a/tauri-app/src/pages/ContentManagement/MyWorks.tsx b/tauri-app/src/pages/ContentManagement/MyWorks.tsx index c505ec6..5704697 100644 --- a/tauri-app/src/pages/ContentManagement/MyWorks.tsx +++ b/tauri-app/src/pages/ContentManagement/MyWorks.tsx @@ -67,6 +67,21 @@ function formatFileSize(bytes: number): string { return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`; } +function Pagination({ current, total, onChange }: { current: number; total: number; onChange: (page: number) => void }) { + if (total <= 1) {return null;} + return ( +
+
+ + {Array.from({ length: total }, (_, i) => i + 1).map(page => ( + + ))} + +
+
+ ); +} + function formatDuration(seconds: number): string { if (seconds <= 0) {return '';} const mins = Math.floor(seconds / 60); @@ -280,7 +295,8 @@ export default function MyWorks() { const [showDeleteDraftModal, setShowDeleteDraftModal] = useState(false); const [deletingDraft, setDeletingDraft] = useState(null); const [isDeletingDraft, setIsDeletingDraft] = useState(false); - const [currentPage, setCurrentPage] = useState(1); + const [productPage, setProductPage] = useState(1); + const [draftPage, setDraftPage] = useState(1); const [editingDraftId, setEditingDraftId] = useState(null); const [editDraftTitle, setEditDraftTitle] = useState(''); const { navigate } = useNavigation(); @@ -371,11 +387,11 @@ export default function MyWorks() { setEditingDraftId(null); }; - const totalPages = Math.ceil(products.length / PAGE_SIZE); - const paginatedProducts = products.slice((currentPage - 1) * PAGE_SIZE, currentPage * PAGE_SIZE); + const totalProductPages = Math.ceil(products.length / PAGE_SIZE); + const paginatedProducts = products.slice((productPage - 1) * PAGE_SIZE, productPage * PAGE_SIZE); const totalDraftPages = Math.ceil(drafts.length / PAGE_SIZE); - const paginatedDrafts = drafts.slice((currentPage - 1) * PAGE_SIZE, currentPage * PAGE_SIZE); + const paginatedDrafts = drafts.slice((draftPage - 1) * PAGE_SIZE, draftPage * PAGE_SIZE); return (
@@ -388,7 +404,7 @@ export default function MyWorks() {
{tabs.map(tab => ( - ))} @@ -414,17 +430,7 @@ export default function MyWorks() {

完成压制成片后会保存在这里

)} - {totalPages > 1 && ( -
-
- - {Array.from({ length: totalPages }, (_, i) => i + 1).map(page => ( - - ))} - -
-
- )} + )} {activeTab === 'drafts' && ( @@ -454,17 +460,7 @@ export default function MyWorks() {
)} - {totalDraftPages > 1 && ( -
-
- - {Array.from({ length: totalDraftPages }, (_, i) => i + 1).map(page => ( - - ))} - -
-
- )} + )}