Django Channels role-select sprint: turn_changed, roles_revealed, role_select_start consumer handlers; WS URL changed from room_slug to room_id UUID; TableSeat model - room, gamer, slot_number, role, role_revealed, seat_position fields; Room.table_status field with ROLE_SELECT, SIG_SELECT, IN_GAME choices; migration 0006_table_status_and_table_seat; pick_roles and select_role views; _role_select_context helper; _notify_turn_changed, _notify_roles_revealed, _notify_role_select_start notifiers; all gate-mutation views now call _notify_gate_update; ChannelsFunctionalTest base class with serve_static, screenshot, dump helpers; SQLite TEST NAME set to file path for ChannelsLiveServerTestCase; InMemoryChannelLayer added to test CHANNEL_LAYERS settings; FT 5 and FT 6 now passing - active seat arc and turn advance via WS, no page refresh; room.js, gatekeeper.js, role-select.js added to apps/epic/static; applets.js, game-kit.js, dashboard.js, wallet.js relocated to app-scoped static dirs; room.html: hex table, table-seat arcs, card-stack, inventory panel, role-card hand, WS scripts; _room.scss: room-shell flex layout, .table-hex polygon clip-path, .table-seat and .seat-card-arc, .card-stack eligible/ineligible states, .card flip animation, .inv-role-card stacked hand, .role-select-backdrop; gear btn and room menu always position: fixed; 375 tests, 0 skipped

This commit is contained in:
Disco DeDisco
2026-03-17 00:24:23 -04:00
parent c9defa5a81
commit 01de6e7548
32 changed files with 2148 additions and 63 deletions

View File

@@ -85,7 +85,8 @@
// Page-level gear buttons — fixed to viewport bottom-right
.gameboard-page,
.dashboard-page,
.wallet-page {
.wallet-page,
.room-page {
> .gear-btn {
position: fixed;
bottom: 4.2rem;

View File

@@ -217,6 +217,7 @@ body {
@media (orientation: portrait) and (max-width: 500px) {
body .container {
.navbar {
padding: 0 0 0.25rem 0;
.navbar-brand h1 {
font-size: 1.2rem;
}
@@ -233,7 +234,7 @@ body {
text-align: center;
text-align-last: center;
letter-spacing: 0.33em;
margin: 0 0 0.5rem;
margin: 0;
font-size: 2rem;
&#id_dash_wallet {
@@ -265,7 +266,7 @@ body {
#id_footer {
flex-shrink: 0;
height: 5rem;
height: 6rem;
display: flex;
flex-direction: column;
gap: 0.5rem;

View File

@@ -10,15 +10,12 @@ $gate-line: 2px;
min-height: 60vh;
}
.room-page .gear-btn {
z-index: 101;
}
#id_room_menu {
position: absolute;
bottom: 3.5rem;
position: fixed;
bottom: 6.6rem;
right: 0.5rem;
z-index: 101;
z-index: 202;
background-color: rgba(var(--priUser), 0.95);
border: 0.15rem solid rgba(var(--secUser), 1);
box-shadow:
@@ -41,26 +38,6 @@ html:has(.gate-overlay) {
overflow: hidden;
}
body:has(.gate-overlay) {
// Pin gear controls to the visual viewport,
// bypassing iOS 100vh chrome-inclusion bug.
// Offset upward so gear btn clears the kit btn below it.
.room-page .gear-btn {
position: fixed;
bottom: 4.2rem;
right: 0.5rem;
z-index: 202;
}
#id_room_menu {
position: fixed;
bottom: 6.6rem;
right: 0.5rem;
z-index: 202;
}
}
.gate-overlay {
position: fixed;
inset: 0;
@@ -347,6 +324,309 @@ body:has(.gate-overlay) {
}
}
// ─── Room shell layout ─────────────────────────────────────────────────────
.room-shell {
display: flex;
flex-direction: row;
align-items: stretch;
gap: 2rem;
width: 100%;
max-height: 80vh;
}
// ─── Table hex + seat positions ────────────────────────────────────────────
//
// .table-hex: regular pointy-top hexagon.
// clip-path polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)
// on a 160×185 container gives equal-length sides (height = width × 2/√3).
//
// Seats use absolute positioning from the .room-table centre.
// $seat-r = 130px — radius to seat centroid
// $seat-r-x = round(130px × sin60°) = 113px — horizontal component
// $seat-r-y = round(130px × cos60°) = 65px — vertical component
//
// Clockwise from top: slots 1→2→3→4→5→6.
$seat-r: 130px;
$seat-r-x: round($seat-r * 0.866); // 113px
$seat-r-y: round($seat-r * 0.5); // 65px
.room-table {
flex: 2;
position: relative;
display: flex;
align-items: center;
justify-content: center;
min-height: 300px;
}
.table-hex {
width: 160px;
height: 185px;
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
background: rgba(var(--priUser), 0.8);
// box-shadow is clipped by clip-path; use filter instead
filter: drop-shadow(0 0 8px rgba(var(--terUser), 0.25));
display: flex;
align-items: center;
justify-content: center;
}
.table-center {
display: flex;
align-items: center;
justify-content: center;
}
.room-inventory {
flex: 1;
display: flex;
flex-direction: column;
gap: 1rem;
min-height: 0;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: rgba(var(--terUser), 0.3) transparent;
}
.table-seat {
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
// Centre the element on its anchor point
transform: translate(-50%, -50%);
// Clockwise from top — slot drop order during ROLE_SELECT
&[data-slot="1"] { left: 50%; top: calc(50% - #{$seat-r}); }
&[data-slot="2"] { left: calc(50% + #{$seat-r-x}); top: calc(50% - #{$seat-r-y}); }
&[data-slot="3"] { left: calc(50% + #{$seat-r-x}); top: calc(50% + #{$seat-r-y}); }
&[data-slot="4"] { left: 50%; top: calc(50% + #{$seat-r}); }
&[data-slot="5"] { left: calc(50% - #{$seat-r-x}); top: calc(50% + #{$seat-r-y}); }
&[data-slot="6"] { left: calc(50% - #{$seat-r-x}); top: calc(50% - #{$seat-r-y}); }
.seat-portrait {
width: 36px;
height: 36px;
border-radius: 50%;
border: 2px solid rgba(var(--terUser), 1);
display: flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
opacity: 0.6;
}
.seat-label {
font-size: 0.65rem;
opacity: 0.5;
max-width: 80px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
// Arc of mini cards — visible only on the currently active seat
.seat-card-arc {
display: none;
position: absolute;
width: 18px;
height: 26px;
border-radius: 2px;
border: 1px solid rgba(var(--terUser), 0.7);
background: rgba(var(--quaUser), 0.9);
// Three fanned cards stacked behind the portrait
&::before,
&::after {
content: "";
position: absolute;
inset: 0;
border-radius: inherit;
border: inherit;
background: inherit;
}
&::before { transform: rotate(-18deg) translate(-4px, 2px); }
&::after { transform: rotate( 18deg) translate( 4px, 2px); }
}
&.active .seat-portrait {
opacity: 1;
border-color: rgba(var(--secUser), 1);
box-shadow: 0 0 0.5rem rgba(var(--ninUser), 0.5);
}
&.active .seat-card-arc {
display: block;
transform: translateY(-28px); // float above the portrait
}
}
// ─── Card stack ────────────────────────────────────────────────────────────
.card-stack {
width: 60px;
height: 90px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 6px;
border: 1px solid rgba(var(--secUser), 1);
background: rgba(var(--terUser), 1);
cursor: default;
transition: box-shadow 0.2s ease;
&[data-state="eligible"] {
cursor: pointer;
border-color: rgba(var(--terUser), 1);
box-shadow:
0 0 0.6rem rgba(var(--ninUser), 0.6),
0 0 1.6rem rgba(var(--secUser), 0.25);
}
&[data-state="ineligible"] {
opacity: 0.4;
cursor: not-allowed;
}
}
// ─── Role select modal ─────────────────────────────────────────────────────
.role-select-backdrop {
position: fixed;
inset: 0;
z-index: 100;
display: flex;
justify-content: center;
align-items: center;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(4px);
cursor: pointer;
}
#id_role_select {
display: flex;
gap: 1rem;
pointer-events: none;
@media (max-width: 600px) {
display: grid;
grid-template-columns: repeat(3, 80px);
grid-template-rows: repeat(2, 120px);
gap: 0.75rem;
}
}
// ─── Card component ────────────────────────────────────────────────────────
$card-w: 80px;
$card-h: 120px;
.card {
width: $card-w;
height: $card-h;
border-radius: 6px;
cursor: pointer;
pointer-events: auto;
position: relative;
perspective: 600px;
.card-back,
.card-front {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: inherit;
border: 2px solid rgba(var(--terUser), 1);
background: rgba(var(--quiUser), 1);
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
transition: transform 0.35s ease;
}
.card-back {
transform: rotateY(0deg);
font-size: 1.5rem;
color: rgba(var(--quaUser), 1);
background: rgba(var(--quiUser), 1);
border: 1px solid rgba(var(--terUser), 1);
}
.card-front {
transform: rotateY(180deg);
padding: 0.5rem;
text-align: center;
.card-role-name {
font-size: 0.75rem;
color: rgba(var(--quaUser), 1);
text-transform: uppercase;
letter-spacing: 0.05em;
}
}
&.flipped,
&.face-up {
.card-back { transform: rotateY(-180deg); }
.card-front { transform: rotateY(0deg); }
}
}
// ─── Inventory role card hand ───────────────────────────────────────────────
//
// Cards are stacked vertically: only a $strip-height peek of each card below
// the first is visible by default, showing the role name at the top of the
// card face. Hovering any card slides it right to pop it clear of the stack.
$inv-card-w: 100px;
$inv-card-h: 150px;
$inv-strip: 30px; // visible height of each stacked card after the first
#id_inv_role_card {
display: flex;
flex-direction: column;
.card {
width: $inv-card-w;
height: $inv-card-h;
position: relative;
z-index: 1;
flex-shrink: 0;
transition: transform 0.2s ease;
// Every card after the first overlaps the one above it
& + .card {
margin-top: -($inv-card-h - $inv-strip);
}
// Role name pinned to the top of the face so it reads in the strip
.card-front {
justify-content: flex-start;
padding-top: 0.4rem;
}
// Pop the hovered card to the right, above siblings
&:hover {
transform: translateX(1.5rem);
z-index: 10;
}
}
}
// ─── Partner indicator ─────────────────────────────────────────────────────
.partner-indicator {
margin-top: 0.5rem;
font-size: 0.75rem;
opacity: 0.6;
text-align: center;
}
// Landscape mobile — aggressively scale down to fit short viewport
@media (orientation: landscape) and (max-width: 1023px) {
.room-page .gear-btn {

View File

@@ -175,9 +175,9 @@
/* Earthman Palette */
// bark
--priBrk: 182, 103, 98;
--secBrk: 132, 78, 68;
--terBrk: 82, 53, 38;
--priBrk: 162, 103, 98;
--secBrk: 117, 78, 68;
--terBrk: 72, 53, 38;
// khaki
--priKhk: 195, 176, 145;
--secKhk: 145, 126, 95;
@@ -396,21 +396,21 @@
/* Monochrome Light Palette */
.palette-monochrome-light {
--priUser: var(--sixAdm); /* 240,240,240 — light gray bg */
--secUser: var(--terNi); /* 100,100,100 — mid-dark text/border */
--secUser: var(--terPer); /* 100,100,100 — mid-dark text/border */
--terUser: var(--priPer); /* 60,60,60 — dark accent */
--quaUser: var(--priAg); /* 30,30,30 — near-black active */
--quiUser: var(--sixAdm); /* 133,133,133 — mid-gray action */
--quiUser: var(--priMst); /* 133,133,133 — mid-gray action */
--sixUser: var(--quiAg); /* 175,175,175 — subtle */
--sepUser: var(--sixAg); /* 240,240,240 — secondary subtle */
--octUser: var(--terNi); /* 93,95,94 — links */
--ninUser: var(--terPer); /* 255,251,246 — warm bright highlight */
--octUser: var(--priNi); /* 93,95,94 — links */
--ninUser: var(--terNi); /* 255,251,246 — warm bright highlight */
--decUser: var(--terPt); /* 189,190,189 — light mid */
}
/* Sepia Palette */
.palette-sepia {
--priUser: var(--priCu); /* 46,24,5 — very dark warm brown bg */
--secUser: var(--quiCu); /* 207,173,143 — warm beige text/border */
--terUser: var(--quiAu); /* 214,186,84 — amber gold accent */
--terUser: var(--priBpk); /* 214,186,84 — amber gold accent */
--quaUser: var(--quaAg); /* 195,176,145 — warm tan interactive */
--quiUser: var(--quaSwp); /* 95,76,45 — deep khaki */
--sixUser: var(--quaCu); /* 171,112,60 — copper mid */