Skip to content

Sort by date on the history page#6214

Closed
jlvivero wants to merge 6 commits into
FreeTubeApp:developmentfrom
jlvivero:sortbydate
Closed

Sort by date on the history page#6214
jlvivero wants to merge 6 commits into
FreeTubeApp:developmentfrom
jlvivero:sortbydate

Conversation

@jlvivero
Copy link
Copy Markdown

@jlvivero jlvivero commented Nov 22, 2024

Sortbydate

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

Initial addition to #5595 (not sure it would be considered closed and we just make a new issue for future changes)

Description

Adds a sort by date ascending/descending toggle to the history page, this is a stopgap to adding a more fully fledged filter by setting, but I wanted to keep the changes small and incremental since design wise, some decisions have to be made and I'm not sure I'm the one that should make those decisions. (like other kinds of sorting/filtering in history page)

I also removed the second sorting it does when it does the search, since the array it uses is already sorted (in whichever order we choose), and the filter method I believe does a linear scan, it seemed unnecessary to sort twice, if we think it's necessary I can add it back and just add a condition to sort whichever way we need it to (But I don't think it's needed)

Screenshots

freetubesortby

Testing

I tested by adding random videos to history, sorting it back and forth, then doing search and sorting back and forth as well

possibly with a huge history we'd like to view how the sorting performs... I don't have a huge history at the moment, so it's hard to tell. it's expected to a certain degree

Desktop

  • OS: Pop!_OS
  • OS Version: Pop!_OS 22.04 LTS
  • FreeTube version: freetube@0.22.0 dev

Additional context

I stuck to the simple toggle since I was only going to do the asc/desc sorting on this PR

@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 22, 2024
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) November 22, 2024 20:13
auto-merge was automatically disabled November 22, 2024 20:16

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) November 22, 2024 20:16
@PikachuEXE PikachuEXE requested a review from absidue November 22, 2024 22:14
@jlvivero
Copy link
Copy Markdown
Author

jlvivero commented Dec 3, 2024

o: it's been two weeks, hopefully this get reviewed soon so I can make any fixes necessary and/or start work on follow ups

Comment thread src/renderer/views/History/History.js
Comment thread src/renderer/views/History/History.js Outdated
Comment thread src/renderer/views/History/History.js Outdated
dataLimit: 100,
searchDataLimit: 100,
doCaseSensitiveSearch: false,
ascending: false,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ascending: false,
useAscendingOrder: false,

Recommend adjusting the variable name to be more specific.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

sounds good, I'll change it

Comment thread src/renderer/views/History/History.vue Outdated
:default-value="doCaseSensitiveSearch"
@change="doCaseSensitiveSearch = !doCaseSensitiveSearch"
/>
<ft-toggle-switch
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion (non-blocking): We do tend to use ft-selects for sort selections, and we may have more options for this in the future, so you may want to consider changing it. Not incredibly important at this point, though, aside from making the current labeling more likely to be temporary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Better have consistent UI unless there is a good reason

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ft-select will probably require me to make change to the store, not a problem, but I'm debating then, if I'm using ft-select I should stop using a boolean for this then, I didn't want to use an enum yet, since I don't even know if we will have sorting of anything besides date. (and if we are never sorting by anything else an enum feels unnecessary)

what are your thoughts on using an enum instead?

I can also add boolean as a type to ft-select, but I'm not sure what is the desired approach here

Comment thread static/locales/en-US.yaml Outdated
Empty Search Message: There are no videos in your history that match your search
Search bar placeholder: "Search in History"
Case Sensitive Search: Case Sensitive Search
Sort By Date ASC: Sort By Date ASC
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: Related to the above, not a fan of this label, but hard to know of a better alternative without switching to ft-select. If you do do that, looking at the other sorting labels we have, more consistent ones would be DateWatchedOldest: Earliest Watched First and DateWatchedNewest: Latest Watched First

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I was also not a big fan of the label, but I also wasn't sure what to write, I'll look into ft-select and update the label accordingly (I like the Latest/Earliest watched first label more)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I changed the sort by texts please take a look

auto-merge was automatically disabled December 7, 2024 17:30

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 7, 2024 17:30
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 7, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions Bot added PR: merge conflicts / rebase needed and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Dec 7, 2024
@jlvivero
Copy link
Copy Markdown
Author

jlvivero commented Dec 7, 2024

I made some changes based on feedback, I switched to ft-select, I prepared the store to prepare for more sort options, when more sort options are added, historyCacheSorted would be the place to change things

(instead of just an inline if a case and calls to different sorting would be necessary).

in the case of this sort, it's just reversing the list not actually sorting, if other sorts would be added, we would need to stop doing that and actually sort, so a decision would have to be made if it's worth adding more sorting possibilities that would obviously make sorting slower, particularly with people with huge histories.

auto-merge was automatically disabled December 7, 2024 17:48

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 7, 2024 17:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 7, 2024

Conflicts have been resolved. A maintainer will review the pull request shortly.

@jlvivero
Copy link
Copy Markdown
Author

jlvivero commented Dec 7, 2024

I might have messed up the way I solved the conflicts (let me know if you prefer a clean PR again :(, or if something else)

@absidue
Copy link
Copy Markdown
Member

absidue commented Dec 7, 2024

Please solve the conflicts properly, you seem to have pulled in all the commits from the development branch so now it is really difficult to tell what changes are yours and merging this PR will then reland all of the existing changes on the development branch a second time.

The two usual approaches are:

  • git rebase development: That resets the starting point of your branch back to the current head of the development branch and recommits all of commits from this branch on top of it
  • git merge development: This merges in the changes from the development branch in a single commit that git recognises as a merge commit so ignores when comparing the changes and when this branch is merged into development

As for how to fix what you have done here, I'm not sure.

auto-merge was automatically disabled December 7, 2024 18:08

Head branch was pushed to by a user without write access

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 7, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@jlvivero
Copy link
Copy Markdown
Author

jlvivero commented Dec 7, 2024

I reset to my latest commit, I used rebase, but I think I messed it up somehow, unsure how it ended that way you can see only my changes now, I'll try to fix the merge conflicts in a bit... HOPEFULLY not messing everything up again lol

had to reset HEAD --hard <my_last_commit>

then I did the rebase properly after that

EDIT. that should have fixed it, sorry about the random trouble... please review when you have the chance

auto-merge was automatically disabled December 7, 2024 18:17

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) December 7, 2024 18:17
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 7, 2024

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions
Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@jlvivero
Copy link
Copy Markdown
Author

Hi, I apologize I haven't had time to make the chances, just changed jobs, I'll try to get the changes done next weekend

auto-merge was automatically disabled February 2, 2025 02:35

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) February 2, 2025 02:36
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 2, 2025

Conflicts have been resolved. A maintainer will review the pull request shortly.

@jlvivero
Copy link
Copy Markdown
Author

jlvivero commented Feb 2, 2025

I updated the PR with the changes from the code review, sorry for the delays, holidays then changed jobs, so I had a pretty hectic couple of months

@efb4f5ff-1298-471a-8973-3d47447115dc
Copy link
Copy Markdown
Member

Icon change requested in #6214 (comment) hasnt been implemented yet

@jlvivero
Copy link
Copy Markdown
Author

jlvivero commented Feb 3, 2025

Icon change requested in #6214 (comment) hasnt been implemented yet

I see I missed that one, I'll update it in a bit

@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 5, 2025

This PR was closed because it has been stalled for 14 days with no activity.

@github-actions github-actions Bot closed this Mar 5, 2025
auto-merge was automatically disabled March 5, 2025 02:00

Pull request was closed

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.

5 participants