devFind icon indicating copy to clipboard operation
devFind copied to clipboard

fix/pagination-visibilty when no results found

Open sohailk12 opened this issue 1 year ago • 3 comments

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

  • [ x] I have read and followed the Contribution Guidelines.
  • [x ] All new and existing tests passed.
  • [x ] I have updated the documentation to reflect the changes I've made.
  • [x ] My code follows the code style of this project.
  • [x ] The title of my pull request is a short description of the requested changes.

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

sohailk12 avatar Aug 09 '24 07:08 sohailk12

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

vercel[bot] avatar Aug 09 '24 07:08 vercel[bot]

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 avatar Sep 27 '24 18:09 dylan-dot-c

Hopefully they get your pr merged soon

dylan-dot-c avatar Sep 27 '24 18:09 dylan-dot-c