shyamtawli / devFind

devFind is an open source project that aims to create a platform for developers to showcase their skills and connect with potential collaborators, all in a user-friendly and searchable format.
https://dev-find.vercel.app/
MIT License
551 stars 588 forks source link

fix/pagination-visibilty when no results found #1103

Open sohailk12 opened 3 months ago

sohailk12 commented 3 months ago

Description

Fixes: Issue #1092 when the user searches for a specific name the pagination is still visible and if there are less than 20 profiles in the list the pagination is still visible

Related Issues

when the user searches for a name and the list is less than 20 the pagination should be hidden

Changes Proposed

Applied a condition in app.js file if the length of profiles array is greater than 20 only then the pagination is visible

Checklist

Screenshots

image

https://github.com/user-attachments/assets/803358e9-be0c-4fae-80b8-b67965d0c44a

Note to reviewers

Please review my code and if it is helpful do let me know

vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dev-find ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 9, 2024 7:23am
dylan-dot-c commented 1 month ago

Thanks for fixing the issue I brought up, only thing is that you might want to remove the console.log() from production code and for here in App.js {profiles.length >= recordsPerPage ? ( <Pagination currentPage={currentPage} totalPages={Math.ceil((searching ? profiles.length : shuffledProfiles.length) / recordsPerPage)} onNextPage={handleNextPage} onPrevPage={handlePrevPage} /> ) : ( '' )}

you can just use && to render the pagination since there is nothing to render if pagination is not shown

so like (profiles.length >= recordsPerPage) && <Pagination {...} />

dylan-dot-c commented 1 month ago

Hopefully they get your pr merged soon