Refactoring: move method

This commit is contained in:
Pieter Vander Vennet 2025-08-01 17:31:41 +02:00
parent a2ad13dd50
commit b8a0fbe662
15 changed files with 31 additions and 44 deletions

View file

@ -6,6 +6,7 @@ import ThemeConfig from "../src/Models/ThemeConfig/ThemeConfig"
import LayerConfig from "../src/Models/ThemeConfig/LayerConfig"
import { Utils } from "../src/Utils"
import { Lists } from "../src/Utils/Lists"
import { Strings } from "../src/Utils/Strings"
/**
* Generates all the files in "Docs/TagInfo". These are picked up by the taginfo project, showing a link to the mapcomplete theme if the key is used
@ -107,8 +108,8 @@ function generateLayerUsage(layer: LayerConfig): TagInfoPrototype[] {
layerName,
shownText: descr,
layer,
icon: !Utils.isEmoji(tr.renderIcon) ? tr.renderIcon : undefined,
emoji: Utils.isEmoji(tr.renderIcon) ? tr.renderIcon : undefined,
icon: !Strings.isEmoji(tr.renderIcon) ? tr.renderIcon : undefined,
emoji: Strings.isEmoji(tr.renderIcon) ? tr.renderIcon : undefined,
trid: tr.id,
})
}
@ -123,8 +124,8 @@ function generateLayerUsage(layer: LayerConfig): TagInfoPrototype[] {
shownText: `${mapping.if.asHumanString()} is displayed as "${
mapping.then.txt
}"`,
icon: !Utils.isEmoji(mapping.icon) ? mapping.icon : undefined,
emoji: Utils.isEmoji(mapping.icon) ? mapping.icon : undefined,
icon: !Strings.isEmoji(mapping.icon) ? mapping.icon : undefined,
emoji: Strings.isEmoji(mapping.icon) ? mapping.icon : undefined,
trid: tr.id,
})
}