« get me outta code hell

generateAlbumTrackListMissingDuration.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/generateAlbumTrackListMissingDuration.js
blob: b59179824cb8a1f2f088b6aaa0bbecfc8fb0bd0f (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
export default {
  contentDependencies: ['generateTextWithTooltip', 'generateTooltip'],
  extraDependencies: ['html', 'language'],

  relations: (relation) => ({
    textWithTooltip:
      relation('generateTextWithTooltip'),

    tooltip:
      relation('generateTooltip'),
  }),

  generate: (relations, {html, language}) =>
    language.encapsulate('trackList.item.withDuration', itemCapsule =>
      language.encapsulate(itemCapsule, 'duration', durationCapsule =>
        relations.textWithTooltip.slots({
          attributes: {class: 'missing-duration'},
          customInteractionCue: true,

          text:
            language.$(durationCapsule, {
              duration:
                html.tag('span', {class: 'text-with-tooltip-interaction-cue'},
                  language.$(durationCapsule, 'missing')),
            }),

          tooltip:
            relations.tooltip.slots({
              attributes: {class: 'missing-duration-tooltip'},

              content:
                language.$(durationCapsule, 'missing.info'),
            }),
        }))),
};