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

[FEATURE] Disable "next" button in the last record #4351

Closed
nataliaElv opened this issue Nov 29, 2023 · 1 comment · Fixed by #4356
Closed

[FEATURE] Disable "next" button in the last record #4351

nataliaElv opened this issue Nov 29, 2023 · 1 comment · Fixed by #4356
Assignees
Labels
area: ui Indicates that an issue or pull request is related to the User Interface (UI) area: ux Indicates that an issue or pull request is related to the User Experience (UX) team: frontend Indicates that the issue or pull request is owned by the frontend team type: enhancement Indicates new feature requests type: improvement Indicates updates or improvements on existing features

Comments

@nataliaElv
Copy link
Member

Is your feature request related to a problem? Please describe.
In the UI, whenever I'm in the last record of a queue (with or without filters) the "next" button is still enabled but if I click I get a message saying that I reached the end of the queue.

Describe the solution you'd like
A clear and concise description of what you want to happen.
When I get to the last record, the "next" button should be disabled so that I cannot click by mistake and I understand intuitively that I reached the end of the queue without a pop-up message.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@nataliaElv nataliaElv added area: ui Indicates that an issue or pull request is related to the User Interface (UI) type: improvement Indicates updates or improvements on existing features area: ux Indicates that an issue or pull request is related to the User Experience (UX) labels Nov 29, 2023
Copy link

dosubot bot commented Nov 29, 2023

🤖

Hi @nataliaElv! 👋

I'm Dosu, an automated bot here to assist you with Argilla. I can help solve bugs, answer questions, and guide you on how to become a contributor. While a human maintainer is on the way, I'm here to provide immediate support. Nice to meet you! 😊

Thank you for your feature request. It's indeed a good idea to disable the "next" button when the user reaches the last record of a queue. This would prevent accidental clicks and provide an intuitive understanding that the end of the queue has been reached.

Currently, the "next" button in the Argilla UI emits a "changePage" event when clicked. This event carries the information of the next page number and the size of the page. The next page number is calculated by adding 1 to the current page number. This behavior is defined in the prevNextButtonEmition function and tested in the "emit event when next is clicked" test case. However, the behavior when the user reaches the last record of a queue is not specified.

To implement your feature request, we can add a computed property that checks if the current page is the last page. If it is, the "next" button should be disabled. Here's how you can do it:

computed: {
  isLastPage() {
    return this.paginationSettings.page * this.paginationSettings.size >= this.totalItems;
  }
}

Then, in your template, you can bind the disabled attribute of the "next" button to the isLastPage computed property:

<button class="pagination__arrow--next" :disabled="isLastPage" @click="nextPage">Next</button>

In the nextPage method, you should also check if the current page is the last page before emitting the changePage event:

methods: {
  nextPage() {
    if (!this.isLastPage) {
      this.$emit('changePage', this.paginationSettings.page + 1, this.paginationSettings.size);
    }
  }
}

This way, the "next" button will be disabled and unclickable when the user reaches the last record of a queue, preventing accidental clicks and providing an intuitive understanding that the end of the queue has been reached.

You can find the relevant code in the frontend/components/base/base-pagination/BasePagination.spec.js file.

I hope this helps! If you have any further questions or need more clarification, feel free to ask.

Best regards,
Dosu

Sources

@dosubot dosubot bot added team: frontend Indicates that the issue or pull request is owned by the frontend team type: enhancement Indicates new feature requests labels Nov 29, 2023
damianpumar added a commit that referenced this issue Nov 29, 2023
- [x] Bold answered categories
- [x] Sort tooltip
- [x] Disable next pagination button  

closes #4351
damianpumar added a commit that referenced this issue Nov 29, 2023
- [x] Bold answered categories
- [x] Sort tooltip
- [x] Disable next pagination button  

closes #4351
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ui Indicates that an issue or pull request is related to the User Interface (UI) area: ux Indicates that an issue or pull request is related to the User Experience (UX) team: frontend Indicates that the issue or pull request is owned by the frontend team type: enhancement Indicates new feature requests type: improvement Indicates updates or improvements on existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants