« get me outta code hell

module-ify track pages - 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:
author(quasar) nebula <towerofnix@gmail.com>2021-06-01 19:57:57 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-06-01 19:57:57 -0300
commitca6613c8585b6a7a46a390960b31a377c57f4028 (patch)
treea165ffba0e6833071582eef792e3819667516e35 /src/util
parent234747721fec14e69fc75d6c0134ad4a5ae7736e (diff)
module-ify track pages
Diffstat (limited to 'src/util')
-rw-r--r--src/util/magic-constants.js11
-rw-r--r--src/util/wiki-data.js6
2 files changed, 16 insertions, 1 deletions
diff --git a/src/util/magic-constants.js b/src/util/magic-constants.js
new file mode 100644
index 00000000..3174daec
--- /dev/null
+++ b/src/util/magic-constants.js
@@ -0,0 +1,11 @@
+// Magic constants only! These are hard-coded, and any use of them should be
+// considered a flaw in the codebase - areas where we use hard-coded behavior
+// to support one use of the wiki software (i.e. HSMusic, usually), rather than
+// implementing the feature more generally/customizably.
+//
+// All such uses should eventually be replaced with better code in due time
+// (TM).
+
+export const UNRELEASED_TRACKS_DIRECTORY = 'unreleased-tracks';
+export const OFFICIAL_GROUP_DIRECTORY = 'official';
+export const FANDOM_GROUP_DIRECTORY = 'fandom';
diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js
index 13b86090..e4142c85 100644
--- a/src/util/wiki-data.js
+++ b/src/util/wiki-data.js
@@ -1,5 +1,9 @@
 // Utility functions for interacting with wiki data.
 
+import {
+    UNRELEASED_TRACKS_DIRECTORY
+} from '../util/magic-constants.js';
+
 // Generic value operations
 
 export function getKebabCase(name) {
@@ -95,7 +99,7 @@ export function getAlbumCover(album, {to}) {
 
 export function getAlbumListTag(album) {
     // TODO: This is hard-coded! No. 8ad.
-    return (album.directory === 'unreleased-tracks' ? 'ul' : 'ol');
+    return (album.directory === UNRELEASED_TRACKS_DIRECTORY ? 'ul' : 'ol');
 }
 
 // This gets all the track o8jects defined in every al8um, and sorts them 8y