diff --git a/src/components/Article/AudioPlayer/PlayerPlaylist.tsx b/src/components/Article/AudioPlayer/PlayerPlaylist.tsx index 07cee3bd..b4eec25f 100644 --- a/src/components/Article/AudioPlayer/PlayerPlaylist.tsx +++ b/src/components/Article/AudioPlayer/PlayerPlaylist.tsx @@ -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 (