« get me outta code hell

content, data: generateWikiHomepageActionsRow - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-02-11 10:56:46 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-02-12 07:43:59 -0400
commit19d9c3a3d16ed08b2d0c9e09259ffb79a27cd3e9 (patch)
tree28f4576eae41596e8436525fe86bc9609fe2be09 /src/data
parent7ee12e72ae59f06dcde10f330dbfd023ae04709d (diff)
content, data: generateWikiHomepageActionsRow
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/homepage-layout.js31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/data/things/homepage-layout.js b/src/data/things/homepage-layout.js
index 3287d6f0..fa352ae7 100644
--- a/src/data/things/homepage-layout.js
+++ b/src/data/things/homepage-layout.js
@@ -80,6 +80,8 @@ export class HomepageLayout extends Thing {
 
       if (document['Row']) {
         switch (document['Row']) {
+          case 'actions':
+            return HomepageLayoutActionsRow;
           case 'albums':
             return HomepageLayoutAlbumsRow;
           default:
@@ -210,6 +212,34 @@ export class HomepageLayoutRow extends Thing {
   }
 }
 
+export class HomepageLayoutActionsRow extends HomepageLayoutRow {
+  static [Thing.friendlyName] = `Homepage Actions Row`;
+
+  static [Thing.getPropertyDescriptors] = (opts) => ({
+    ...HomepageLayoutRow[Thing.getPropertyDescriptors](opts),
+
+    // Update & expose
+
+    actionLinks: {
+      flags: {update: true, expose: true},
+      update: {validate: validateArrayItems(isString)},
+    },
+
+    // Expose only
+
+    type: {
+      flags: {expose: true},
+      expose: {compute: () => 'actions'},
+    },
+  });
+
+  static [Thing.yamlDocumentSpec] = Thing.extendDocumentSpec(HomepageLayoutRow, {
+    fields: {
+      'Actions': {property: 'actionLinks'},
+    },
+  });
+}
+
 export class HomepageLayoutAlbumsRow extends HomepageLayoutRow {
   static [Thing.friendlyName] = `Homepage Albums Row`;
 
@@ -282,7 +312,6 @@ export class HomepageLayoutAlbumsRow extends HomepageLayoutRow {
       'Group': {property: 'sourceGroup'},
       'Count': {property: 'countAlbumsFromGroup'},
       'Albums': {property: 'sourceAlbums'},
-      'Actions': {property: 'actionLinks'},
     },
   });
 }