add playlists radio to search result page
This commit is contained in:
parent
5fc613b21a
commit
01fd1503c9
6 changed files with 38 additions and 14 deletions
|
|
@ -47,6 +47,10 @@ const buttonLabel = computed(() => {
|
|||
return running.value
|
||||
? $pgettext('*/Player/Button.Label/Short, Verb', 'Stop artists radio')
|
||||
: $pgettext('*/Player/Button.Label/Short, Verb', 'Start artists radio')
|
||||
case 'playlist':
|
||||
return running.value
|
||||
? $pgettext('*/Player/Button.Label/Short, Verb', 'Stop playlists radio')
|
||||
: $pgettext('*/Player/Button.Label/Short, Verb', 'Start playlists radio')
|
||||
default:
|
||||
return running.value
|
||||
? $pgettext('*/Player/Button.Label/Short, Verb', 'Stop radio')
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export interface CurrentRadio {
|
|||
objectId: ObjectId | null
|
||||
}
|
||||
|
||||
export type RadioConfig = { type: 'tag', names: string[] } | { type: 'artist', ids: string[] }
|
||||
export type RadioConfig = { type: 'tag', names: string[] } | { type: 'artist' | 'playlist', ids: string[] }
|
||||
|
||||
const logger = useLogger()
|
||||
|
||||
|
|
|
|||
|
|
@ -191,18 +191,19 @@ const labels = computed(() => ({
|
|||
const radioConfig = computed(() => {
|
||||
const results = Object.values(currentResults.value?.results ?? {})
|
||||
if (results.length) {
|
||||
if (currentType.value?.id === 'tags') {
|
||||
return {
|
||||
type: 'tag',
|
||||
names: results.map(({ name }) => name)
|
||||
} as RadioConfig
|
||||
}
|
||||
switch (currentType.value?.id) {
|
||||
case 'tags':
|
||||
return {
|
||||
type: 'tag',
|
||||
names: results.map(({ name }) => name)
|
||||
} as RadioConfig
|
||||
|
||||
if (currentType.value?.id === 'artists') {
|
||||
return {
|
||||
type: 'artist',
|
||||
ids: results.map(({ id }) => id)
|
||||
} as RadioConfig
|
||||
case 'playlists':
|
||||
case 'artists':
|
||||
return {
|
||||
type: currentType.value.id.slice(0, -1),
|
||||
ids: results.map(({ id }) => id)
|
||||
} as RadioConfig
|
||||
}
|
||||
|
||||
// TODO (wvffle): Use logger
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue