fix(viewer): keep desktop chat beside the players
This commit is contained in:
parent
f4ee221289
commit
b766f3b7a6
4 changed files with 8 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@gaia-project/old-ui",
|
||||
"version": "1.2.19",
|
||||
"version": "1.2.20",
|
||||
"scripts": {
|
||||
"serve": "vite --port 5193",
|
||||
"build": "vite build",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@gaia-project/viewer",
|
||||
"version": "5.22.18",
|
||||
"version": "5.22.19",
|
||||
"description": "Functions to visualize the map and boards for gaia project inside html canvas",
|
||||
"contributors": [
|
||||
"coyotte508",
|
||||
|
|
|
|||
|
|
@ -129,6 +129,8 @@ describe("game chat icon", () => {
|
|||
|
||||
it("moves one icon between action controls, spectator turn order and the remaining game controls", async () => {
|
||||
const desktop = host.querySelector(".game-chat-button-host--desktop")!;
|
||||
const turnOrder = host.querySelector(".turn-order")!;
|
||||
expect(turnOrder.contains(button)).toBe(true);
|
||||
const mobile = document.createElement("div");
|
||||
mobile.className = "mobile-sticky-actions mobile-sticky-actions--collapsed";
|
||||
mobile.innerHTML = '<span class="game-chat-button-host--mobile"></span>';
|
||||
|
|
@ -138,7 +140,7 @@ describe("game chat icon", () => {
|
|||
expect(mobile.contains(button)).toBe(true);
|
||||
vi.stubGlobal("innerWidth", 1280);
|
||||
window.dispatchEvent(new Event("resize"));
|
||||
expect(desktop.contains(button)).toBe(true);
|
||||
expect(turnOrder.contains(button)).toBe(true);
|
||||
vi.stubGlobal("innerWidth", 390);
|
||||
window.dispatchEvent(new Event("resize"));
|
||||
mobile.remove();
|
||||
|
|
@ -146,7 +148,6 @@ describe("game chat icon", () => {
|
|||
expect(desktop.contains(button)).toBe(true);
|
||||
desktop.remove();
|
||||
await Promise.resolve();
|
||||
const turnOrder = host.querySelector(".turn-order")!;
|
||||
expect(turnOrder.contains(button)).toBe(true);
|
||||
button.click();
|
||||
turnOrder.remove();
|
||||
|
|
|
|||
|
|
@ -176,10 +176,11 @@ export function mountGameChat(emitter: ViewerEmitter<any, any>, host: Element):
|
|||
const sourceLabel = count ? `Chat · ${count} unread` : "Chat";
|
||||
const mobileSlot =
|
||||
window.innerWidth < 768 ? host.querySelector(".mobile-sticky-actions .game-chat-button-host--mobile") : null;
|
||||
const actions = host.querySelector(".game-chat-button-host--desktop");
|
||||
const turnOrder = host.querySelector(".game-chat-button-host--turn-order");
|
||||
const destination =
|
||||
mobileSlot ||
|
||||
host.querySelector(".game-chat-button-host--desktop") ||
|
||||
host.querySelector(".game-chat-button-host--turn-order") ||
|
||||
(window.innerWidth < 768 ? actions || turnOrder : turnOrder || actions) ||
|
||||
host.querySelector(".game-chat-button-host--fallback");
|
||||
if (destination && button.parentElement !== destination) destination.append(button);
|
||||
button.hidden = analysis || !chat.snapshot.enabled;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue