SIG SELECT exit: 2s hang after tray closes; suppress waiting msg if PICK SKY already up — TDD

- polarity_room_done handler in sig-select.js wraps Tray.placeSig's callback in setTimeout(_settle, 2000) so the user gets a beat to register the tray closing before the overlay vanishes. Visual order now: stage → tray slides in → sig fades into the tray cell → tray slides out → 2s pause → overlay dismisses → table hex.
- _showWaitingMsg early-exits if #id_pick_sky_btn is already revealed. The cross-polarity case — the OTHER room finishes WHILE this gamer's tray sequence is mid-flight — fires pick_sky_available during the hang, which removes any waiting msg & shows PICK SKY. When _settle fires after the hang, the PICK SKY check skips the now-stale waiting msg.
- 2 SigSelectSpec specs: 2s delay before overlay dismisses; waiting msg suppressed when pick_sky_btn is visible. jasmine.clock() drives the setTimeout in both.

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-03 22:11:07 -04:00
parent 480cb4aed6
commit f78177778f
3 changed files with 76 additions and 15 deletions

View File

@@ -494,6 +494,11 @@ var SigSelect = (function () {
function _showWaitingMsg(pendingPolarity) {
if (document.getElementById('id_hex_waiting_msg')) return;
// If the OTHER polarity finished before our tray sequence completed,
// pick_sky_available will already have fired and revealed PICK SKY.
// In that case skip the waiting msg so the two don't co-exist.
var pickSkyBtn = document.getElementById('id_pick_sky_btn');
if (pickSkyBtn && pickSkyBtn.style.display !== 'none') return;
var msg = document.createElement('p');
msg.id = 'id_hex_waiting_msg';
msg.textContent = pendingPolarity === 'gravity'
@@ -529,16 +534,20 @@ var SigSelect = (function () {
if (!overlay) return;
if (e.detail.polarity !== userPolarity) return;
var pendingPolarity = userPolarity === 'levity' ? 'gravity' : 'levity';
// Tray-place sequence first (visually anchors the sig stage's exit);
// overlay dismissal + waiting msg run on Tray.placeSig's completion
// callback so the user sees: stage card → tray slides in → sig fades
// into the tray cell → tray slides out → table hex w. waiting msg.
// Tray-place sequence first (visually anchors the sig stage's exit),
// then a 2s hang so the user can register the tray closing before
// the overlay vanishes; overlay dismissal + waiting msg run last.
// User sees: stage card → tray slides in → sig fades into the tray
// cell → tray slides out → 2s pause → overlay dismisses → table hex
// w. waiting msg (or PICK SKY btn if both polarities are done).
function _settle() {
_dismissSigOverlay();
_showWaitingMsg(pendingPolarity);
}
if (typeof Tray !== "undefined" && Tray.placeSig) {
Tray.placeSig(stageCard, _settle);
Tray.placeSig(stageCard, function () {
setTimeout(_settle, 2000);
});
} else {
_settle();
}