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
|
import {empty} from '../../util/sugar.js';
export default {
contentDependencies: ['image', 'linkArtTag'],
extraDependencies: ['html', 'language'],
relations(relation, artTags) {
const relations = {};
relations.image =
relation('image', artTags);
if (artTags) {
relations.tagLinks =
artTags
.filter(tag => !tag.isContentWarning)
.map(tag => relation('linkArtTag', tag));
} else {
relations.tagLinks = null;
}
return relations;
},
generate(relations, {html, language}) {
return html.template(slot =>
html.tag('div', {id: 'cover-art-container'}, [
relations.image
.slot('path', slot('path'))
.slot('alt', slot('alt'))
.slot('thumb', 'medium')
.slot('id', 'cover-art')
.slot('link', true)
.slot('square', true),
!empty(relations.tagLinks) &&
html.tag('p',
language.$('releaseInfo.artTags.inline', {
tags: language.formatUnitList(relations.tagLinks),
})),
]));
},
};
|