1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import {stitchArrays} from '#sugar';
export default {
contentDependencies: ['linkTrack'],
extraDependencies: ['html', 'language'],
relations: (relation, track) => ({
trackLinks:
track.otherReleases
.map(track => relation('linkTrack', track)),
}),
data: (track) => ({
albumNames:
track.otherReleases
.map(track => track.album.name),
albumColors:
track.otherReleases
.map(track => track.album.color),
}),
generate: (data, relations, {html, language}) =>
html.tag('p',
{[html.onlyIfContent]: true},
language.$('releaseInfo.alsoReleasedOn', {
[language.onlyIfOptions]: ['albums'],
albums:
language.formatConjunctionList(
stitchArrays({
trackLink: relations.trackLinks,
albumName: data.albumNames,
albumColor: data.albumColors,
}).map(({trackLink, albumName, albumColor}) =>
trackLink.slots({
content: language.sanitize(albumName),
color: albumColor,
}))),
})),
};
|