feat: My Sea applet dynamic population + lay/leave POSITION_LABELS swap fix + My Sign applet stat-block + Brief-fied sign-gate + --duoUser olive on all four personal-data surfaces. Six visual+structural items batched across the dashboard/billboard/gameboard.
All checks were successful
ci/woodpecker/push/pyswiss Pipeline was successful
ci/woodpecker/push/main Pipeline was successful

(1) **My Sea applet dynamic population.** Applet at `_applet-my-sea.html` was referencing an undefined `latest_draw_cards` template var — fell through to "No draws yet" even when the user had an active draw. New helpers in `apps/gameboard/models.py`: `DRAW_ORDER` + `POSITION_LABELS` constants (Python mirrors of the JS dicts in `my_sea.html:274-293`) + `latest_draw_slots(user)` builder that pairs each spread position w. its drawn card + display label + polarity. Wired through `gameboard()` + `toggle_game_applets()` views as `my_sea_slots`. Applet now renders all spread slots in DRAW_ORDER: filled = `.my-sea-slot--filled.my-sea-slot--{gravity,levity}` w. corner-tl + face (name + arcana) + corner-br (mirror) markup (same shape language as my_sign.html `.sig-stage-card`), empty = `.my-sea-slot--empty` w. `0.15rem dashed rgba(var(--terUser), 1)` border (matches the picker's `.sea-card-slot` style exactly so the applet reads as a true scaled-down twin). Container queries (`container-type: size` on `.my-sea-scroll`) lift `--slot-w` to fill the applet's vertical aperture (`min(100cqi, calc((100cqh - 1rem) * 5 / 8))` carves the label row). Position labels pulled tight against the slot's bottom border (`margin-top: -0.15rem` crosses the border line) + vertically stretched (`transform: scaleY(1.4)` mirroring `.sea-pos-label` in `_card-deck.scss:1671-1684`) — empty-slot labels keep the same `--secUser` ink as filled-slot labels for title cohesion across the row. Horizontal-scroll on multi-card spreads via mousewheel — `bindMySeaWheel()` in `gameboard.js` translates vertical wheel events to `scrollLeft += deltaY` (lifted verbatim from `bindPaletteWheel` in `dashboard.js:7-14`).

(2) **lay/leave POSITION_LABELS swap fix.** User caught in the Escape Velocity picker that LEFT slot read "Lay" + BOTTOM slot read "Leave" — opposite of traditional Celtic Cross semantics (LEFT = Behind/past, BOTTOM = Beneath/root). Root cause: POSITION_LABELS for both Waite-Smith + Escape Velocity had `lay`/`leave` slug→label assignments inverted vs the CSS grid's spatial mapping (`_card-deck.scss:1276-1279` puts slug `lay` at BOTTOM, slug `leave` at LEFT). Fix in 5 places: `my_sea.html:287,292` JS POSITION_LABELS (WS: lay→"Beneath", leave→"Behind"; EV: lay→"Lay", leave→"Leave"), `gameboard/models.py:44-47` Python mirror, `test_game_my_sea.py:618-619` FT label-assertion table, `_sea_overlay.html:28,53` annotated comments (`sea-pos-leave` → "Behind (past) — CC pos 6 / EV pos 4"; `sea-pos-lay` → "Beneath (root) — CC pos 4 / EV pos 3"). Slug-to-CSS mapping, DRAW_ORDER, + DB persistence unchanged → no migrations, no data invalidation. **Crucial for Voronoi mapping correctness** per user spec.

(3) **My Sign applet — stage-card layout + stat-block beside.** Applet card markup upgraded to mirror my_sign.html `.sig-stage-card`: corner-tl + face (name + arcana centred) + corner-br (mirror, rotated 180°). Sized to fill applet height via container queries (`--applet-card-w: min(48cqi, 62.5cqh)` — 48cqi caps the card at half the row to leave room for the stat-block). Sibling `.my-sign-applet-stat-block` partial added — emanation/reversal face label + keyword list (from `card.keywords_upright` / `keywords_reversed` keyed off `significator_reversed`), no SPIN/FYI buttons (applet is read-only). Styling cribbed from `.sig-stat-block` in `_card-deck.scss:595-607` — priUser-translucent bg + terUser border + matching `--applet-card-w` sizing.

(4) **My Sea sign-gate refactored to Brief banner.** Was an inline `.my-sea-sign-gate` div w. its own SCSS — broke from the project's `Brief.showBanner` portal pattern. Refactored to a shared `_my_sea_sign_gate_brief.html` partial that fires `Brief.showBanner` w. title="Sign required" + line_text="Look!—pick your sign before drawing the Sea." + post_url=`/billboard/my-sign/`. Brief portals to the page-level h2 anchor via `note.js`'s `_alignToH2` (gaussian-glass `.note-banner` shell, FYI button → my-sign picker, NVM dismisses). Modifier class `.my-sea-sign-gate-brief` added post-render for FT selector disambiguation. note.js load hoisted to gameboard.html `{% block scripts %}` + the top of `my_sea.html {% block content %}` (single load per page — note.js declares `const Brief = ...` at global scope, second load = SyntaxError). All `.my-sea-sign-gate{,--applet,__line,__actions,__back,__fyi}` SCSS deleted. FTs (`test_no_sig_renders_lookline_gate_on_standalone_page` + 5 siblings) + ITs (`test_my_sea_applet_fires_sign_gate_brief_for_user_without_sig` etc.) updated to assert `.note-banner.my-sea-sign-gate-brief` + the JS-rendered FYI/NVM buttons inside the Brief shell.

(5) **Levity card text invisibility fix.** My-sea applet levity slots (--secUser bg) rendered their corner-rank + suit-icon invisible because `.fan-card-corner` carries a global `color: rgba(var(--secUser), 0.75)` rule at `_card-deck.scss:312-319` (specificity 0,1,0) that out-specifics the slot's inherited `color: --priUser`. Same trap as the `.fan-card-name { color: --quiUser }` global. Fix at `_gameboard.scss` inside the levity rule: explicit `.fan-card-corner { color: rgba(var(--priUser), 1) }` + `.fan-card-name { color: rgba(var(--priUser), 1) }` + `.fan-card-arcana { color: rgba(var(--priUser), 0.7) }` overrides at (1,3,1) specificity — beats the globals without `!important`. **Trap captured in memory** — pattern repeats across game-kit, my-sign, my-sea so worth pinning.

(6) **--duoUser olive on all five personal-data surfaces.** Per user spec, the four "personal" applets (My Sign on billboard, My Sea on gameboard, My Sky on dashboard) + the standalone Dashsky page + the standalone My Sign page got `background-color: rgba(var(--duoUser), 1)` so they read as a unified olive-bg group across navigation surfaces. For Dashsky specifically, the form column also got the override (`.sky-page .sky-form-col { background: --duoUser }`) — the base `.sky-form-col { background: --priUser }` (`_sky.scss:137`, shared w. the in-room CAST SKY modal) was leaving the dashsky form column purple inside the otherwise-olive page. Scoped to `.sky-page` so the in-room modal's purple form-col stays intact (sits over --secUser room bg, needs that contrast). One detour caught: tried `body.page-sky { background-color: --duoUser }` to fill the gap below .sky-page's content-sized aperture but it bled to navbar + footer (which sit outside .container) — reverted.

**TDD coverage**: 3 new ITs in `apps/gameboard/tests/integrated/test_views.py` — `test_my_sea_applet_renders_drawn_cards_in_draw_order` (SAO 1-of-3 fills `lay` slot, cover/crown render as empty placeholders), `test_my_sea_applet_labels_match_locked_spread` (SAO labels exactly Situation/Action/Outcome), `test_my_sea_applet_waite_smith_labels_post_fix` (regression pin for the WS Cover/Cross/Crown/**Beneath**/Before/**Behind** sequence post-swap-fix). Existing my-sea applet ITs updated to match the new selector vocabulary (`.my-sea-slot--filled` instead of `.my-sea-card`, Brief script substring instead of `.my-sea-sign-gate--applet`). 6 my-sea FTs updated to the Brief-banner contract. 1214/1214 IT/UT green.

**.gitignore**: temporary entry for `src/apps/epic/static/apps/epic/images/cards-faces/minchiate-fiorentine/` until images get renamed — flagged for removal once the rename lands. (Per user's wget download of the Minchiate faces into the gameboard cards/ tree this session.)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-22 15:19:34 -04:00
parent 1452de1a76
commit 53cd7afeb4
16 changed files with 784 additions and 161 deletions

View File

@@ -18,6 +18,86 @@ HAND_SIZE_BY_SPREAD = {
"escape-velocity": 6,
}
# Position order per spread — mirrors `DRAW_ORDER` in my_sea.html JS
# (lines 274-281). The applet renders slots in this order left-to-right
# so drawn cards appear in chronological draw sequence regardless of
# their spread-grid placement.
DRAW_ORDER = {
"past-present-future": ("leave", "cover", "loom"),
"situation-action-outcome": ("lay", "cover", "crown"),
"mind-body-spirit": ("crown", "lay", "loom"),
"desire-obstacle-solution": ("loom", "cross", "crown"),
"waite-smith": ("cover", "cross", "crown", "lay", "loom", "leave"),
"escape-velocity": ("cover", "cross", "lay", "leave", "crown", "loom"),
}
# Per-spread human-readable labels for each position slug. Mirrors
# `POSITION_LABELS` in my_sea.html JS (lines 282-293). Escape Velocity
# remaps the diagonal positions per the user-locked spec 2026-05-19
# (Beneath→Lay, Before→Loom, Behind→Leave) — Crown/Cover/Cross keep
# their Waite-Smith names.
POSITION_LABELS = {
"past-present-future": {"leave": "Past", "cover": "Present", "loom": "Future"},
"situation-action-outcome": {"lay": "Situation", "cover": "Action", "crown": "Outcome"},
"mind-body-spirit": {"crown": "Mind", "lay": "Body", "loom": "Spirit"},
"desire-obstacle-solution": {"loom": "Desire", "cross": "Obstacle","crown": "Solution"},
"waite-smith": {"crown": "Crown", "leave": "Behind", "cover": "Cover",
"cross": "Cross", "loom": "Before", "lay": "Beneath"},
"escape-velocity": {"crown": "Crown", "leave": "Leave", "cover": "Cover",
"cross": "Cross", "loom": "Loom", "lay": "Lay"},
}
def latest_draw_slots(user):
"""Build the slot list for the My Sea applet — pairs each draw-order
position w. its drawn card (if any) + display label + polarity.
Drives `_applet-my-sea.html`: the applet renders ALL positions in
spread DRAW_ORDER, filled slots showing the drawn card, empty slots
rendering as a labelled placeholder w. --duoUser bg + --terUser
dotted border (user spec 2026-05-22). Spread is locked at first
card draw + survives DEL'd-but-not-expired rows... but the applet
only populates while `hand` is non-empty: a DEL'd row reads as
"No draws yet" since the user has explicitly cleared their picks.
Returns:
list[dict] — one entry per spread position in draw order:
{
"position": "lay", # position slug
"label": "Situation", # spread-specific human label
"card": <TarotCard>, # None if not yet drawn
"reversed": bool, # False if not yet drawn
"polarity": "gravity", # "" if not yet drawn
}
Empty list = no active draw OR active draw w. empty hand.
"""
draw = active_draw_for(user)
if draw is None or not draw.hand:
return []
from apps.epic.models import TarotCard
order = DRAW_ORDER.get(draw.spread, ())
labels = POSITION_LABELS.get(draw.spread, {})
by_position = {entry["position"]: entry for entry in draw.hand}
card_ids = {
entry["card_id"] for entry in draw.hand
if entry.get("card_id")
}
cards_by_id = (
{c.id: c for c in TarotCard.objects.filter(id__in=card_ids)}
if card_ids else {}
)
slots = []
for pos in order:
entry = by_position.get(pos)
slots.append({
"position": pos,
"label": labels.get(pos, ""),
"card": cards_by_id.get(entry["card_id"]) if entry else None,
"reversed": entry.get("reversed", False) if entry else False,
"polarity": entry.get("polarity", "") if entry else "",
})
return slots
class MySeaDraw(models.Model):
"""Persisted Celtic-Cross-style tarot draw for the solo-user My Sea

View File

@@ -306,4 +306,20 @@ function initGameKitTooltips() {
});
}
// Mousewheel → horizontal scroll on the My Sea applet (mirrors the
// Palette applet's `bindPaletteWheel` in `apps/dashboard/dashboard.js`).
// Vertical wheel events translate to horizontal scroll so multi-card
// spreads (6-slot Celtic Cross / Escape Velocity) can be panned through
// without touchpad gestures or a horizontal scrollbar drag.
function bindMySeaWheel() {
document.querySelectorAll('.my-sea-scroll').forEach(function (el) {
el.addEventListener('wheel', function (e) {
if (e.deltaY === 0) return;
e.preventDefault();
el.scrollLeft += e.deltaY;
}, { passive: false });
});
}
document.addEventListener('DOMContentLoaded', initGameKitTooltips);
document.addEventListener('DOMContentLoaded', bindMySeaWheel);

View File

@@ -42,23 +42,32 @@ class GameboardViewTest(TestCase):
# flow lands in later sprints. Seeded via migration 0008.
[_] = self.parsed.cssselect("#id_applet_my_sea")
def test_my_sea_applet_renders_sign_gate_for_user_without_sig(self):
# Sprint 4b — user with no significator sees the Look!-formatted
# gate (mirror of the standalone page), not the draw UX.
[_gate] = self.parsed.cssselect(
"#id_applet_my_sea .my-sea-sign-gate--applet"
)
# Draw-state nodes are suppressed while the gate is up.
def test_my_sea_applet_fires_sign_gate_brief_for_user_without_sig(self):
# Sprint 4b (refactored 2026-05-22) — user with no significator
# gets a Look!-formatted Brief banner (`Brief.showBanner` script
# fired in the applet template) AND the applet body falls through
# to the empty-state "No draws yet" (no sig → no draws is the only
# possible state). The Brief itself renders client-side via JS so
# we assert the script content + the FYI url, not the DOM banner.
html = self.parsed.text_content() if False else \
lxml.html.tostring(self.parsed, encoding="unicode")
self.assertIn("Look!", html)
self.assertIn("pick your sign before drawing the Sea", html)
self.assertIn("Brief.showBanner", html)
# FYI url baked into the Brief script's `post_url`
self.assertIn("/billboard/my-sign/", html)
# Old inline gate markup is gone
self.assertEqual(
len(self.parsed.cssselect("#id_applet_my_sea .my-sea-empty")), 0,
len(self.parsed.cssselect(".my-sea-sign-gate")), 0,
)
# Card cells suppressed (no active draw possible without sig)
self.assertEqual(
len(self.parsed.cssselect("#id_applet_my_sea .my-sea-card")), 0,
len(self.parsed.cssselect("#id_applet_my_sea .my-sea-slot--filled")), 0,
)
def test_my_sea_applet_renders_empty_state_for_user_with_sig_no_draws(self):
# Sig set + no saved draws → the scroll container hosts a single
# placeholder line ("No draws yet."), no card cells, no gate.
# placeholder line ("No draws yet."), no card cells, no gate Brief.
from apps.epic.models import personal_sig_cards
sig_pile = personal_sig_cards(self.user)
self.user.significator = sig_pile[0]
@@ -68,16 +77,123 @@ class GameboardViewTest(TestCase):
[empty] = parsed.cssselect("#id_applet_my_sea .my-sea-empty")
self.assertIn("No draws yet", empty.text_content())
self.assertEqual(
len(parsed.cssselect("#id_applet_my_sea .my-sea-card")), 0,
)
self.assertEqual(
len(parsed.cssselect("#id_applet_my_sea .my-sea-sign-gate--applet")),
0,
len(parsed.cssselect("#id_applet_my_sea .my-sea-slot--filled")), 0,
)
# No sign-gate Brief script fires when the user already has a sig
html = lxml.html.tostring(parsed, encoding="unicode")
self.assertNotIn("pick your sign before drawing the Sea", html)
def test_my_sea_applet_header_links_to_my_sea_page(self):
[link] = self.parsed.cssselect("#id_applet_my_sea h2 a")
self.assertEqual(link.get("href"), reverse("my_sea"))
def test_my_sea_applet_renders_drawn_cards_in_draw_order(self):
"""User w. a partial SAO draw — applet renders 3 slots in DRAW_
ORDER (lay, cover, crown → labelled Beneath/Cover/Crown? no —
SAO labels are Situation/Action/Outcome). Drawn slot 1 (`lay`)
carries the card; the un-drawn `cover` + `crown` slots are
empty placeholders w. their per-spread labels."""
from apps.epic.models import personal_sig_cards, TarotCard
from apps.gameboard.models import MySeaDraw
sig_pile = personal_sig_cards(self.user)
self.user.significator = sig_pile[0]
self.user.save()
card = TarotCard.objects.first()
MySeaDraw.objects.create(
user=self.user,
spread="situation-action-outcome",
hand=[
{"position": "lay", "card_id": card.id,
"reversed": False, "polarity": "gravity"},
],
significator_id=self.user.significator_id,
)
response = self.client.get("/gameboard/")
parsed = lxml.html.fromstring(response.content)
# All 3 SAO positions render in DRAW_ORDER (lay, cover, crown).
wraps = parsed.cssselect("#id_applet_my_sea .my-sea-slot-wrap")
self.assertEqual(len(wraps), 3,
"SAO has 3 positions — applet should render 3 slot wraps")
# Position 1 (`lay`) is filled w. the drawn card.
filled = parsed.cssselect("#id_applet_my_sea .my-sea-slot--filled")
self.assertEqual(len(filled), 1)
self.assertEqual(
filled[0].get("data-position"), "lay",
"First drawn card should land in the `lay` slug slot",
)
self.assertEqual(
filled[0].get("data-card-id"), str(card.id),
)
# Positions 2 + 3 (cover, crown) are empty placeholders.
empties = parsed.cssselect("#id_applet_my_sea .my-sea-slot--empty")
self.assertEqual(len(empties), 2)
empty_positions = {e.get("data-position") for e in empties}
self.assertEqual(empty_positions, {"cover", "crown"})
def test_my_sea_applet_labels_match_locked_spread(self):
"""SAO label per spec: lay='Situation', cover='Action',
crown='Outcome'. Empty slots still carry their label so the
user can see which position is yet to draw."""
from apps.epic.models import personal_sig_cards, TarotCard
from apps.gameboard.models import MySeaDraw
sig_pile = personal_sig_cards(self.user)
self.user.significator = sig_pile[0]
self.user.save()
card = TarotCard.objects.first()
MySeaDraw.objects.create(
user=self.user,
spread="situation-action-outcome",
hand=[
{"position": "lay", "card_id": card.id,
"reversed": False, "polarity": "gravity"},
],
significator_id=self.user.significator_id,
)
response = self.client.get("/gameboard/")
parsed = lxml.html.fromstring(response.content)
labels = parsed.cssselect(
"#id_applet_my_sea .my-sea-slot-wrap .my-sea-slot-label"
)
# Labels in DOM order (== DRAW_ORDER): Situation, Action, Outcome
self.assertEqual(
[l.text_content().strip() for l in labels],
["Situation", "Action", "Outcome"],
)
def test_my_sea_applet_waite_smith_labels_post_fix(self):
"""Regression pin for the 2026-05-22 POSITION_LABELS swap fix:
WS `leave` slot (LEFT) is "Behind", `lay` slot (BOTTOM) is
"Beneath" — was inverted prior to the fix. Voronoi mapping
depends on this being right."""
from apps.epic.models import personal_sig_cards, TarotCard
from apps.gameboard.models import MySeaDraw
sig_pile = personal_sig_cards(self.user)
self.user.significator = sig_pile[0]
self.user.save()
card = TarotCard.objects.first()
# Single-card WS draw — populates `cover` (DRAW_ORDER pos 1).
MySeaDraw.objects.create(
user=self.user,
spread="waite-smith",
hand=[
{"position": "cover", "card_id": card.id,
"reversed": False, "polarity": "gravity"},
],
significator_id=self.user.significator_id,
)
response = self.client.get("/gameboard/")
parsed = lxml.html.fromstring(response.content)
wraps = parsed.cssselect("#id_applet_my_sea .my-sea-slot-wrap")
# WS DRAW_ORDER = [cover, cross, crown, lay, loom, leave]
# Labels post-fix: Cover Cross Crown Beneath Before Behind
labels = [
w.cssselect(".my-sea-slot-label")[0].text_content().strip()
for w in wraps
]
self.assertEqual(
labels,
["Cover", "Cross", "Crown", "Beneath", "Before", "Behind"],
)
def test_gameboard_shows_game_kit(self):
[_] = self.parsed.cssselect("#id_game_kit")

View File

@@ -8,7 +8,7 @@ from django.views.decorators.http import require_POST
from apps.applets.utils import applet_context, apply_applet_toggle
from .models import (
HAND_SIZE_BY_SPREAD, MySeaDraw, active_draw_for,
HAND_SIZE_BY_SPREAD, MySeaDraw, active_draw_for, latest_draw_slots,
_select_my_sea_token, debit_my_sea_token,
)
@@ -59,6 +59,7 @@ def gameboard(request):
"applets": applet_context(request.user, "gameboard"),
"page_class": "page-gameboard",
"my_games": annotate_latest_event(rooms_for_user(request.user)),
"my_sea_slots": latest_draw_slots(request.user),
}
)
@@ -82,6 +83,7 @@ def toggle_game_applets(request):
"free_tokens": free_tokens,
"free_count": len(free_tokens),
"my_games": annotate_latest_event(rooms_for_user(request.user)),
"my_sea_slots": latest_draw_slots(request.user),
})
return redirect("gameboard")