media-item-fix

This commit is contained in:
Untone 2024-01-29 16:53:08 +03:00
parent 22b616e6d1
commit b805d7eeb3

View File

@ -25,6 +25,8 @@ type Props = {
onChangeMediaIndex?: (direction: 'up' | 'down', index) => void
}
const getMediaTitle = (itm: MediaItem, idx: number) => `${idx}. ${itm.artist} - ${itm.title}`
export const PlayerPlaylist = (props: Props) => {
const { t } = useLocalize()
const [activeEditIndex, setActiveEditIndex] = createSignal(-1)
@ -36,11 +38,12 @@ export const PlayerPlaylist = (props: Props) => {
props.onMediaItemFieldChange(activeEditIndex(), field, value)
}
const play = (index) => {
const play = (index: number) => {
const mi = props.media[index]
gtag('event', 'select_item', {
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 (