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
|
export default {
contentDependencies: ['generateAlbumArtInfoBox', 'generateCoverArtwork'],
extraDependencies: ['html'],
query: (album) => ({
nonAttachingArtworkIndex:
(album.hasCoverArt
? album.coverArtworks.findIndex((artwork, index) =>
index > 1 &&
!artwork.attachAbove)
: null),
}),
relations: (relation, query, album) => ({
firstCovers:
(album.hasCoverArt && query.nonAttachingArtworkIndex >= 1
? album.coverArtworks
.slice(0, query.nonAttachingArtworkIndex)
.map(artwork => relation('generateCoverArtwork', artwork))
: album.hasCoverArt
? album.coverArtworks
.map(artwork => relation('generateCoverArtwork', artwork))
: []),
albumArtInfoBox:
relation('generateAlbumArtInfoBox', album),
restCovers:
(album.hasCoverArt && query.nonAttachingArtworkIndex >= 1
? album.coverArtworks
.slice(query.nonAttachingArtworkIndex)
.map(artwork => relation('generateCoverArtwork', artwork))
: []),
}),
generate(relations, {html}) {
for (const cover of [...relations.firstCovers, ...relations.restCovers]) {
cover.setSlots({
showOriginDetails: true,
showArtTagDetails: true,
showReferenceDetails: true,
});
}
return html.tags([
relations.firstCovers,
relations.albumArtInfoBox,
relations.restCovers,
]);
},
};
|