Files
Florian Zumpe 5c4d20bd1d
Sonarqube Scanner / Prepare environment (push) Successful in 19s
Sonarqube Scanner / Build and test (push) Successful in 43s
Sonarqube Scanner / SonarQube analysis (push) Failing after 2m28s
Sonarqube Scanner / Deploy to Server (push) Successful in 16s
fix sonar findings and translation structure
2026-10-01 16:31:46 +02:00

55 lines
1.5 KiB
JavaScript

globalThis.Wegwichtel ??= {};
(function (ns) {
'use strict';
const entries = Object.freeze([
['🪵', "symbols.wood"],
['🪨', "symbols.rock"],
['🏮', "symbols.lantern"],
['🌼', "symbols.flower"],
['🚬', "symbols.pipe"],
['🐦', "symbols.bird"],
['🍄', "symbols.mushroom"],
['🍓', "symbols.strawberry"],
['🎃', "symbols.pumpkin"]
].map(([unicode, labelKey]) => Object.freeze({
unicode,
get label() { return ns.I18n.t(labelKey); },
imageUrl: `/images/group-symbols/${unicode}.png`
})));
// Presentation selectors must not create different symbols for the same object.
function normalizeUnicode(value) {
if (typeof value !== 'string') return null;
return value.normalize('NFC').replaceAll(/[\uFE0E\uFE0F]/g, '');
}
const byUnicode = new Map(entries.map(entry => [normalizeUnicode(entry.unicode), entry]));
/**
* Read-only catalogue of the nine group-code motifs.
* Loading this file only registers the class; it does not create UI or sessions.
*/
class GroupSymbols {
static list() {
return entries;
}
/** Returns the immutable motif descriptor, or null for an unknown symbol. */
static get(unicode) {
return byUnicode.get(normalizeUnicode(unicode)) ?? null;
}
static has(unicode) {
return this.get(unicode) !== null;
}
static imageUrl(unicode) {
return this.get(unicode)?.imageUrl ?? null;
}
}
ns.GroupSymbols = GroupSymbols;
}(globalThis.Wegwichtel));