Skip to content

Commit b82bbd5

Browse files
committed
content: generateArtistInfoPage: wiki editor commentary list
1 parent 0bde481 commit b82bbd5

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

src/content/dependencies/generateArtistInfoPage.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ export default {
115115
relation('generateArtistInfoPageFlashesChunkedList', artist),
116116

117117
commentaryChunkedList:
118-
relation('generateArtistInfoPageCommentaryChunkedList', artist),
118+
relation('generateArtistInfoPageCommentaryChunkedList', artist, false),
119+
120+
wikiEditorCommentaryChunkedList:
121+
relation('generateArtistInfoPageCommentaryChunkedList', artist, true),
119122
}),
120123

121124
data: (query, artist) => ({
@@ -262,7 +265,8 @@ export default {
262265
{href: '#flashes'},
263266
language.$(pageCapsule, 'flashList.title')),
264267

265-
!html.isBlank(relations.commentaryChunkedList) &&
268+
(!html.isBlank(relations.commentaryChunkedList) ||
269+
!html.isBlank(relations.wikiEditorCommentaryChunkedList)) &&
266270
html.tag('a',
267271
{href: '#commentary'},
268272
language.$(pageCapsule, 'commentaryList.title')),
@@ -380,6 +384,17 @@ export default {
380384
}),
381385

382386
relations.commentaryChunkedList,
387+
388+
html.tags([
389+
html.tag('p',
390+
{[html.onlyIfSiblings]: true},
391+
392+
language.$(pageCapsule, 'wikiEditorCommentary', {
393+
artist: data.name,
394+
})),
395+
396+
relations.wikiEditorCommentaryChunkedList,
397+
]),
383398
]),
384399
],
385400

src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js

+13-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919

2020
extraDependencies: ['html', 'language'],
2121

22-
query(artist) {
22+
query(artist, filterWikiEditorCommentary) {
2323
const processEntry = ({
2424
thing,
2525
entry,
@@ -87,6 +87,12 @@ export default {
8787
.flatMap(thing =>
8888
thing.commentary
8989
.filter(entry => entry.artists.includes(artist))
90+
91+
.filter(({annotation}) =>
92+
(filterWikiEditorCommentary
93+
? annotation?.startsWith(`wiki editor`)
94+
: !annotation?.startsWith(`wiki editor`)))
95+
9096
.map(entry => processEntry({thing, entry})));
9197

9298
const processAlbumEntries = ({albums}) =>
@@ -146,7 +152,7 @@ export default {
146152
return {chunks};
147153
},
148154

149-
relations: (relation, query) => ({
155+
relations: (relation, query, _artist, filterWikiEditorCommentary) => ({
150156
chunks:
151157
query.chunks
152158
.map(() => relation('generateArtistInfoPageChunk')),
@@ -179,10 +185,13 @@ export default {
179185
query.chunks
180186
.map(({chunk}) => chunk
181187
.map(({annotation}) =>
182-
relation('transformContent', annotation))),
188+
relation('transformContent',
189+
(filterWikiEditorCommentary
190+
? annotation?.replace(/^wiki editor(, )?/, '')
191+
: annotation)))),
183192
}),
184193

185-
data: (query) => ({
194+
data: (query, _artist, _filterWikiEditorCommentary) => ({
186195
chunkTypes:
187196
query.chunks
188197
.map(({chunkType}) => chunkType),

src/strings-default.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,9 @@ artistPage:
12471247
wikiEditArtworks: >-
12481248
{ARTIST} has edited these artworks for this wiki:
12491249
1250+
wikiEditorCommentary: >-
1251+
{ARTIST} has written these commentary entries as an editor of this wiki:
1252+
12501253
#
12511254
# artistGalleryPage:
12521255
# The artist gallery page shows a neat grid of all of the album and

0 commit comments

Comments
 (0)