diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2026-01-31 22:17:54 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2026-01-31 22:17:54 -0400 |
| commit | e4faa8a4cbc08621a95413047370b2bda25bb3cb (patch) | |
| tree | 889f3a5cb6c65ea6c9df266f1ac61180b46f75bc /src | |
| parent | 9de8146884faf5d3681ddfa5d867d0ebacf1fc7a (diff) | |
data, content: MusicVideo.title, drop MusicVideo.labelStyle
Diffstat (limited to 'src')
| -rw-r--r-- | src/content/dependencies/generateMusicVideo.js | 23 | ||||
| -rw-r--r-- | src/data/things/MusicVideo.js | 38 |
2 files changed, 33 insertions, 28 deletions
diff --git a/src/content/dependencies/generateMusicVideo.js b/src/content/dependencies/generateMusicVideo.js index a481cb16..b62c0224 100644 --- a/src/content/dependencies/generateMusicVideo.js +++ b/src/content/dependencies/generateMusicVideo.js @@ -18,12 +18,12 @@ export default { }), data: (musicVideo, _thing) => ({ + title: + musicVideo.title, + label: musicVideo.label, - labelStyle: - musicVideo.labelStyle, - url: musicVideo.url, }), @@ -32,21 +32,18 @@ export default { language.encapsulate('misc.musicVideo', capsule => html.tag('div', {class: 'music-video'}, [ html.tag('p', {class: 'music-video-label'}, - data.labelStyle !== 'label' && - {class: data.labelStyle + '-style'}, + data.title && + {class: 'title-style'}, language.encapsulate(capsule, 'label', workingCapsule => { const workingOptions = {}; - if (data.label) { + if (data.title) { + workingCapsule += '.customLabel.title'; + workingOptions.title = data.title; + } else if (data.label) { workingCapsule += '.customLabel'; - - if (data.labelStyle === 'title') { - workingCapsule += '.title'; - workingOptions.title = data.label; - } else { - workingOptions.label = data.label; - } + workingOptions.label = data.label; } return language.$(workingCapsule, workingOptions); diff --git a/src/data/things/MusicVideo.js b/src/data/things/MusicVideo.js index 5016b9c3..b3dd31e6 100644 --- a/src/data/things/MusicVideo.js +++ b/src/data/things/MusicVideo.js @@ -12,7 +12,8 @@ import { exposeConstant, exposeDependency, exposeUpdateValueOrContinue, - withResultOfAvailabilityCheck, + exposeWhetherDependencyAvailable, + exitWithoutDependency, } from '#composite/control-flow'; import { @@ -34,21 +35,31 @@ export class MusicVideo extends Thing { thing: thing(), - label: { + title: { flags: {update: true, expose: true}, update: {validate: isStringNonEmpty}, - expose: {transform: value => value ?? 'Music video'}, }, - labelStyle: { - flags: {update: true, expose: true}, - update: { - validate: - is('label', 'title'), + label: [ + exposeUpdateValueOrContinue({ + validate: input.value(isStringNonEmpty), + }), + + exitWithoutDependency('title', V('Music video')), + exposeConstant(V(null)), + ], + + unqualifiedDirectory: [ + { + dependencies: ['title', 'label'], + compute: (continuation, {title, label}) => + continuation({ + '#name': label ?? title, + }), }, - }, - unqualifiedDirectory: directory({name: 'label'}), + directory({name: '#name'}), + ], date: [ exposeUpdateValueOrContinue({ @@ -82,16 +93,13 @@ export class MusicVideo extends Thing { isMusicVideo: exposeConstant(V(true)), - dateIsSpecified: [ - withResultOfAvailabilityCheck('_date'), - exposeDependency('#availability'), - ], + dateIsSpecified: exposeWhetherDependencyAvailable('_date'), }); static [Thing.yamlDocumentSpec] = { fields: { + 'Title': {property: 'title'}, 'Label': {property: 'label'}, - 'Label Style': {property: 'labelStyle'}, 'Directory': {property: 'unqualifiedDirectory'}, 'Date': {property: 'date', transform: parseDate}, 'URL': {property: 'url'}, |