diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e7ab264..b3493f6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,6 +25,11 @@ jobs: uses: actions/checkout@v4 - name: Setup Pages uses: actions/configure-pages@v4 + - name: Generate deployment branch metadata + env: + DEPLOY_BRANCH: ${{ github.ref_name }} + run: | + node -e 'const fs = require("node:fs"); const data = { branch: process.env.DEPLOY_BRANCH, version: "1.0.0", updatedAt: new Date().toISOString() }; fs.writeFileSync("version.json", JSON.stringify(data, null, 2) + "\n");' - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/index.html b/index.html index 1b7718a..82c6a5c 100644 --- a/index.html +++ b/index.html @@ -1673,6 +1673,6 @@
- + diff --git a/js/app.js b/js/app.js index 01cc894..e67caac 100644 --- a/js/app.js +++ b/js/app.js @@ -1,6 +1,6 @@ import { AVATAR_METADATA, getAvatarInfo } from './avatars-data.js'; import { LIGHTCONE_METADATA, RELIC_SET_METADATA, getLightconeInfo, getRelicSetInfo } from './equipment-data.js'; -import { SUPPORTED_LANGUAGES, TRANSLATIONS, getCurrentLanguage, setLanguage, t, translateElement, translatePath } from './i18n.js'; +import { SUPPORTED_LANGUAGES, TRANSLATIONS, getCurrentLanguage, setLanguage, t, translateElement, translatePath } from './i18n.js?v=2.3'; import { getAvatarIconUrl, getLightconeArtUrl, @@ -110,6 +110,7 @@ const el = { analystDuration: document.getElementById('analyst-duration'), analystBattleMeta: document.getElementById('analyst-battle-meta'), analystShareBarContainer: document.getElementById('analyst-share-bar-container'), + analystTotalShareLabel: document.getElementById('analyst-total-share-label'), analystShareLegend: document.getElementById('analyst-share-legend'), analystCharactersContainer: document.getElementById('analyst-characters-container'), analystEnemiesContainer: document.getElementById('analyst-enemies-container'), @@ -8075,6 +8076,11 @@ function renderDamageAnalyst() { } const teamDmg = report.team_total_damage || 0; + const hasAvatarDamage = Array.isArray(report.avatars) + && report.avatars.some(a => Number(a.total_damage) > 0); + if (el.analystTotalShareLabel) { + el.analystTotalShareLabel.textContent = hasAvatarDamage ? t('analystShareTotal') : t('analystShareUnavailable'); + } if (el.analystTeamDamage) el.analystTeamDamage.textContent = formatNumber(teamDmg); if (el.analystCycles) { el.analystCycles.textContent = (report.round_cnt !== undefined) ? `${report.round_cnt} รอบ (${report.round_cnt}-Cycle)` : '0 รอบ'; @@ -8113,7 +8119,7 @@ function renderDamageAnalyst() { if (report.avatars && report.avatars.length > 0) { el.analystShareBarContainer.innerHTML = report.avatars.map((a, idx) => { const color = colors[idx % colors.length]; - const pct = a.damage_percent || (teamDmg > 0 ? (a.total_damage / teamDmg) * 100 : 0); + const pct = hasAvatarDamage ? (a.damage_percent || (teamDmg > 0 ? (a.total_damage / teamDmg) * 100 : 0)) : 0; const info = getAvatarInfo(a.avatar_id); return `
`; }).join(''); @@ -8128,13 +8134,13 @@ function renderDamageAnalyst() { el.analystShareLegend.innerHTML = report.avatars.map((a, idx) => { const color = colors[idx % colors.length]; const info = getAvatarInfo(a.avatar_id); - const pct = a.damage_percent || (teamDmg > 0 ? (a.total_damage / teamDmg) * 100 : 0); + const pct = hasAvatarDamage ? (a.damage_percent || (teamDmg > 0 ? (a.total_damage / teamDmg) * 100 : 0)) : null; return `
${info.name} - ${pct.toFixed(1)}% + ${pct === null ? '—' : `${pct.toFixed(1)}%`} (${formatNumber(a.total_damage)})
`; @@ -8156,7 +8162,7 @@ function renderDamageAnalyst() { el.analystCharactersContainer.innerHTML = report.avatars.map((a, idx) => { const color = colors[idx % colors.length]; const info = getAvatarInfo(a.avatar_id); - const pct = a.damage_percent || (teamDmg > 0 ? (a.total_damage / teamDmg) * 100 : 0); + const pct = hasAvatarDamage ? (a.damage_percent || (teamDmg > 0 ? (a.total_damage / teamDmg) * 100 : 0)) : null; let maxHit = 0; if (a.attack_type_max_damage) { @@ -8200,7 +8206,7 @@ function renderDamageAnalyst() {
-
${pct.toFixed(1)}%
+
${pct === null ? '—' : `${pct.toFixed(1)}%`}
DPS SHARE
diff --git a/js/i18n.js b/js/i18n.js index 341b433..4daa47e 100644 --- a/js/i18n.js +++ b/js/i18n.js @@ -479,6 +479,8 @@ export const TRANSLATIONS = { "analystHealing": "การฟื้นฟู HP รวม", "analystShield": "โล่ป้องกันรวม", "analystDpsShare": "สัดส่วนดาเมจ (DPS Share)", + "analystShareTotal": "รวม 100%", + "analystShareUnavailable": "สัดส่วนตัวละคร: ไม่มีข้อมูล", "analystBreakdownTitle": "รายละเอียดดาเมจจำแนกตามประเภท", "analystDmgNormal": "🗡️ โจมตีปกติ", "analystDmgSkill": "⚡ สกิลต่อสู้", @@ -518,6 +520,8 @@ export const TRANSLATIONS = { "analystHealing": "Total Healing", "analystShield": "Total Shield", "analystDpsShare": "Damage Share (DPS %)", + "analystShareTotal": "Total 100%", + "analystShareUnavailable": "Character shares unavailable", "analystBreakdownTitle": "Damage Breakdown by Category", "analystDmgNormal": "🗡️ Basic ATK", "analystDmgSkill": "⚡ Skill",