From 0fb7fc0c635f829fe2a1b4d60b6280fc288ae988 Mon Sep 17 00:00:00 2001 From: Kevin-Umali Date: Fri, 7 Jun 2024 23:29:13 +0800 Subject: [PATCH] Fix wrong path link --- .../generate/_components/project-tabs.tsx | 2 +- .../(account)/_components/avatar-control.tsx | 5 +++- client/app/(account)/_components/navbar.tsx | 25 ++++++++++++------- .../(routes)/community/community.tsx | 20 ++++++++------- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/client/app/(account)/(routes)/generate/_components/project-tabs.tsx b/client/app/(account)/(routes)/generate/_components/project-tabs.tsx index b87fbd1..25e8889 100644 --- a/client/app/(account)/(routes)/generate/_components/project-tabs.tsx +++ b/client/app/(account)/(routes)/generate/_components/project-tabs.tsx @@ -56,7 +56,7 @@ const ProjectTabs: React.FC = ({ projects, className }) => {
- + ))}
diff --git a/client/app/(landing)/(routes)/community/community.tsx b/client/app/(landing)/(routes)/community/community.tsx index edd7d96..bd431be 100644 --- a/client/app/(landing)/(routes)/community/community.tsx +++ b/client/app/(landing)/(routes)/community/community.tsx @@ -79,23 +79,24 @@ export default function CommunityGeneratedIdeaList() {
{isLoading ? renderLoadingSkeleton() : isSuccess && communityData.data.totalCount > 0 ? renderProjectCards() : renderNoDataDisplay()} - {isSuccess && ( + {isSuccess && totalPages > 1 && ( setCurrentPage((prev) => (prev > 1 ? prev - 1 : prev))} aria-disabled={currentPage === 1} /> - setCurrentPage(1)}> 1 + {currentPage > 3 && ( )} + {Array.from({ length: Math.min(5, totalPages) }, (_, i) => { const page = currentPage - 2 + i; if (page > 1 && page < totalPages) { @@ -109,18 +110,19 @@ export default function CommunityGeneratedIdeaList() { } return null; }).filter(Boolean)} + {currentPage < totalPages - 2 && ( )} - {totalPages > 1 && ( - - setCurrentPage(totalPages)}> - {totalPages} - - - )} + + + setCurrentPage(totalPages)}> + {totalPages} + + + setCurrentPage((prevPage) => Math.min(prevPage + 1, totalPages))} aria-disabled={currentPage === totalPages} />