« get me outta code hell

generateAlbumArtInfoBox.js « dependencies « content « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateAlbumArtInfoBox.js
blob: 8c44c930ac27151d2900c78f88cb47fd641143b8 (plain)
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
export default {
  contentDependencies: ['generateReleaseInfoContributionsLine'],
  extraDependencies: ['html', 'language'],

  relations: (relation, album) => ({
    wallpaperArtistContributionsLine:
      (album.wallpaperArtwork
        ? relation('generateReleaseInfoContributionsLine',
            album.wallpaperArtwork.artistContribs)
        : null),

    bannerArtistContributionsLine:
      (album.bannerArtwork
        ? relation('generateReleaseInfoContributionsLine',
            album.bannerArtwork.artistContribs)
        : null),
  }),

  generate: (relations, {html, language}) =>
    language.encapsulate('releaseInfo', capsule =>
      html.tag('div', {class: 'album-art-info'},
        {[html.onlyIfContent]: true},

        html.tag('p',
          {[html.onlyIfContent]: true},
          {[html.joinChildren]: html.tag('br')},

          [
            relations.wallpaperArtistContributionsLine?.slots({
              stringKey: capsule + '.wallpaperArtBy',
              chronologyKind: 'wallpaperArt',
            }),

            relations.bannerArtistContributionsLine?.slots({
              stringKey: capsule + '.bannerArtBy',
              chronologyKind: 'bannerArt',
            }),
          ]))),
};