From 295a63ef39080e24e458c110fd242c9f38fec48f Mon Sep 17 00:00:00 2001 From: devRaGonSa Date: Tue, 26 May 2026 12:00:06 +0200 Subject: [PATCH] fix: align hero header and map black weapon icons --- frontend/assets/css/hero-header-compact.css | 14 +- frontend/assets/js/partida-actual.js | 228 +++++++++++++++++--- 2 files changed, 207 insertions(+), 35 deletions(-) diff --git a/frontend/assets/css/hero-header-compact.css b/frontend/assets/css/hero-header-compact.css index f0a0535..fc3b05f 100644 --- a/frontend/assets/css/hero-header-compact.css +++ b/frontend/assets/css/hero-header-compact.css @@ -5,14 +5,14 @@ } .hero:not(.historical-hero) .hero__brand { - grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); - column-gap: clamp(96px, 8vw, 150px); - max-width: 1360px; + grid-template-columns: minmax(300px, 340px) minmax(0, 1fr); + column-gap: clamp(150px, 14vw, 260px); + max-width: 1420px; margin: 0 auto; } .hero:not(.historical-hero) .logo-frame { - width: min(390px, 100%); + width: min(370px, 100%); min-height: 300px; padding: 26px 30px; } @@ -44,8 +44,8 @@ @media (min-width: 1121px) and (max-width: 1380px) { .hero:not(.historical-hero) .hero__brand { - grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); - column-gap: clamp(72px, 6vw, 110px); + grid-template-columns: minmax(260px, 310px) minmax(0, 1fr); + column-gap: clamp(112px, 9vw, 150px); } .hero:not(.historical-hero) .hero__copy { @@ -55,4 +55,4 @@ .hero:not(.historical-hero) .hero__title { font-size: clamp(3.6rem, 5.5vw, 5.1rem); } -} \ No newline at end of file +} diff --git a/frontend/assets/js/partida-actual.js b/frontend/assets/js/partida-actual.js index 2841876..b3fd7fd 100644 --- a/frontend/assets/js/partida-actual.js +++ b/frontend/assets/js/partida-actual.js @@ -10,37 +10,209 @@ const CURRENT_MATCH_SCOREBOARDS = Object.freeze({ "comunidad-hispana-02": "https://scoreboard.comunidadhll.es:5443", }); const CURRENT_MATCH_KILL_FEED_LIMIT = 18; +const CURRENT_MATCH_BLACK_WEAPON_ICON_PATH = "./assets/img/weapons/black/"; +const CURRENT_MATCH_BLACK_WEAPON_ICON_FILES = Object.freeze([ + "bazooka_black.svg", + "bren_gun_black.svg", + "browing_m1919_black.svg", + "colt_1911_black.svg", + "dp27_black.svg", + "flammenwefer41_black.svg", + "gewehr_black.svg", + "kar98k_black.svg", + "kar98k_x8_black.svg", + "lee_enfield_n4_black.svg", + "luger_p08_black.svg", + "m1903_springfield_black.svg", + "m1_carabine_black.svg", + "m1_garand_black.svg", + "m2_flamethrower_black.svg", + "m3_grease_gun_black.svg", + "m97_black.svg", + "mg34_black.svg", + "mg42_black.svg", + "mosing_nagant_1891_black.svg", + "mosing_nagant_9130_black.svg", + "mosing_nagant_m38_black.svg", + "mp40_black.svg", + "nagant_m1895_black.svg", + "panzerchreck_black.svg", + "piat_black.svg", + "ppsh41_black.svg", + "ppsh_41w_drum_black.svg", + "ptrs41_black.svg", + "scoped_mosin_nagant_9130_black.svg", + "scoped_svt40_black.svg", + "sten_mk_v_black.svg", + "stg44_black.svg", + "svt40_black.svg", + "thompson_black.svg", + "tokarev_tt33_black.svg", + "walther_p38_black.svg", + "webley_revolver_black.svg", +]); const CURRENT_MATCH_WEAPONS = Object.freeze({ - "m1 garand": { label: "M1 Garand", icon: "m1_garand.PNG" }, - mp40: { label: "MP40", icon: "mp40.PNG" }, - "m1a1 thompson": { label: "M1A1 Thompson", icon: "thompson.PNG" }, - "m1a1": { label: "M1A1 Thompson", icon: "thompson.PNG" }, - thompson: { label: "M1A1 Thompson", icon: "thompson.PNG" }, - "gewehr 43": { label: "Gewehr 43", icon: "gewehr.PNG" }, - "gewehr43": { label: "Gewehr 43", icon: "gewehr.PNG" }, - g43: { label: "Gewehr 43", icon: "gewehr.PNG" }, - mg42: { label: "MG42", icon: "mg42.PNG" }, - kar98k: { label: "Kar98k", icon: "kar98k.PNG" }, - kar98: { label: "Kar98k", icon: "kar98k.PNG" }, - stg44: { label: "StG 44", icon: "stg44.PNG" }, - "stg 44": { label: "StG 44", icon: "stg44.PNG" }, - bar: { label: "BAR", icon: "" }, - "m1919": { label: "M1919", icon: "browing_m1919.PNG" }, - "m1919 browning": { label: "M1919", icon: "browing_m1919.PNG" }, - "browning m1919": { label: "M1919", icon: "browing_m1919.PNG" }, - "m1 carbine": { label: "M1 Carbine", icon: "m1_carabine.PNG" }, - "m1 carabine": { label: "M1 Carbine", icon: "m1_carabine.PNG" }, - luger: { label: "Luger", icon: "luger_p08.PNG" }, - "luger p08": { label: "Luger", icon: "luger_p08.PNG" }, - colt: { label: "Colt", icon: "colt_1911.PNG" }, - "colt 1911": { label: "Colt", icon: "colt_1911.PNG" }, - "colt m1911": { label: "Colt", icon: "colt_1911.PNG" }, - "frag grenade": { label: "Frag Grenade", icon: "" }, - grenade: { label: "Frag Grenade", icon: "" }, - "smoke grenade": { label: "Smoke Grenade", icon: "" }, + bazooka: currentMatchWeapon("Bazooka", "bazooka_black.svg"), + "m1 bazooka": currentMatchWeapon("M1 Bazooka", "bazooka_black.svg"), + "us bazooka": currentMatchWeapon("M1 Bazooka", "bazooka_black.svg"), + bren: currentMatchWeapon("Bren Gun", "bren_gun_black.svg"), + "bren gun": currentMatchWeapon("Bren Gun", "bren_gun_black.svg"), + m1919: currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + "m1919 browning": currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + "browning m1919": currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + browning: currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + "us tank machine gun": currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + "us coaxial mg": currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + "us vehicle mg": currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + "coaxial m1919": currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + "m1919 coaxial": currentMatchWeapon("Browning M1919", "browing_m1919_black.svg"), + colt: currentMatchWeapon("Colt 1911", "colt_1911_black.svg"), + "colt 1911": currentMatchWeapon("Colt 1911", "colt_1911_black.svg"), + "colt m1911": currentMatchWeapon("Colt 1911", "colt_1911_black.svg"), + m1911: currentMatchWeapon("Colt 1911", "colt_1911_black.svg"), + "m1911 pistol": currentMatchWeapon("Colt 1911", "colt_1911_black.svg"), + dp27: currentMatchWeapon("DP-27", "dp27_black.svg"), + "dp 27": currentMatchWeapon("DP-27", "dp27_black.svg"), + "dp 27 lmg": currentMatchWeapon("DP-27", "dp27_black.svg"), + "flammenwerfer 41": currentMatchWeapon("Flammenwerfer 41", "flammenwefer41_black.svg"), + flammenwerfer: currentMatchWeapon("Flammenwerfer 41", "flammenwefer41_black.svg"), + flammenwefer41: currentMatchWeapon("Flammenwerfer 41", "flammenwefer41_black.svg"), + "german flamethrower": currentMatchWeapon("Flammenwerfer 41", "flammenwefer41_black.svg"), + "gewehr 43": currentMatchWeapon("Gewehr 43", "gewehr_black.svg"), + gewehr43: currentMatchWeapon("Gewehr 43", "gewehr_black.svg"), + g43: currentMatchWeapon("Gewehr 43", "gewehr_black.svg"), + kar98k: currentMatchWeapon("Kar98k", "kar98k_black.svg"), + "kar 98k": currentMatchWeapon("Kar98k", "kar98k_black.svg"), + kar98: currentMatchWeapon("Kar98k", "kar98k_black.svg"), + k98: currentMatchWeapon("Kar98k", "kar98k_black.svg"), + "k98k": currentMatchWeapon("Kar98k", "kar98k_black.svg"), + "scoped kar98k": currentMatchWeapon("Scoped Kar98k", "kar98k_x8_black.svg"), + "kar98k x8": currentMatchWeapon("Scoped Kar98k", "kar98k_x8_black.svg"), + "kar 98k x8": currentMatchWeapon("Scoped Kar98k", "kar98k_x8_black.svg"), + "german sniper kar98k": currentMatchWeapon("Scoped Kar98k", "kar98k_x8_black.svg"), + "sniper kar98k": currentMatchWeapon("Scoped Kar98k", "kar98k_x8_black.svg"), + "lee enfield no 4": currentMatchWeapon("Lee-Enfield No.4", "lee_enfield_n4_black.svg"), + "lee enfield no4": currentMatchWeapon("Lee-Enfield No.4", "lee_enfield_n4_black.svg"), + "lee enfield": currentMatchWeapon("Lee-Enfield No.4", "lee_enfield_n4_black.svg"), + enfield: currentMatchWeapon("Lee-Enfield No.4", "lee_enfield_n4_black.svg"), + luger: currentMatchWeapon("Luger P08", "luger_p08_black.svg"), + p08: currentMatchWeapon("Luger P08", "luger_p08_black.svg"), + "luger p08": currentMatchWeapon("Luger P08", "luger_p08_black.svg"), + "m1903 springfield": currentMatchWeapon("M1903 Springfield", "m1903_springfield_black.svg"), + springfield: currentMatchWeapon("M1903 Springfield", "m1903_springfield_black.svg"), + "us sniper springfield": currentMatchWeapon("M1903 Springfield", "m1903_springfield_black.svg"), + "scoped springfield": currentMatchWeapon("M1903 Springfield", "m1903_springfield_black.svg"), + "m1 carbine": currentMatchWeapon("M1 Carbine", "m1_carabine_black.svg"), + "m1 carabine": currentMatchWeapon("M1 Carbine", "m1_carabine_black.svg"), + "m1 garand": currentMatchWeapon("M1 Garand", "m1_garand_black.svg"), + garand: currentMatchWeapon("M1 Garand", "m1_garand_black.svg"), + "m2 flamethrower": currentMatchWeapon("M2 Flamethrower", "m2_flamethrower_black.svg"), + "us flamethrower": currentMatchWeapon("M2 Flamethrower", "m2_flamethrower_black.svg"), + "m3 grease gun": currentMatchWeapon("M3 Grease Gun", "m3_grease_gun_black.svg"), + "grease gun": currentMatchWeapon("M3 Grease Gun", "m3_grease_gun_black.svg"), + m97: currentMatchWeapon("Winchester M97", "m97_black.svg"), + "winchester m97": currentMatchWeapon("Winchester M97", "m97_black.svg"), + "trench gun": currentMatchWeapon("Winchester M97", "m97_black.svg"), + shotgun: currentMatchWeapon("Winchester M97", "m97_black.svg"), + mg34: currentMatchWeapon("MG34", "mg34_black.svg"), + "mg 34": currentMatchWeapon("MG34", "mg34_black.svg"), + "german tank machine gun": currentMatchWeapon("MG34", "mg34_black.svg"), + "german coaxial mg": currentMatchWeapon("MG34", "mg34_black.svg"), + "german vehicle mg": currentMatchWeapon("MG34", "mg34_black.svg"), + "coaxial mg34": currentMatchWeapon("MG34", "mg34_black.svg"), + "mg34 coaxial": currentMatchWeapon("MG34", "mg34_black.svg"), + mg42: currentMatchWeapon("MG42", "mg42_black.svg"), + "mg 42": currentMatchWeapon("MG42", "mg42_black.svg"), + "mosin nagant 1891": currentMatchWeapon("Mosin Nagant 1891", "mosing_nagant_1891_black.svg"), + "mosin 1891": currentMatchWeapon("Mosin Nagant 1891", "mosing_nagant_1891_black.svg"), + "mosin nagant 91 30": currentMatchWeapon("Mosin Nagant 91/30", "mosing_nagant_9130_black.svg"), + "mosin 9130": currentMatchWeapon("Mosin Nagant 91/30", "mosing_nagant_9130_black.svg"), + "mosin nagant 9130": currentMatchWeapon("Mosin Nagant 91/30", "mosing_nagant_9130_black.svg"), + "mosin nagant m38": currentMatchWeapon("Mosin Nagant M38", "mosing_nagant_m38_black.svg"), + "mosin m38": currentMatchWeapon("Mosin Nagant M38", "mosing_nagant_m38_black.svg"), + m38: currentMatchWeapon("Mosin Nagant M38", "mosing_nagant_m38_black.svg"), + mp40: currentMatchWeapon("MP40", "mp40_black.svg"), + "mp 40": currentMatchWeapon("MP40", "mp40_black.svg"), + "nagant m1895": currentMatchWeapon("Nagant M1895", "nagant_m1895_black.svg"), + "nagant revolver": currentMatchWeapon("Nagant M1895", "nagant_m1895_black.svg"), + panzerschreck: currentMatchWeapon("Panzerschreck", "panzerchreck_black.svg"), + panzerchreck: currentMatchWeapon("Panzerschreck", "panzerchreck_black.svg"), + raketenpanzerbuchse: currentMatchWeapon("Panzerschreck", "panzerchreck_black.svg"), + piat: currentMatchWeapon("PIAT", "piat_black.svg"), + "ppsh 41": currentMatchWeapon("PPSh-41", "ppsh41_black.svg"), + ppsh41: currentMatchWeapon("PPSh-41", "ppsh41_black.svg"), + ppsh: currentMatchWeapon("PPSh-41", "ppsh41_black.svg"), + "ppsh 41 drum": currentMatchWeapon("PPSh-41 Drum", "ppsh_41w_drum_black.svg"), + "ppsh 41 w drum": currentMatchWeapon("PPSh-41 Drum", "ppsh_41w_drum_black.svg"), + "ppsh drum": currentMatchWeapon("PPSh-41 Drum", "ppsh_41w_drum_black.svg"), + "ppsh41 drum": currentMatchWeapon("PPSh-41 Drum", "ppsh_41w_drum_black.svg"), + "ptrs 41": currentMatchWeapon("PTRS-41", "ptrs41_black.svg"), + ptrs41: currentMatchWeapon("PTRS-41", "ptrs41_black.svg"), + ptrs: currentMatchWeapon("PTRS-41", "ptrs41_black.svg"), + "scoped mosin nagant 91 30": currentMatchWeapon("Scoped Mosin Nagant 91/30", "scoped_mosin_nagant_9130_black.svg"), + "scoped mosin nagant 9130": currentMatchWeapon("Scoped Mosin Nagant 91/30", "scoped_mosin_nagant_9130_black.svg"), + "soviet sniper mosin": currentMatchWeapon("Scoped Mosin Nagant 91/30", "scoped_mosin_nagant_9130_black.svg"), + "sniper mosin": currentMatchWeapon("Scoped Mosin Nagant 91/30", "scoped_mosin_nagant_9130_black.svg"), + "scoped svt 40": currentMatchWeapon("Scoped SVT-40", "scoped_svt40_black.svg"), + "scoped svt40": currentMatchWeapon("Scoped SVT-40", "scoped_svt40_black.svg"), + "svt40 scoped": currentMatchWeapon("Scoped SVT-40", "scoped_svt40_black.svg"), + "sten mk v": currentMatchWeapon("Sten Mk V", "sten_mk_v_black.svg"), + sten: currentMatchWeapon("Sten Mk V", "sten_mk_v_black.svg"), + stg44: currentMatchWeapon("StG 44", "stg44_black.svg"), + "stg 44": currentMatchWeapon("StG 44", "stg44_black.svg"), + "sturmgewehr 44": currentMatchWeapon("StG 44", "stg44_black.svg"), + "svt 40": currentMatchWeapon("SVT-40", "svt40_black.svg"), + svt40: currentMatchWeapon("SVT-40", "svt40_black.svg"), + "m1a1 thompson": currentMatchWeapon("M1A1 Thompson", "thompson_black.svg"), + m1a1: currentMatchWeapon("M1A1 Thompson", "thompson_black.svg"), + "m1928 thompson": currentMatchWeapon("M1928 Thompson", "thompson_black.svg"), + thompson: currentMatchWeapon("Thompson", "thompson_black.svg"), + "tokarev tt 33": currentMatchWeapon("Tokarev TT-33", "tokarev_tt33_black.svg"), + "tokarev tt33": currentMatchWeapon("Tokarev TT-33", "tokarev_tt33_black.svg"), + tt33: currentMatchWeapon("Tokarev TT-33", "tokarev_tt33_black.svg"), + "walther p38": currentMatchWeapon("Walther P38", "walther_p38_black.svg"), + p38: currentMatchWeapon("Walther P38", "walther_p38_black.svg"), + webley: currentMatchWeapon("Webley Revolver", "webley_revolver_black.svg"), + "webley revolver": currentMatchWeapon("Webley Revolver", "webley_revolver_black.svg"), unknown: { label: "Arma desconocida", icon: "" }, }); +validateCurrentMatchWeaponMapping(); + +function currentMatchWeapon(label, fileName) { + return { + label, + icon: `${CURRENT_MATCH_BLACK_WEAPON_ICON_PATH}${fileName}`, + }; +} + +function validateCurrentMatchWeaponMapping() { + const expectedIcons = new Set(CURRENT_MATCH_BLACK_WEAPON_ICON_FILES); + const mappedIcons = new Set(); + const invalidIcons = []; + Object.entries(CURRENT_MATCH_WEAPONS).forEach(([alias, weapon]) => { + if (!weapon.icon) { + return; + } + if (!weapon.icon.startsWith(CURRENT_MATCH_BLACK_WEAPON_ICON_PATH)) { + invalidIcons.push(`${alias}: ${weapon.icon}`); + return; + } + const fileName = weapon.icon.slice(CURRENT_MATCH_BLACK_WEAPON_ICON_PATH.length); + mappedIcons.add(fileName); + if (!expectedIcons.has(fileName)) { + invalidIcons.push(`${alias}: ${weapon.icon}`); + } + }); + const unmappedIcons = [...expectedIcons].filter((fileName) => !mappedIcons.has(fileName)); + if (unmappedIcons.length > 0 || invalidIcons.length > 0) { + console.warn("Current match weapon icon mapping needs review.", { + unmappedIcons, + invalidIcons, + }); + } +} + document.addEventListener("DOMContentLoaded", () => { const params = new URLSearchParams(window.location.search); const serverSlug = params.get("server") || ""; @@ -361,7 +533,7 @@ function renderKillFeedWeaponIcon(weapon) { return `