mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2024-11-22 09:56:23 +01:00
Add icons corresponding to bookmarked page route
This commit is contained in:
parent
039fce110d
commit
85e46b5bc5
@ -2,7 +2,7 @@ import { defineComponent } from 'vue'
|
||||
import { mapActions } from 'vuex'
|
||||
|
||||
import FtTooltip from '../ft-tooltip/ft-tooltip.vue'
|
||||
import { isKeyboardEventKeyPrintableChar, isNullOrEmpty } from '../../helpers/strings'
|
||||
import { getIconForRoute, isKeyboardEventKeyPrintableChar, isNullOrEmpty } from '../../helpers/strings'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'FtInput',
|
||||
@ -330,6 +330,17 @@ export default defineComponent({
|
||||
this.inputData = text
|
||||
},
|
||||
|
||||
iconForBookmarkedPage: (pageBookmark) => {
|
||||
const routeSlashIndex = pageBookmark.route.indexOf('/', 2)
|
||||
let route
|
||||
if (routeSlashIndex === -1) {
|
||||
route = pageBookmark.route
|
||||
} else {
|
||||
route = pageBookmark.route.substring(0, routeSlashIndex)
|
||||
}
|
||||
return getIconForRoute(route) ?? ['fas', 'magnifying-glass']
|
||||
},
|
||||
|
||||
focus() {
|
||||
this.$refs.input.focus()
|
||||
},
|
||||
|
@ -87,7 +87,7 @@
|
||||
>
|
||||
<font-awesome-icon
|
||||
v-if="entry.isBookmark"
|
||||
:icon="['fas', 'star']"
|
||||
:icon="iconForBookmarkedPage(entry)"
|
||||
class="searchResultIcon bookmarkStarIcon"
|
||||
/>
|
||||
<font-awesome-icon
|
||||
|
@ -53,6 +53,37 @@ export function translateWindowTitle(title, i18n) {
|
||||
}
|
||||
}
|
||||
|
||||
export function getIconForRoute(path) {
|
||||
switch (path) {
|
||||
case '/subscriptions':
|
||||
return ['fas', 'rss']
|
||||
case '/subscribedchannels':
|
||||
case '/channel':
|
||||
return ['fas', 'list']
|
||||
case '/trending':
|
||||
return ['fas', 'fire']
|
||||
case '/popular':
|
||||
return ['fas', 'users']
|
||||
case '/userplaylists':
|
||||
return ['fas', 'bookmark']
|
||||
case '/history':
|
||||
return ['fas', 'history']
|
||||
case '/settings':
|
||||
return ['fas', 'sliders-h']
|
||||
case '/about':
|
||||
return ['fas', 'info-circle']
|
||||
case '/search':
|
||||
case '/hashtag':
|
||||
return ['fas', 'magnifying-glass']
|
||||
case '/playlist':
|
||||
return ['fas', 'bars']
|
||||
case '/watch':
|
||||
return ['fas', 'play']
|
||||
default:
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an appropriate default bookmark name
|
||||
* for a given route.
|
||||
|
Loading…
Reference in New Issue
Block a user