Add support for other attribute types in generic previews

This commit is contained in:
DrMint 2024-06-11 21:53:53 +02:00
parent d02095254a
commit 12d9228502
1 changed files with 13 additions and 6 deletions

View File

@ -64,13 +64,20 @@ for (const attribute of attributes) {
clippedAttributes.push(attribute);
} else {
metaLength += getLocalizedMatch(attribute.translations).name.length;
if (attribute.type === AttributeTypes.Tags) {
switch (attribute.type) {
case AttributeTypes.Number:
metaLength += attribute.value.toString().length;
break;
case AttributeTypes.Text:
metaLength += attribute.value.length;
break;
case AttributeTypes.Tags:
metaLength += attribute.value
.map(({ translations }) => getLocalizedMatch(translations).name)
.join(", ").length;
metaLength += clippedAttributes.push(attribute);
break;
}
// TODO: Handle other attribute types
metaLength += clippedAttributes.push(attribute);
}
metaLength += 8;
}