Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add a simple toggle switch to change search history from descending t…
…o ascending
  • Loading branch information
JL committed Feb 2, 2025
commit a0bdfadceef398e367c18f15829a4ab1b4d69f54
6 changes: 2 additions & 4 deletions src/renderer/views/History/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ function filterVideosWithQuery(videos, query, attrProcessor = identity) {
} else if (typeof (video.author) === 'string' && attrProcessor(video.author).includes(query)) {
return true
}

return false
}).sort((a, b) => {
Comment thread
absidue marked this conversation as resolved.
return b.timeWatched - a.timeWatched
})
}

Expand All @@ -44,14 +41,15 @@ export default defineComponent({
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

showLoadMoreButton: false,
query: '',
activeData: [],
}
},
computed: {
historyCacheSorted: function () {
return this.$store.getters.getHistoryCacheSorted
return this.ascending ? [...this.$store.getters.getHistoryCacheSorted].reverse() : this.$store.getters.getHistoryCacheSorted
Comment thread
jlvivero marked this conversation as resolved.
Outdated
},

fullData: function () {
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/views/History/History.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
: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

v-if="fullData.length > 1"
:label="$t('History.history sort by date ascending/descending')"
:compact="true"
:default-value="ascending"
@change="ascending = !ascending"
/>
</div>
<ft-flex-box
v-show="fullData.length === 0"
Expand Down