media-item-fix
This commit is contained in:
parent
22b616e6d1
commit
b805d7eeb3
|
@ -25,6 +25,8 @@ type Props = {
|
||||||
onChangeMediaIndex?: (direction: 'up' | 'down', index) => void
|
onChangeMediaIndex?: (direction: 'up' | 'down', index) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getMediaTitle = (itm: MediaItem, idx: number) => `${idx}. ${itm.artist} - ${itm.title}`
|
||||||
|
|
||||||
export const PlayerPlaylist = (props: Props) => {
|
export const PlayerPlaylist = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t } = useLocalize()
|
||||||
const [activeEditIndex, setActiveEditIndex] = createSignal(-1)
|
const [activeEditIndex, setActiveEditIndex] = createSignal(-1)
|
||||||
|
@ -36,11 +38,12 @@ export const PlayerPlaylist = (props: Props) => {
|
||||||
props.onMediaItemFieldChange(activeEditIndex(), field, value)
|
props.onMediaItemFieldChange(activeEditIndex(), field, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const play = (index) => {
|
const play = (index: number) => {
|
||||||
const mi = props.media[index]
|
const mi = props.media[index]
|
||||||
gtag('event', 'select_item', {
|
gtag('event', 'select_item', {
|
||||||
item_list_id: props.articleSlug,
|
item_list_id: props.articleSlug,
|
||||||
item_list_name: mi.title || '' + ' - ' + mi.artist || '',
|
item_list_name: getMediaTitle(mi, index),
|
||||||
|
items: props.media.map((it, ix) => getMediaTitle(it, ix)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user