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

Add index/total count to end of pagination buttons #490

Merged
merged 6 commits into from Apr 28, 2020

Conversation

FleetingOrchard
Copy link
Contributor

Very simple, just chucks a fake button on the end of the pagination buttons. Looked a bit awkward by itself on the no-pagination case, so left it out there, but hopefully most folks know how to count up to 40.

Comment on lines 20 to 22
const firstItemCount:number = Math.min((currentPage-1)*itemsPerPage+1, totalItems);
const lastItemCount:number = Math.min(firstItemCount+(itemsPerPage-1), totalItems);
const indexText:string = `${firstItemCount}-${lastItemCount}/${totalItems}`;
Copy link

Choose a reason for hiding this comment

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

You don't actually need to specify the type since the type is implied from the initialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, my C days just give me anxiety regarding inferred types.

ui/v2.5/src/components/List/Pagination.tsx Outdated Show resolved Hide resolved
Comment on lines 104 to 112
<Button
variant="secondary"
disabled={true}
>
{indexText}
</Button>
Copy link

Choose a reason for hiding this comment

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

Not entirely sure how I feel about a disabled button. I honestly think it looks fine with just a <div>, it strongly implies that it's not part of the actual navigation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eh, I disagree, but more fundamentally -- I think an index is part of the navigation of a paginated structure. Yes, it's not a functional part, but it conveys key information about navigation to the user.

@WithoutPants
Copy link
Collaborator

I am inclined to agree with @InfiniteTF on the placement of the index/total count. I think we should probably be looking at other sites and apps for guidance on this one.

PH places it at the top of the page, just before the results. This is probably the ideal in my opinion:

image

Google just shows the page and the total, meh:

image

Radarr just gives you the total:

image

As it is, it just looks a little tacked-on:

image

It also looks broken in mobile view:

image

My preference would be a small section above the results, like the PH example.

@FleetingOrchard
Copy link
Contributor Author

My only concern there is that I feel we don't really have any UI elements that are analogous to a header (in the sense of results-for-query-foobar). Putting it between the filter and the content might look a bit weird as a result.

Maybe putting it between the content and pagination in ListHook? I'd be inclined to then just break it out into its own component to facilitate that, though. On the other hand, I was also thinkin' we could use it as a way to pop up a modal so users could skip to a particular range, and I don't know if it's a great idea to influence pagination outside pagination.

Looking at the mobile view, and how it's implemented in Pagination.tsx -- I'm inclined to suggest we shorten the index string (dropping " of " in favor of "/") for mobile views, but I have to confess, I have no idea how that's achieved with these classNames on those first/last buttons.

- Something something text should be seen and not heard, har har
Copy link
Collaborator

@WithoutPants WithoutPants left a comment

Choose a reason for hiding this comment

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

Looks and tests ok.

@WithoutPants WithoutPants merged commit 1513617 into stashapp:develop Apr 28, 2020
Tweeticoats pushed a commit to Tweeticoats/stash that referenced this pull request Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants