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
|
export default {
contentDependencies: ['linkAnythingMan'],
extraDependencies: ['html', 'language'],
query(contribution) {
let previous = contribution;
while (previous && previous.thing === contribution.thing) {
previous = previous.previousBySameArtist;
}
let next = contribution;
while (next && next.thing === contribution.thing) {
next = next.nextBySameArtist;
}
return {previous, next};
},
relations: (relation, query, _contribution) => ({
previousLink:
(query.previous
? relation('linkAnythingMan', query.previous.thing)
: null),
nextLink:
(query.next
? relation('linkAnythingMan', query.next.thing)
: null),
}),
data: (query, _contribution) => ({
previousName:
(query.previous
? query.previous.thing.name
: null),
nextName:
(query.next
? query.next.thing.name
: null),
}),
generate: (data, relations, {html, language}) =>
language.encapsulate('misc.artistLink', capsule =>
html.tags([
relations.previousLink?.slots({
attributes: {class: 'chronology-link'},
content: [
html.tag('span', {class: 'chronology-symbol'},
language.$(capsule, 'previousSymbol')),
html.tag('span', {class: 'chronology-text'},
language.sanitize(data.previousName)),
],
}),
relations.nextLink?.slots({
attributes: {class: 'chronology-link'},
content: [
html.tag('span', {class: 'chronology-symbol'},
language.$(capsule, 'nextSymbol')),
html.tag('span', {class: 'chronology-text'},
language.sanitize(data.nextName)),
],
}),
])),
};
|