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

feat: add message pagination to buy-me-coffee so you can read all messages #516

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oceans404
Copy link

@oceans404 oceans404 commented Jun 11, 2024

What changed? Why?

Pagination of messages in buy-me-coffee

I forked the repo to build and noticed a comment that had a "pagination TODO" in the buy-me-coffee app. I was implementing pagination in my fork anyway, so I figured the based thing to do is also commit it to BOAT. Video demo

✅ Page size is configurable and set to 5 so that the Guide is still relatively close to the fold
✅ Current page displayed
✅ Read older messages button is disabled if you're on the first page
✅ Read newer messages button is disabled if there are no newer records

Screenshot 2024-06-10 at 6 22 30 PM

Notes to reviewers

Unfortunately the smart contract doesn't return the number of messages / memos, there's no good way of knowing the total without starting at 0 and counting up to the end, so messages go from oldest to newest rather than newest to oldest, which would be more ideal.

If the smart contract is refactored, you can reuse most of my pagination solution ☺️

How has it been tested?

Tested on by creating a new BOAT app with this version of the template on localhost - Video demo: pagination of messages in buy-me-coffee

@oceans404 oceans404 changed the title add message pagination to the buy me a coffee dapp so you can read all messages, not just the first 8 feat: add message pagination to the buy me a coffee dapp so you can read all messages Jun 11, 2024
@oceans404 oceans404 changed the title feat: add message pagination to the buy me a coffee dapp so you can read all messages feat: add message pagination to buy-me-coffee so you can read all messages Jun 11, 2024
@danimesq
Copy link

@oceans404

Thanks for this! Will use on my project by cherrypicking your commit.

Unfortunately the smart contract doesn't return the number of messages / memos, there's no good way of knowing the total without starting at 0

I will find a way to implement this and do a PR soon

@danimesq
Copy link

danimesq commented Jul 16, 2024

Screenshot from 2024-07-16 02-21-57

It is displaying the pagination despite there being just 1 message.
@oceans404 the implemented commit in my project is the same from yours: danimesq/OnchainIPFS@0a440f6.

@danimesq danimesq mentioned this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants