Skip to content

Add sort by date in history page #7157

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

Open
wants to merge 11 commits into
base: development
Choose a base branch
from

Conversation

anurag2787
Copy link
Contributor

@anurag2787 anurag2787 commented Apr 6, 2025

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

closes #5595

Description

In this PR i have added sort button in the history page where allowing user can organize their watch history either by Latest First or Oldest First where it will shows the watch history in ascending or descending order

Testing

Icon should change

  • Change the sort order using sort dropdown
  • Check and verify that the icon updates reflect or not on changing the sort order

Earliest first should not show latest when new entry added

  • Set sort order to Earliest Watched First
  • Add a new history by watching any new video
  • Verify that the new entry appears at the end not at the top

Sorting doesn't change when user uses keywords to filter

  • Set a sort order (Any Latest Watched First or Earliest Watched First)
  • Enter a search keywords in the search bar
  • Verify that the filtered results remains in the same sort order as before the search

Sort order change affects all other windows and new windows and future app instances

  • Set a sort order in one window (Any Latest Watched First or Earliest Watched First)
  • Open a new window in FreeTube or restart it
  • Verify that the selected sort order is preserved in second window or after restarting it.

General regression

  • Switch between sort orders and perform searches repeatedly
  • Confirm that the UI updates correctly and no unexpected behavior occurs

Demo

Sort By Oldest First

Screenshot 2025-04-06 233452

Sort By Latest First

Screenshot 2025-04-06 233431

Desktop

  • OS: Windows 11
  • OS Version: 24H2 (OS Build 26100.3476)
  • FreeTube version: 0.23.2

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Apr 6, 2025
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) April 6, 2025 18:09
@efb4f5ff-1298-471a-8973-3d47447115dc

Hi @anurag2787 nice to see a pr from you again. Did you already take a look at #6214 and the feedback we left on that

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • src/renderer/views/History/History.css: Language not supported
Comments suppressed due to low confidence (1)

static/locales/en-US.yaml:53

  • There is a trailing whitespace at the end of the 'Latest First' text which should be removed for consistency.
DateNewestHistory: Latest First 

:value="sortOrder"
:select-names="sortByNames"
:select-values="sortByValues"
:icon="getIconForSortPreference(setHistorySortOrder)"
Copy link
Preview

Copilot AI Apr 6, 2025

Choose a reason for hiding this comment

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

The getIconForSortPreference function is receiving setHistorySortOrder as its argument; it likely should receive the current sort order (e.g., the value from sortOrder) to determine the correct icon.

Suggested change
:icon="getIconForSortPreference(setHistorySortOrder)"
:icon="getIconForSortPreference(sortOrder)"

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

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

tested how copilot would work on this PR. Please disregard if this is a non issue.

auto-merge was automatically disabled April 7, 2025 09:24

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) April 7, 2025 09:24
@anurag2787
Copy link
Contributor Author

In getIconForSortPreference function instead of passing setHistorySortOrder i have passed the value of it sortOrder so that it can determine the correct icon

Copy link
Member

Choose a reason for hiding this comment

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

Icon doesnt change like on other pages.

VirtualBoxVM_4KNwAlFBhV.mp4

@@ -49,6 +49,8 @@ Global:
Live: Live
Community: Community
Sort By: Sort By
DateOldestHistory: Oldest First

Choose a reason for hiding this comment

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

Suggested change
DateOldestHistory: Oldest First
DateOldestHistory: Earliest Watched First

@@ -49,6 +49,8 @@ Global:
Live: Live
Community: Community
Sort By: Sort By
DateOldestHistory: Oldest First
DateNewestHistory: Latest First

Choose a reason for hiding this comment

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

Suggested change
DateNewestHistory: Latest First
DateNewestHistory: Latest Watched First

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Apr 8, 2025
auto-merge was automatically disabled April 12, 2025 07:28

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) April 12, 2025 07:28
@anurag2787
Copy link
Contributor Author

Fixed Icon change like on other pages

12.04.2025_12.46.03_REC.mp4

Also Updated history sort labels

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: changes requested labels Apr 13, 2025
@PikachuEXE PikachuEXE changed the title Added sort by date Add sort by date in history page Apr 14, 2025
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

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

It works but I wonder why the new translation keys are added to Global not History
image

auto-merge was automatically disabled April 15, 2025 13:58

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) April 15, 2025 13:58
@anurag2787
Copy link
Contributor Author

I have fixed it, the new translation keys now been added to the History instead of Global

PikachuEXE
PikachuEXE previously approved these changes Apr 16, 2025
Copy link
Collaborator

@kommunarr kommunarr left a comment

Choose a reason for hiding this comment

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

issue (blocking): When setting order to Earliest Watched First and then new history entries are added, they're shown at the start instead of the end, despite them being the latest entries watched. I believe this is because upsertToHistoryCache is not updated to handle non-default sort methods.


const state = {
historyCacheSorted: [],
useAscendingOrder: HISTORY_SORT_BY_VALUES.DateAddedNewest,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
useAscendingOrder: HISTORY_SORT_BY_VALUES.DateAddedNewest,
sortOrder: HISTORY_SORT_BY_VALUES.DateAddedNewest,

suggestion: Update variable name and concomitant uses to better reflect its type (sort type, not boolean).

auto-merge was automatically disabled June 18, 2025 05:29

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 18, 2025 05:29
Copy link
Contributor

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

auto-merge was automatically disabled June 18, 2025 05:33

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 18, 2025 05:33
auto-merge was automatically disabled June 18, 2025 05:35

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 18, 2025 05:35
auto-merge was automatically disabled June 18, 2025 06:06

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 18, 2025 06:06
auto-merge was automatically disabled June 18, 2025 06:20

Head branch was pushed to by a user without write access

@anurag2787 anurag2787 force-pushed the added-sort-in-history branch from c82969d to e16d423 Compare June 18, 2025 06:20
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 18, 2025 06:21
Copy link
Contributor

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

@anurag2787
Copy link
Contributor Author

I have accidentally pushed yarn.lock file in my commit and am now facing some difficulties reverting it back to the original state could you please help me to resolve this

@PikachuEXE
Copy link
Collaborator

Reversed

auto-merge was automatically disabled June 23, 2025 09:11

Head branch was pushed to by a user without write access

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) June 23, 2025 09:11
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

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

Changes since my last approval: (for other reviewers
image

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.

[Feature Request]: Add sort by date to the history page
5 participants