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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
export default {
extraDependencies: ['html', 'language'],
slots: {
mode: {
validate: v => v.is('flash', 'album'),
},
albumLink: {type: 'html'},
flashActLink: {type: 'html'},
date: {validate: v => v.isDate},
dateRangeStart: {validate: v => v.isDate},
dateRangeEnd: {validate: v => v.isDate},
duration: {validate: v => v.isDuration},
durationApproximate: {type: 'boolean'},
items: {type: 'html'},
},
generate(slots, {html, language}) {
let accentedLink;
accent: {
switch (slots.mode) {
case 'album': {
accentedLink = slots.albumLink;
const options = {album: accentedLink};
const parts = ['artistPage.creditList.album'];
if (slots.date) {
parts.push('withDate');
options.date = language.formatDate(slots.date);
}
if (slots.duration) {
parts.push('withDuration');
options.duration =
language.formatDuration(slots.duration, {
approximate: slots.durationApproximate,
});
}
accentedLink = language.formatString(...parts, options);
break;
}
case 'flash': {
accentedLink = slots.flashActLink;
const options = {act: accentedLink};
const parts = ['artistPage.creditList.flashAct'];
if (
slots.dateRangeStart &&
slots.dateRangeEnd &&
slots.dateRangeStart !== slots.dateRangeEnd
) {
parts.push('withDateRange');
options.dateRange = language.formatDateRange(slots.dateRangeStart, slots.dateRangeEnd);
} else if (slots.dateRangeStart || slots.date) {
parts.push('withDate');
options.date = language.formatDate(slots.dateRangeStart ?? slots.date);
}
accentedLink = language.formatString(...parts, options);
break;
}
}
}
return html.tags([
html.tag('dt', accentedLink),
html.tag('dd',
html.tag('ul',
slots.items)),
]);
},
};
|