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
  | 
export default {
  relations: (relation, act, _flash) => ({
    box:
      relation('generatePageSidebarBox'),
    actLink:
      relation('linkFlashAct', act),
    flashLinks:
      act.flashes
        .map(flash => relation('linkFlash', flash)),
  }),
  data: (act, flash) => ({
    isFlashActPage:
      !flash,
    currentFlashIndex:
      act.flashes.indexOf(flash),
    customListTerminology:
      act.listTerminology,
  }),
  generate: (data, relations, {html, language}) =>
    relations.box.slots({
      attributes: {class: 'flash-act-map-sidebar-box'},
      content: [
        html.tag('h1', relations.actLink),
        html.tag('details',
          (data.isFlashActPage
            ? {}
            : {class: 'current', open: true}),
          [
            html.tag('summary',
              html.tag('span',
                html.tag('b',
                  (data.customListTerminology
                    ? language.sanitize(data.customListTerminology)
                    : language.$('flashSidebar.flashList.entriesInThisSection'))))),
            html.tag('ul',
              relations.flashLinks
                .map((flashLink, index) =>
                  html.tag('li',
                    index === data.currentFlashIndex &&
                      {class: 'current'},
                    flashLink))),
          ]),
        ],
    }),
};
  |