« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/generateAlbumWallpaperStyleTag.js4
-rw-r--r--src/content/dependencies/generateWikiWallpaperStyleTag.js4
-rw-r--r--src/data/things/album.js7
-rw-r--r--src/data/things/wiki-info.js16
4 files changed, 29 insertions, 2 deletions
diff --git a/src/content/dependencies/generateAlbumWallpaperStyleTag.js b/src/content/dependencies/generateAlbumWallpaperStyleTag.js
index b3f74716..caecc17b 100644
--- a/src/content/dependencies/generateAlbumWallpaperStyleTag.js
+++ b/src/content/dependencies/generateAlbumWallpaperStyleTag.js
@@ -7,6 +7,9 @@ export default {
   }),
 
   data: (album) => ({
+    wallpaperBrightness:
+      album.wallpaperBrightness,
+
     singleWallpaperPath:
       ['media.albumWallpaper', album.directory, album.wallpaperFileExtension],
 
@@ -26,6 +29,7 @@ export default {
   generate: (data, relations, {html}) =>
     (relations.wallpaperStyleTag
       ? relations.wallpaperStyleTag.slots({
+          wallpaperBrightness: data.wallpaperBrightness,
           singleWallpaperPath: data.singleWallpaperPath,
           singleWallpaperStyle: data.singleWallpaperStyle,
           wallpaperPartPaths: data.wallpaperPartPaths,
diff --git a/src/content/dependencies/generateWikiWallpaperStyleTag.js b/src/content/dependencies/generateWikiWallpaperStyleTag.js
index be52bcc1..0d84728f 100644
--- a/src/content/dependencies/generateWikiWallpaperStyleTag.js
+++ b/src/content/dependencies/generateWikiWallpaperStyleTag.js
@@ -7,6 +7,9 @@ export default {
   }),
 
   data: ({wikiInfo}) => ({
+    wallpaperBrightness:
+      wikiInfo.wikiWallpaperBrightness,
+
     singleWallpaperPath: [
       'media.path',
       'bg.' + wikiInfo.wikiWallpaperFileExtension,
@@ -27,6 +30,7 @@ export default {
 
   generate: (data, relations) =>
     relations.wallpaperStyleTag.slots({
+      wallpaperBrightness: data.wallpaperBrightness,
       singleWallpaperPath: data.singleWallpaperPath,
       singleWallpaperStyle: data.singleWallpaperStyle,
       wallpaperPartPaths: data.wallpaperPartPaths,
diff --git a/src/data/things/album.js b/src/data/things/album.js
index 31d94ef1..c9999f7c 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -268,6 +268,11 @@ export class Album extends Thing {
 
     trackDimensions: dimensions(),
 
+    wallpaperBrightness: {
+      flags: {update: true, expose: true},
+      update: {validate: isNumber},
+    },
+
     wallpaperArtwork: [
       exitWithoutDependency('hasWallpaperArt', {
         value: input.value(null),
@@ -667,6 +672,8 @@ export class Album extends Thing {
           }),
       },
 
+      'Wallpaper Brightness': {property: 'wallpaperBrightness'},
+
       'Wallpaper Artwork': {
         property: 'wallpaperArtwork',
         transform:
diff --git a/src/data/things/wiki-info.js b/src/data/things/wiki-info.js
index 26b69ba6..1d1f90e6 100644
--- a/src/data/things/wiki-info.js
+++ b/src/data/things/wiki-info.js
@@ -2,10 +2,16 @@ export const WIKI_INFO_FILE = 'wiki-info.yaml';
 
 import {input, V} from '#composite';
 import Thing from '#thing';
-import {isBoolean, isContributionPresetList, isLanguageCode, isName}
-  from '#validators';
 import {parseContributionPresets, parseWallpaperParts} from '#yaml';
 
+import {
+  isBoolean,
+  isContributionPresetList,
+  isLanguageCode,
+  isName,
+  isNumber,
+} from '#validators';
+
 import {exitWithoutDependency, exposeConstant} from '#composite/control-flow';
 
 import {
@@ -57,6 +63,11 @@ export class WikiInfo extends Thing {
     canonicalBase: canonicalBase(),
     canonicalMediaBase: canonicalBase(),
 
+    wikiWallpaperBrightness: {
+      flags: {update: true, expose: true},
+      update: {validate: isNumber},
+    },
+
     wikiWallpaperFileExtension: fileExtension(V('jpg')),
     wikiWallpaperStyle: simpleString(),
     wikiWallpaperParts: wallpaperParts(),
@@ -120,6 +131,7 @@ export class WikiInfo extends Thing {
       'Canonical Base': {property: 'canonicalBase'},
       'Canonical Media Base': {property: 'canonicalMediaBase'},
 
+      'Wiki Wallpaper Brightness': {property: 'wikiWallpaperBrightness'},
       'Wiki Wallpaper File Extension': {property: 'wikiWallpaperFileExtension'},
 
       'Wiki Wallpaper Style': {property: 'wikiWallpaperStyle'},