mirror of
https://github.com/tiennm99/noitu.git
synced 2026-10-13 18:16:06 +00:00
fix(web): open the lobby chat on a phone and fold it when the game starts
Making the lobby panel collapsible left it folded from the start, with the input hidden behind a badge before anyone had spoken, which the browser suite caught. It now opens in the lobby and folds itself on the first turn, which is the shape the suite and the prior UX report describe.
This commit is contained in:
1 parent
1358c3d136
commit
5178a97520
1 file changed
+12
-4
@@ -96,11 +96,19 @@
|
|||||||
// Lifted out of ChatPanel so the pill in GameBoard's top row — reachable
|
// Lifted out of ChatPanel so the pill in GameBoard's top row — reachable
|
||||||
// above the chain rather than below it — can unfold the panel and read its
|
// above the chain rather than below it — can unfold the panel and read its
|
||||||
// count without the two components knowing about each other beyond this.
|
// count without the two components knowing about each other beyond this.
|
||||||
let chatFolded = $state(true);
|
// Open in the lobby, where talking is what people are there to do, and
|
||||||
|
// folded the moment a game starts, so the board is not pushed off a phone
|
||||||
|
// screen by the conversation under it. A lobby that starts folded would
|
||||||
|
// hide the input behind a badge before anyone has said anything.
|
||||||
|
let chatFolded = $state(false);
|
||||||
let chatUnread = $state(0);
|
let chatUnread = $state(0);
|
||||||
/** @type {HTMLElement | undefined} */
|
/** @type {HTMLElement | undefined} */
|
||||||
let talkPane = $state();
|
let talkPane = $state();
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (game.state.phase === 'playing') chatFolded = true;
|
||||||
|
});
|
||||||
|
|
||||||
function openChat() {
|
function openChat() {
|
||||||
chatFolded = false;
|
chatFolded = false;
|
||||||
talkPane?.scrollIntoView({ behavior: scrollBehavior(), block: 'start' });
|
talkPane?.scrollIntoView({ behavior: scrollBehavior(), block: 'start' });
|
||||||
@@ -442,9 +450,9 @@
|
|||||||
<!-- errors are not routed here any more: the lobby draws its own, beside
|
<!-- errors are not routed here any more: the lobby draws its own, beside
|
||||||
the button that produced them.
|
the button that produced them.
|
||||||
|
|
||||||
Folded on any narrow screen now, lobby included: a lobby that never
|
Collapsible on any narrow screen, lobby included, so chat arriving
|
||||||
folded never had a badge either, so chat arriving there was
|
in a lobby whose panel the player folded still shows a count; it
|
||||||
completely silent behind a log that was itself below the fold. -->
|
starts open there and folds itself when a game begins. -->
|
||||||
<div class="pane talk" bind:this={talkPane}>
|
<div class="pane talk" bind:this={talkPane}>
|
||||||
<ChatPanel
|
<ChatPanel
|
||||||
collapsible={!wide}
|
collapsible={!wide}
|
||||||
|
|||||||
Reference in new issue
Block a user