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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
import {stitchArrays} from '#sugar';
import {
chunkByProperties,
sortEntryThingPairs,
sortFlashesChronologically,
} from '#wiki-data';
export default {
contentDependencies: [
'generateArtistInfoPageChunk',
'generateArtistInfoPageChunkItem',
'linkFlash',
],
extraDependencies: ['html', 'language'],
query(artist) {
const processFlashEntry = ({flash, contribs}) => ({
thing: flash,
entry: {
flash: flash,
act: flash.act,
contribs: contribs,
},
});
const processFlashEntries = ({flashes, contribs}) =>
stitchArrays({
flash: flashes,
contribs: contribs,
}).map(processFlashEntry);
const {flashesAsContributor} = artist;
const flashesAsContributorContribs =
flashesAsContributor
.map(flash => flash.contributorContribs);
const flashesAsContributorEntries =
processFlashEntries({
flashes: flashesAsContributor,
contribs: flashesAsContributorContribs,
});
const entries = [
...flashesAsContributorEntries,
];
sortEntryThingPairs(entries, sortFlashesChronologically);
const chunks =
chunkByProperties(
entries.map(({entry}) => entry),
['act']);
return {chunks};
},
relations(relation, query) {
// Flashes and games can list multiple contributors as collaborative
// credits, but we don't display these on the artist page, since they
// usually involve many artists crediting a larger team where collaboration
// isn't as relevant (without more particular details that aren't tracked
// on the wiki).
return {
chunks:
query.chunks.map(() => relation('generateArtistInfoPageChunk')),
actLinks:
query.chunks.map(({chunk}) =>
relation('linkFlash', chunk[0].flash)),
items:
query.chunks.map(({chunk}) =>
chunk.map(() => relation('generateArtistInfoPageChunkItem'))),
itemFlashLinks:
query.chunks.map(({chunk}) =>
chunk.map(({flash}) => relation('linkFlash', flash))),
};
},
data(query, artist) {
return {
actNames:
query.chunks.map(({act}) => act.name),
firstDates:
query.chunks.map(({chunk}) => chunk[0].flash.date ?? null),
lastDates:
query.chunks.map(({chunk}) => chunk.at(-1).flash.date ?? null),
itemContributions:
query.chunks.map(({chunk}) =>
chunk.map(({contribs}) =>
contribs
.find(({who}) => who === artist)
.what)),
};
},
generate(data, relations, {html, language}) {
return html.tag('dl',
stitchArrays({
chunk: relations.chunks,
actLink: relations.actLinks,
actName: data.actNames,
firstDate: data.firstDates,
lastDate: data.lastDates,
items: relations.items,
itemFlashLinks: relations.itemFlashLinks,
itemContributions: data.itemContributions,
}).map(({
chunk,
actLink,
actName,
firstDate,
lastDate,
items,
itemFlashLinks,
itemContributions,
}) =>
chunk.slots({
mode: 'flash',
flashActLink: actLink.slot('content', actName),
dateRangeStart: firstDate,
dateRangeEnd: lastDate,
items:
stitchArrays({
item: items,
flashLink: itemFlashLinks,
contribution: itemContributions,
}).map(({
item,
flashLink,
contribution,
}) =>
item.slots({
annotation: contribution,
content:
language.$('artistPage.creditList.entry.flash', {
flash: flashLink,
}),
})),
})));
},
};
|