« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/external-links.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/util/external-links.js b/src/util/external-links.js
index 8e1c3ca9..2047a720 100644
--- a/src/util/external-links.js
+++ b/src/util/external-links.js
@@ -12,6 +12,7 @@ import {
 export const externalLinkStyles = [
   'normal',
   'compact',
+  'platform',
   'icon-id',
 ];
 
@@ -181,16 +182,15 @@ export function getMatchingDescriptorsForExternalLink(url, descriptors) {
 export function getExternalLinkStringsFromDescriptor(url, descriptor, language) {
   const prefix = 'misc.external';
 
-  const results = {
-    'normal': null,
-    'compact': null,
-    'icon-id': null,
-  };
+  const results =
+    Object.fromEntries(externalLinkStyles.map(style => [style, null]));
 
   const {hostname: domain, pathname} = new URL(url);
 
   const place = language.$(prefix, descriptor.string);
 
+  results['platform'] = place;
+
   if (descriptor.icon) {
     results['icon-id'] = descriptor.icon;
   }
@@ -270,11 +270,8 @@ export function getExternalLinkStringsFromDescriptor(url, descriptor, language)
 }
 
 export function getExternalLinkStringsFromDescriptors(url, descriptors, language) {
-  const results = {
-    'normal': null,
-    'compact': null,
-    'icon-id': null,
-  };
+  const results =
+    Object.fromEntries(externalLinkStyles.map(style => [style, null]));
 
   const remainingKeys =
     new Set(Object.keys(results));