fix(showcase): responsive card, full localization, in-game stat icons and clean PNG export

Layout: card now fills its container (3/2/1 columns) with no horizontal scrollbar.

i18n: every modal/showcase/console string follows the selected language, named fallbacks for th/en plus English fallback for other locales, localized character names and light-cone passive text.

Showcase stats use the official in-game property icons (same set as the overview tab) instead of emoji, including the element DMG icon.

Export: fixed 1200px clone with poster metrics, cover-cropped splash art (html2canvas ignores object-fit), transparent background so the rounded corners have no dark wedges, and a two-pass measurement inside the capture iframe so the PNG is never cropped.
This commit is contained in:
CAtlas0784 committed 2026-11-01 14:49:56 +07:00
1 parent d9b7a4ce1b
commit 76986eed4a
9 files changed
+775 -187

No files matched your search

+20 -3
View File
@@ -1,4 +1,4 @@
import { getCurrentLanguage, translateElement, translatePath } from "./i18n.js";
import { getCurrentLanguage, translateElement, translatePath } from "./i18n.js?v=2.16";
export const AVATAR_METADATA = {
"1001": {
@@ -2099,6 +2099,23 @@ export const CW_ROLE_METADATA = {
}
};
// Localized defaults used when a Trailblazer entry stores the {NICKNAME} placeholder.
const TRAILBLAZER_DEFAULT_NAMES = {
th: 'ผู้บุกเบิก (Trailblazer)',
en: 'Trailblazer',
'zh-CN': '开拓者',
'zh-TW': '開拓者',
ja: '開拓者',
ko: '개척자',
ru: 'Первопроходец',
vi: 'Nhà Khai Phá',
id: 'Trailblazer',
es: 'El Emisario',
fr: 'Le Pionnier',
de: 'Der Bahnbrecher',
pt: 'O Desbravador'
};
export function getAvatarInfo(avatarId, langOverride = null) {
const lang = langOverride || getCurrentLanguage();
const meta = AVATAR_METADATA[avatarId] || CW_ROLE_METADATA[avatarId];
@@ -2113,9 +2130,9 @@ export function getAvatarInfo(avatarId, langOverride = null) {
};
}
let localizedName = meta.names?.[lang] || meta.names?.th || meta.names?.en || `Avatar ${avatarId}`;
let localizedName = meta.names?.[lang] || meta.names?.en || meta.names?.th || `Avatar ${avatarId}`;
if (localizedName.includes('{NICKNAME}')) {
const tbName = lang === 'th' ? 'ผู้บุกเบิก (Trailblazer)' : 'Trailblazer';
const tbName = TRAILBLAZER_DEFAULT_NAMES[lang] || TRAILBLAZER_DEFAULT_NAMES.en;
localizedName = localizedName.replace(/\{NICKNAME\}/g, tbName).trim();
if (!localizedName) localizedName = tbName;
}