jeffalo / ocular

forum search for scratch
https://ocular.jeffalo.net
52 stars 27 forks source link

Pagination (especially on topic pages) #76

Open towerofnix opened 3 years ago

towerofnix commented 3 years ago

Is your feature request related to a problem? Please describe.

Currently most pages use a "Load More" button; this is pretty standard for search pages and the like (where you can customize the sort order), but for topic pages, it makes it difficult to navigate to the most recent entries or find ones halfway through a topic, especially if it's got a lot of posts.

Describe the solution you'd like

IMO, Scratch's basic 20-per-page pagination works pretty well! My suggestion is adding something like Scratch's page selector to the top and bottom of topic pages:

Scratch page navigator: previous, 1, 2, 3, 4 ... 77, 78, 79, 80, next

Describe alternatives you've considered

There are workarounds right now besides just clicking Load More a bunch of times; you can enter +topic:446450 and choose the "newest" option from the sort dropdown to get all the latest posts in a thread. This requires typing out that code manually and clicking a dropdown, though; it's not super usable!

Another alternative is creating an SA addon which integrates stuff like reaction buttons right into Scratch, but I'm sure that's already under consideration, and this would help with anyone who browses via the Ocular site anyway :P

Additional context

I haven't looked deep, but it might require a bit of work shifting how the backend works, so with the workarounds available I wouldn't personally place this request at a super high priority. Still, it's a valuable feature to make the Browse feature a bunch more usable!

FunctionalMetatable commented 3 years ago

there is already an ocular addon in sa which includes reaction buttons

jeffalo commented 3 years ago

this is something i would really like to implement. it might be possible, considering scratchdb has the all of the information i might need to have paginated topic pages, but something i want to implement alongside this is to be able to find a single post in a topic, but i dont think scratchdb provides the post number which i would be able to use to find what page it's on. i'll speak to lefty.

jeffalo commented 2 years ago

hey @towerofnix, how is this implementation? https://ocular-rewritten.jeffalo.net/search?q=ocular&sort=newest, i had to make some annoying compromises due to scratchdb things (page numbers are limited for users and queries with over 200 pages), but i think it works better than the "load more" stuff currently.

what do you think?

towerofnix commented 2 years ago

That looks awesome! It's surprisingly quick, too—switching between 34 or 7 or 125 pages of results on new queries that wouldn't have been (super extensively) cached is snappy, only like a second to fetch and display the results.

It's kinda hilarious seeing 200 page links in a row.

Screen Shot 2022-10-04 at 9 17 44 PM

...That's what Scratch does too though.

As long as this doesn't put too much technical strain/liability on the codebase or system, this is really great! Thank you for your time putting it together and making it work!

jeffalo commented 2 years ago

awesome. thanks! you're right - simplifying the page numbers when there are so many is probably a good idea. just couldn't wrap my head around the algorithm last time i was working on it :) it shouldn't be that hard though, i can try again sometime soon.

the pagination is part of a big rewrite i started a while back, i haven't had much time to work on it, but when it's done it will replace ocular.jeffalo.net. :)