From 3e5c8f731117b01fdf46c4fe066e1c349dee3827 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 25 Mar 2026 11:18:42 -0300 Subject: content, data: Divide Flash Lists By Sides --- src/data/things/Track.js | 39 +++++++++++++++++++++++++++++++++++++-- src/data/things/WikiInfo.js | 30 ++++++++++++++++++++++++++++-- 2 files changed, 65 insertions(+), 4 deletions(-) (limited to 'src/data/things') diff --git a/src/data/things/Track.js b/src/data/things/Track.js index 5cb6388a..36e3733d 100644 --- a/src/data/things/Track.js +++ b/src/data/things/Track.js @@ -5,7 +5,7 @@ import {colors} from '#cli'; import {input, V} from '#composite'; import find, {keyRefRegex} from '#find'; import {onlyItem} from '#sugar'; -import {sortByDate} from '#sort'; +import {sortByDate, sortFlashesChronologically} from '#sort'; import Thing from '#thing'; import {compareKebabCase} from '#wiki-data'; @@ -884,9 +884,44 @@ export class Track extends Thing { reverse: soupyReverse.input('tracksWhichSample'), }), - featuredInFlashes: reverseReferenceList({ + ownFeaturedInFlashes: reverseReferenceList({ reverse: soupyReverse.input('flashesWhichFeature'), }), + + featuredInFlashes: [ + { + dependencies: ['allReleases'], + compute: (continuation, {allReleases}) => continuation({ + ['#data']: + allReleases.flatMap(track => + track.ownFeaturedInFlashes.map(flash => ({ + flash, + track, + + // These properties are used for the upcoming sort. + act: flash.act, + date: flash.date, + }))), + }), + }, + + { + dependencies: ['#data'], + compute: (continuation, {'#data': data}) => continuation({ + ['#sortedData']: + sortFlashesChronologically(data), + }), + }, + + { + dependencies: ['#sortedData'], + compute: ({'#sortedData': sortedData}) => + sortedData.map(item => ({ + flash: item.flash, + as: item.track, + })), + }, + ], }); static [Thing.yamlDocumentSpec] = { diff --git a/src/data/things/WikiInfo.js b/src/data/things/WikiInfo.js index ffb18cd8..364ae517 100644 --- a/src/data/things/WikiInfo.js +++ b/src/data/things/WikiInfo.js @@ -1,6 +1,5 @@ import {input, V} from '#composite'; import Thing from '#thing'; -import {parseContributionPresets, parseWallpaperParts} from '#yaml'; import { isBoolean, @@ -10,9 +9,16 @@ import { isNumber, } from '#validators'; +import { + parseAnnotatedReferences, + parseContributionPresets, + parseWallpaperParts, +} from '#yaml'; + import {exitWithoutDependency, exposeConstant} from '#composite/control-flow'; import { + annotatedReferenceList, canonicalBase, color, contentString, @@ -30,7 +36,7 @@ export class WikiInfo extends Thing { static [Thing.wikiData] = 'wikiInfo'; static [Thing.oneInstancePerWiki] = true; - static [Thing.getPropertyDescriptors] = ({Group}) => ({ + static [Thing.getPropertyDescriptors] = ({FlashSide, Group}) => ({ // Update & expose name: name(V('Unnamed Wiki')), @@ -75,6 +81,15 @@ export class WikiInfo extends Thing { find: soupyFind.input('group'), }), + divideFlashListsBySides: annotatedReferenceList({ + class: input.value(FlashSide), + find: soupyFind.input('flashSide'), + + reference: input.value('side'), + annotation: input.value('label'), + thing: input.value('side'), + }), + contributionPresets: { flags: {update: true, expose: true}, update: {validate: isContributionPresetList}, @@ -147,6 +162,17 @@ export class WikiInfo extends Thing { 'Divide Track Lists By Groups': {property: 'divideTrackListsByGroups'}, + 'Divide Flash Lists By Sides': { + property: 'divideFlashListsBySides', + transform: value => + parseAnnotatedReferences(value, { + referenceField: 'Side', + referenceProperty: 'side', + annotationField: 'Label', + annotationProperty: 'label', + }), + }, + 'Contribution Presets': { property: 'contributionPresets', transform: parseContributionPresets, -- cgit 1.3.0-6-gf8a5