diff --git a/src/routes/SearchResults.vue b/src/routes/SearchResults.vue
index bad47aa..711448d 100644
--- a/src/routes/SearchResults.vue
+++ b/src/routes/SearchResults.vue
@@ -5,10 +5,10 @@
@@ -42,21 +42,9 @@ export default {
GenericDisplayItem,
VideoItem
},
- data () {
- return {
- results: null,
- availableFilters: [
- 'all',
- 'videos',
- 'channels',
- 'playlists',
- 'music_songs',
- 'music_videos',
- 'music_albums',
- 'music_playlists'
- ]
- }
- },
+ data: () => ({
+ results: null
+ }),
metaInfo () {
return {
title: this.$route.query.search_query
@@ -66,6 +54,29 @@ export default {
mounted () {
this.updateResults()
},
+
+ computed: {
+ filterValue () {
+ return this.$route.query.filter ?? 'all'
+ },
+
+ options () {
+ return [
+ 'all',
+ 'videos',
+ 'channels',
+ 'playlists',
+ 'music_songs',
+ 'music_videos',
+ 'music_albums',
+ 'music_playlists'
+ ].map((name) => ({
+ text: this.$t('search_results.result_types.' + name),
+ value: name
+ }))
+ }
+ },
+
watch: {
// For history navigation
'$route.query.search_query' () {
@@ -105,7 +116,7 @@ export default {
path: 'search',
params: {
q: this.$route.query.search_query,
- filter: this.$route.query.filter ?? 'all'
+ filter: this.filterValue
}
})
},
diff --git a/src/translations/en.json b/src/translations/en.json
index 243b80f..bf28ed8 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -27,6 +27,19 @@
"lastWatchedTill": "Last watched till {t}",
"watchedAgo": "Watched {t} till {p}"
},
+ "search_results": {
+ "filterLabel": "Filter results by type",
+ "result_types": {
+ "all": "All videos",
+ "videos": "Ordinary videos",
+ "channels": "Channels",
+ "playlists": "Playlists",
+ "music_songs": "Songs (YouTube Music)",
+ "music_videos": "Music Videos (YouTube Music)",
+ "music_albums": "Albums (YouTube Music)",
+ "music_playlists": "Playlists (YouTube Music)"
+ }
+ },
"video_sharing_panel": {
"title": "Share this video",
"share": "Share",