From 10a6809dcfdc438a965ebe284e48aba5b2896716 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Wed, 15 Apr 2026 22:39:01 -0400 Subject: [PATCH] =?UTF-8?q?TOOLTIPS:=20game=20kit=20applet=20refactor=20?= =?UTF-8?q?=E2=80=94=20.token-tooltip=20=E2=86=92=20.tt=20+=20double-toolt?= =?UTF-8?q?ip=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _applet-game-kit.html: all 5 token blocks use .tt + child classes (.tt-title, .tt-description, .tt-shoptalk, .tt-expiry); removed .token-tooltip-body wrapper - gameboard.js: 4× querySelector('.token-tooltip') → querySelector('.tt') - _gameboard.scss: extend hover suppressor to .tt so CSS hover doesn't show inline .tt when JS portal is active (fixed double tooltip visual bug) Co-Authored-By: Claude Sonnet 4.6 --- .../static/apps/gameboard/gameboard.js | 8 +-- src/static_src/scss/_gameboard.scss | 3 +- .../gameboard/_partials/_applet-game-kit.html | 72 ++++++++----------- 3 files changed, 37 insertions(+), 46 deletions(-) diff --git a/src/apps/gameboard/static/apps/gameboard/gameboard.js b/src/apps/gameboard/static/apps/gameboard/gameboard.js index 5d735cc..51f3eae 100644 --- a/src/apps/gameboard/static/apps/gameboard/gameboard.js +++ b/src/apps/gameboard/static/apps/gameboard/gameboard.js @@ -41,7 +41,7 @@ function initGameKitTooltips() { if (!inRect(e.clientX, e.clientY, { left, top, right, bottom })) closePortals(); } else if (!portal.classList.contains('active')) { for (const tokenEl of gameKit.querySelectorAll('.token')) { - if (!tokenEl.querySelector('.token-tooltip')) continue; + if (!tokenEl.querySelector('.tt')) continue; if (inRect(e.clientX, e.clientY, tokenEl.getBoundingClientRect())) { showPortals(tokenEl); break; @@ -116,7 +116,7 @@ function initGameKitTooltips() { function showPortals(token) { equipping = false; activeToken = token; - const tooltip = token.querySelector('.token-tooltip'); + const tooltip = token.querySelector('.tt'); portal.innerHTML = tooltip.innerHTML; portal.classList.add('active'); portal.style.display = 'block'; @@ -161,14 +161,14 @@ function initGameKitTooltips() { document.addEventListener('mouseover', (e) => { const tokenEl = e.target.closest('#id_game_kit .token'); - if (!tokenEl || !tokenEl.querySelector('.token-tooltip')) return; + if (!tokenEl || !tokenEl.querySelector('.tt')) return; if (!portal.classList.contains('active') || activeToken !== tokenEl) { showPortals(tokenEl); } }); gameKit.querySelectorAll('.token').forEach(tokenEl => { - if (!tokenEl.querySelector('.token-tooltip')) return; + if (!tokenEl.querySelector('.tt')) return; tokenEl.addEventListener('mouseenter', () => { if (!portal.classList.contains('active') || activeToken !== tokenEl) { showPortals(tokenEl); diff --git a/src/static_src/scss/_gameboard.scss b/src/static_src/scss/_gameboard.scss index 167c20b..38d4ecd 100644 --- a/src/static_src/scss/_gameboard.scss +++ b/src/static_src/scss/_gameboard.scss @@ -78,7 +78,8 @@ body.page-gameboard { .token { position: static; } - .token:hover .token-tooltip { display: none; } + .token:hover .token-tooltip, + .token:hover .tt { display: none; } // JS portal handles show/hide .token, .kit-item { font-size: 1.5rem; } diff --git a/src/templates/apps/gameboard/_partials/_applet-game-kit.html b/src/templates/apps/gameboard/_partials/_applet-game-kit.html index 0830a25..23661b2 100644 --- a/src/templates/apps/gameboard/_partials/_applet-game-kit.html +++ b/src/templates/apps/gameboard/_partials/_applet-game-kit.html @@ -7,45 +7,39 @@ {% if pass_token %}
-
-
-

{{ pass_token.tooltip_name }}

-

{{ pass_token.tooltip_description }}

- {% if pass_token.tooltip_shoptalk %} - {{ pass_token.tooltip_shoptalk }} - {% endif %} -

{{ pass_token.tooltip_expiry }}

-
+
+

{{ pass_token.tooltip_name }}

+

{{ pass_token.tooltip_description }}

+ {% if pass_token.tooltip_shoptalk %} +

{{ pass_token.tooltip_shoptalk }}

+ {% endif %} +

{{ pass_token.tooltip_expiry }}

{% endif %} {% if carte %}
-
-
-

{{ carte.tooltip_name }}

-

{{ carte.tooltip_description }}

- {% if carte.tooltip_shoptalk %} - {{ carte.tooltip_shoptalk }} - {% endif %} -

{{ carte.tooltip_expiry }}

-
+
+

{{ carte.tooltip_name }}

+

{{ carte.tooltip_description }}

+ {% if carte.tooltip_shoptalk %} +

{{ carte.tooltip_shoptalk }}

+ {% endif %} +

{{ carte.tooltip_expiry }}

{% endif %} {% if coin %}
-
-
-

{{ coin.tooltip_name }}

-

{{ coin.tooltip_description }}

- {% if coin.tooltip_shoptalk %} - {{ coin.tooltip_shoptalk }} - {% endif %} -

{{ coin.tooltip_expiry }}

-
+
+

{{ coin.tooltip_name }}

+

{{ coin.tooltip_description }}

+ {% if coin.tooltip_shoptalk %} +

{{ coin.tooltip_shoptalk }}

+ {% endif %} +

{{ coin.tooltip_expiry }}

{% endif %} @@ -53,15 +47,13 @@ {% with free_tokens.0 as token %}
-
-
-

{{ token.tooltip_name }}{% if free_count > 1 %} (×{{ free_count }}){% endif %}

-

{{ token.tooltip_description }}

- {% if token.tooltip_shoptalk %} - {{ token.tooltip_shoptalk }} - {% endif %} -

{{ token.tooltip_expiry }}

-
+
+

{{ token.tooltip_name }}{% if free_count > 1 %} (×{{ free_count }}){% endif %}

+

{{ token.tooltip_description }}

+ {% if token.tooltip_shoptalk %} +

{{ token.tooltip_shoptalk }}

+ {% endif %} +

{{ token.tooltip_expiry }}

{% endwith %} @@ -69,11 +61,9 @@ {% for deck in deck_variants %}
-
-
-

{{ deck.name }}

-

{{ deck.card_count }} cards

-
+
+

{{ deck.name }}

+

{{ deck.card_count }} cards

{% empty %}