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(Paginator): Adds Paginator #68

Closed
wants to merge 2 commits into from
Closed

feat(Paginator): Adds Paginator #68

wants to merge 2 commits into from

Conversation

john-bv
Copy link
Contributor

@john-bv john-bv commented Mar 9, 2020

PULL REQUEST

Overview

This PR introduces Pagination Util (#47).
This PR is being actively edited, I will comment here when I am ready to merge.

Status

  • Typings have been updated or don't need to be.
  • This PR have been tested and is ready to be merged.

Semantic versioning classification

  • This PR introduces BREAKING changes.
  • This PR adds new features, improve the code and implies minimal changes.
  • This PR fixes a bug and references the relevant issue or documentation.
  • This PR improves performance or code refactor without API changes.
  • This PR only includes non-code changes (documentation, CI, tools...).

@john-bv
Copy link
Contributor Author

john-bv commented Mar 9, 2020

I made this PR so @khaazz can modify how I'm going about this.

+ Fix formatting and remove `otps` var
@Khaaz
Copy link
Owner

Khaaz commented Mar 9, 2020

Quick sum up about what this is supposed to introduce in term of feature:
Paginator:

  • takes a list of embed or pages
  • sends back correct page regarding input:
    • number via awaitMessage / messageCollector
    • reaction via awaitReaction / reactionCollector
    • directly via input (command # return the page for #)

As I see it, we will need various structure:

  • chunker that directly handle the data to output
  • renderer that display the data needed like we want
  • navigator that will take user input and call the rendered to correctly render the data

What could possibly be done:

  • have only one instance of Paginator in the command, that loads and display static (via embed/text). EG: menu, always display the same data

  • Have potentially a default view (embed or text) that takes dynamically data in param and renders it on user input

  • directly use a function in the paginator that will return the data that needs to be displayed (eg: DB call)

  • build dynamically embeds each time and renders it

  • reactionCollector or messageCollector needs to potentially be given in parameter (to use global one / prevent spawning unecessary new listeners)

@Khaaz
Copy link
Owner

Khaaz commented Mar 9, 2020

As I see it, you here have the basic chunker structure.
If you want me to review it more in depth, I'd need use case of the structure / examples / explanation of the architecture.

If anything in the above is not clear, make sure to tell me here or in discord. I am not sure myself on how / what it needs to do exactly, but I think I wrote above the basis of what it can do. I'll be able to judge better when you've done / explained more if the API you are working on seem sufficient to what I expect for this helper.
Sidenote: I'll report the comment above in the original issue to keep track

@Khaaz Khaaz linked an issue Mar 9, 2020 that may be closed by this pull request
@Khaaz
Copy link
Owner

Khaaz commented Jul 30, 2020

Closing this due to inactivity. This is still a thing that needs to be done, and some implementation details are specified here.

@Khaaz Khaaz closed this Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Utility: Paginator
2 participants