« 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/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 0000000..3174dae
--- /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 13b8609..e4142c8 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