Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pagination feature #1660

Merged
merged 25 commits into from
Sep 26, 2023

Conversation

CBID2
Copy link
Collaborator

@CBID2 CBID2 commented Sep 11, 2023

Issues

Closes #1125

Changes proposed

@chris-nowicki and I implemented code that adds page numbers to the cards, creating an easier navigation for users.

Screenshots

pagination

Note to reviewers

@rupali-codes and @Anmol-Baranwal, this is a better version of PR #1655.

@vercel
Copy link

vercel bot commented Sep 11, 2023

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

Name Status Preview Comments Updated (UTC)
linkshub ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 25, 2023 9:19pm

@github-actions github-actions bot added the goal: new-feature New feature or request label Sep 11, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, CBID2, for creating this pull request and contributing to LinksHub! 💗

The maintainers will review this Pull Request and provide feedback as soon as possible! 😇
We appreciate your patience and contribution, Keep up the great work! 😀

@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 11, 2023

Hey @Anmol-Baranwal. Review this PR. Ignore the other ones. Same with you @rupali-codes

@CBID2 CBID2 added quick-fix Shouldn't take much time to finish collab Open to collaborate with another contributor and/or maintainer labels Sep 11, 2023
Copy link
Collaborator

@Anmol-Baranwal Anmol-Baranwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Whenever we move to a new category, it should reset to the initial page i.e. page 1.

The above change is necessary because of UX :)

Also, why did you close the other PRs? Was the conflict too much. I'm just asking.

As mentioned, please attach a screenshot of both the variations (change white and purple on floating widget).

@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 24, 2023

We're ready to go @Anmol-Baranwal and @rupali-codes! :)

@Anmol-Baranwal
Copy link
Collaborator

We're ready to go @Anmol-Baranwal and @rupali-codes! :)

I will review it tomorrow evening.

@Anmol-Baranwal
Copy link
Collaborator

@CBID2
You can see the bug here:
https://jam.dev/c/0109513b-4bef-4731-bca1-8297ff9a2c3a

I will review this after this is fixed.

image

@chris-nowicki
Copy link
Contributor

chris-nowicki commented Sep 25, 2023 via email

@chris-nowicki
Copy link
Contributor

@CBID2 You can see the bug here: https://jam.dev/c/0109513b-4bef-4731-bca1-8297ff9a2c3a

I will review this after this is fixed.

image

@CBID2 @Anmol-Baranwal - I think I was able to fix it. Can you verify?

@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 25, 2023

@Anmol-Baranwal
Copy link
Collaborator

For me, it's still there at least in the latest deployment.

@chris-nowicki
Copy link
Contributor

chris-nowicki commented Sep 25, 2023

For me, it's still there at least in the latest deployment.

Bummer! Where are you seeing it? Can you give a screen shot so I can try and replicate.

Here is what I see:

In this screen shot I am on page 2:
Screenshot 2023-09-25 at 2 26 15 PM

I then change category and it changes to page 1:
Screenshot 2023-09-25 at 2 26 38 PM

Is there multiple ways to change category? Maybe I am missing something :).

@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 25, 2023

For me, it's still there at least in the latest deployment.

Did you refresh it @Anmol-Baranwal?

@Anmol-Baranwal
Copy link
Collaborator

Anmol-Baranwal commented Sep 25, 2023

Contributor

In frontend category, you can go to Design Inspirations subcategory, then click page number 2 and then go to Animations subcategory. See if the page number changes.

Yeah, I checked the code too, it should work but why is it with me.

@chris-nowicki
Copy link
Contributor

Contributor

In frontend category, you can go to Design Inspirations subcategory, then click page number 2 and then go to Animations subcategory. See if the page number changes.

Ah, I see it. Weird! So if the sub category changes it isn't updating but if the main category changes it is.

@Anmol-Baranwal
Copy link
Collaborator

Anmol-Baranwal commented Sep 25, 2023

@chris-nowicki
I am saying about subcategory not category.

Yeah!

@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 25, 2023

Contributor

In frontend category, you can go to Design Inspirations subcategory, then click page number 2 and then go to Animations subcategory. See if the page number changes.

Yeah, I checked the code too, it should work but why is it with me.

The numbers change on both on my end @Anmol-Baranwal. Maybe you need to refresh your browser?

@Anmol-Baranwal
Copy link
Collaborator

It should change without refreshing the browser.

@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 25, 2023

It should change without refreshing the browser.

Here's a video of the change @Anmol-Baranwal:

Pagination.working.mp4

@chris-nowicki
Copy link
Contributor

@chris-nowicki I am saying about subcategory not category.

Yeah!

I am thinking it has something to do with State.

I am wondering if I should add the variables used in usePagination() to the Global Context?

@CBID2 - If you select Design Insipiration, go to page 2, and then select Animations you will see pagination stays on page 2 and doesn't reset to page 1.

@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 25, 2023

@chris-nowicki I am saying about subcategory not category.
Yeah!

I am thinking it has something to do with State.

I am wondering if I should add the variables used in usePagination() to the Global Context?

@CBID2 - If you select Design Insipiration, go to page 2, and then select Animations you will see pagination stays on page 2 and doesn't reset to page 1.

Ohh I see @chris-nowicki. Maybe adding variables could work :)

@chris-nowicki
Copy link
Contributor

@CBID2 @Anmol-Baranwal I think I fixed it!

I figured that anytime the totalNumberOfCards change is when the subcategory/category changes. So when that happens the handlePageChange function should run and set the page back to 1. I created a useEffect in the usePagination.tsx hook:

  useEffect(() => {
    handlePageChange(1)
  }, [totalNumberOfCards])

I tested it out to see if it works and I think we are good to go :).

@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 26, 2023

Great @chris-nowicki. We're ready @rupali-codes! :)

Copy link
Collaborator

@Anmol-Baranwal Anmol-Baranwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chris-nowicki @CBID2
Thank you very much. You have truly put in a lot of effort for this. I genuinely appreciate your contribution.

Copy link
Owner

@rupali-codes rupali-codes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect to me, thanks a lot @chris-nowicki & @CBID2 :)

@rupali-codes rupali-codes merged commit 46a88ce into rupali-codes:main Sep 26, 2023
6 checks passed
@CBID2
Copy link
Collaborator Author

CBID2 commented Sep 26, 2023

Woohoo! We did it @chris-nowicki! 😊

@CBID2 CBID2 deleted the adding-pagination-feature branch September 26, 2023 16:15
@chris-nowicki
Copy link
Contributor

Woohoo! We did it @chris-nowicki! 😊

Woohoo! This was so fun to work on with y'all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collab Open to collaborate with another contributor and/or maintainer goal: new-feature New feature or request priority: high Making completely new feature quick-fix Shouldn't take much time to finish
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Add Pagination to the Resources Cards
5 participants