Keep Fuji branding and fullscreen controls in one compact header
This commit is contained in:
parent
956121fd47
commit
2e529beae8
3 changed files with 306 additions and 41 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { equipmentPopover } from "./lib/equipmentPopover";
|
||||
import ChatPanel from "./lib/ChatPanel.svelte";
|
||||
import { untrack } from "svelte";
|
||||
import { untrack, onMount } from "svelte";
|
||||
import {
|
||||
DICE,
|
||||
terrain,
|
||||
|
|
@ -42,6 +42,7 @@
|
|||
import TravelGuide from "./lib/TravelGuide.svelte";
|
||||
import StaminaGuide from "./lib/StaminaGuide.svelte";
|
||||
import VictoryPetals from "./lib/VictoryPetals.svelte";
|
||||
import UtilityIcon from "./lib/UtilityIcon.svelte";
|
||||
let { store }: { store: Store } = $props();
|
||||
const s = $derived(store.scene ?? store.state);
|
||||
const actingSeats = $derived(
|
||||
|
|
@ -69,6 +70,24 @@
|
|||
let help = $state(false);
|
||||
let journal = $state(true);
|
||||
let socialTab = $state("chat");
|
||||
let fullscreen = $state(false);
|
||||
onMount(() => {
|
||||
const update = () => {
|
||||
fullscreen = !!document.fullscreenElement;
|
||||
};
|
||||
update();
|
||||
document.addEventListener("fullscreenchange", update);
|
||||
return () => document.removeEventListener("fullscreenchange", update);
|
||||
});
|
||||
async function toggleFullscreen() {
|
||||
try {
|
||||
if (document.fullscreenElement) await document.exitFullscreen();
|
||||
else if (document.documentElement.requestFullscreen) await document.documentElement.requestFullscreen();
|
||||
else throw new Error("Fullscreen is not available in this browser.");
|
||||
} catch (error) {
|
||||
store.error = error instanceof Error ? error.message : "Fullscreen could not be opened.";
|
||||
}
|
||||
}
|
||||
$effect(() => {
|
||||
store.chat.setPlayer(seat);
|
||||
});
|
||||
|
|
@ -428,11 +447,36 @@
|
|||
{#if s}
|
||||
<VictoryPetals won={s.outcome === "won"} animating={store.animating} />
|
||||
<main class="expedition">
|
||||
<div class="game-tools">
|
||||
<header class="game-tools">
|
||||
<div class="game-brand" title="Fuji · Wolfgang Warsch · Feuerland Spiele">
|
||||
<svg class="fuji-mark" viewBox="0 0 44 36" fill="none" aria-hidden="true"
|
||||
><circle cx="33" cy="8" r="5" fill="currentColor" opacity=".45" /><path
|
||||
d="m3 32 17-27 21 27H3Z"
|
||||
fill="currentColor"
|
||||
opacity=".16"
|
||||
/><path
|
||||
d="m3 32 17-27 21 27M13 16l6 3 5-3 5 2"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/></svg
|
||||
>
|
||||
<div>
|
||||
<h1>Fuji<span>.</span></h1>
|
||||
<p>
|
||||
<span class="designer-credit">Wolfgang Warsch ·{" "}</span>Feuerland<span class="publisher-suffix"
|
||||
>{" "}Spiele</span
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="round-status">
|
||||
<span class="live-dot"></span><span
|
||||
>{s.phase === "setup" ? "THE EXPEDITION" : `ROUND ${String(s.round).padStart(2, "0")}`}</span
|
||||
><span class="separator">/</span><span
|
||||
<span class="round-label" title={s.phase === "setup" ? "Preparation" : `Round ${s.round}`}
|
||||
><span class="status-full">{s.phase === "setup" ? "Preparation" : `Round ${s.round}`}</span><span
|
||||
class="status-short">{s.phase === "setup" ? "Setup" : `R${s.round}`}</span
|
||||
></span
|
||||
><span class="phase-status"
|
||||
>{s.outcome
|
||||
? "Journey complete"
|
||||
: s.phase === "reroll"
|
||||
|
|
@ -441,46 +485,71 @@
|
|||
? "Preparation"
|
||||
: s.phase}</span
|
||||
>
|
||||
<span class="difficulty-label">Scenario {s.scenario ?? 1}</span>
|
||||
<span class="difficulty-label" title={`Scenario ${s.scenario ?? 1}`}
|
||||
><span class="status-full">Scenario{" "}</span><span class="status-short">S</span>{s.scenario ?? 1}</span
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="difficulty-label"
|
||||
use:equipmentPopover
|
||||
aria-label={`Difficulty level ${s.difficulty}: stamina costs`}>Level {s.difficulty}</button
|
||||
aria-label={`Difficulty level ${s.difficulty}: stamina costs`}
|
||||
><span class="status-full">Level{" "}</span><span class="status-short">L</span>{s.difficulty}</button
|
||||
>
|
||||
<span class="equipment-preview difficulty-preview" popover="auto">
|
||||
<strong>Difficulty level {s.difficulty} of 4</strong>
|
||||
<StaminaGuide difficulty={s.difficulty} expanded />
|
||||
</span>
|
||||
</div>
|
||||
{#if store.chatState.enabled}<button class="text-button" onclick={openChat}
|
||||
>Chat{store.chatState.unreadIds.length ? ` · ${store.chatState.unreadIds.length}` : ""}</button
|
||||
>{/if}
|
||||
<button class="text-button" onclick={() => (help = true)} aria-label="Open playing guide">Help</button>
|
||||
<button
|
||||
class="text-button"
|
||||
onclick={() => {
|
||||
journal = true;
|
||||
socialTab = "journal";
|
||||
requestAnimationFrame(() =>
|
||||
document
|
||||
.querySelector(
|
||||
window.innerWidth <= 850 && store.chatState.enabled
|
||||
? ".mobile-journal .inline-journal"
|
||||
: ".inline-journal"
|
||||
)
|
||||
?.scrollIntoView({ behavior: "smooth", block: "nearest" })
|
||||
);
|
||||
}}>Journal</button
|
||||
>
|
||||
<button
|
||||
class="text-button playback-skip"
|
||||
class:idle={!store.animating}
|
||||
disabled={!store.animating}
|
||||
aria-label="Skip to latest"
|
||||
title="Skip to latest"
|
||||
onclick={() => store.skipPresentation()}>»</button
|
||||
>
|
||||
<nav class="game-utilities" aria-label="Game options">
|
||||
{#if store.chatState.enabled}<button
|
||||
class="utility-button"
|
||||
onclick={openChat}
|
||||
title="Chat"
|
||||
aria-label={store.chatState.unreadIds.length ? `Chat · ${store.chatState.unreadIds.length} unread` : "Chat"}
|
||||
><UtilityIcon name="chat" />{#if store.chatState.unreadIds.length}<span class="utility-count"
|
||||
>{store.chatState.unreadIds.length}</span
|
||||
>{/if}</button
|
||||
>{/if}
|
||||
<button
|
||||
class="utility-button"
|
||||
title="Journal"
|
||||
aria-label="Journal"
|
||||
onclick={() => {
|
||||
journal = true;
|
||||
socialTab = "journal";
|
||||
requestAnimationFrame(() =>
|
||||
document
|
||||
.querySelector(
|
||||
window.innerWidth <= 850 && store.chatState.enabled
|
||||
? ".mobile-journal .inline-journal"
|
||||
: ".inline-journal"
|
||||
)
|
||||
?.scrollIntoView({ behavior: "smooth", block: "nearest" })
|
||||
);
|
||||
}}><UtilityIcon name="journal" /></button
|
||||
>
|
||||
<button
|
||||
class="utility-button"
|
||||
onclick={() => (help = true)}
|
||||
title="Playing guide"
|
||||
aria-label="Open playing guide"><UtilityIcon name="help" /></button
|
||||
>
|
||||
<button
|
||||
class="utility-button"
|
||||
onclick={toggleFullscreen}
|
||||
title={fullscreen ? "Exit fullscreen" : "Fullscreen"}
|
||||
aria-label={fullscreen ? "Exit fullscreen" : "Fullscreen"}
|
||||
aria-pressed={fullscreen}><UtilityIcon name={fullscreen ? "exit-fullscreen" : "fullscreen"} /></button
|
||||
>
|
||||
<button
|
||||
class="text-button playback-skip"
|
||||
class:idle={!store.animating}
|
||||
disabled={!store.animating}
|
||||
aria-label="Skip to latest"
|
||||
title="Skip to latest"
|
||||
onclick={() => store.skipPresentation()}>»</button
|
||||
>
|
||||
</nav>
|
||||
{#if store.local}<details class="playtest-menu">
|
||||
<summary>Playtest tools</summary>
|
||||
<div class="dev-toolbar">
|
||||
|
|
@ -543,7 +612,7 @@
|
|||
>
|
||||
</div>
|
||||
</details>{/if}
|
||||
</div>
|
||||
</header>
|
||||
{#if me && !s.outcome}<div class="mobile-dock">
|
||||
<div>
|
||||
<span class="eyebrow">{s.phase}</span><strong
|
||||
|
|
|
|||
27
packages/viewer/src/lib/UtilityIcon.svelte
Normal file
27
packages/viewer/src/lib/UtilityIcon.svelte
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<script lang="ts">
|
||||
let { name }: { name: "chat" | "help" | "journal" | "fullscreen" | "exit-fullscreen" } = $props();
|
||||
</script>
|
||||
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.6"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{#if name === "chat"}
|
||||
<path d="M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 3V6a2 2 0 0 1 2-2Z" />
|
||||
<path d="M7 9h10M7 13h6" />
|
||||
{:else if name === "help"}
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<path d="M9.5 9a2.5 2.5 0 0 1 5 0c0 2-2.5 2-2.5 4m0 3v.1" />
|
||||
{:else if name === "journal"}
|
||||
<path d="M5 3h14v18H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2ZM7 3v18m4-13h5m-5 4h5m-5 4h3" />
|
||||
{:else if name === "exit-fullscreen"}
|
||||
<path d="M3 8h5V3m8 0v5h5M3 16h5v5m8 0v-5h5" />
|
||||
{:else}
|
||||
<path d="M8 3H3v5m13-5h5v5M3 16v5h5m13-5v5h-5" />
|
||||
{/if}
|
||||
</svg>
|
||||
|
|
@ -954,10 +954,6 @@ h3 {
|
|||
.expedition {
|
||||
padding: 17px 14px 0;
|
||||
}
|
||||
.round-status .separator,
|
||||
.round-status > span:last-child {
|
||||
display: none;
|
||||
}
|
||||
.team {
|
||||
padding: 17px 0;
|
||||
gap: 8px;
|
||||
|
|
@ -1119,7 +1115,7 @@ h3 {
|
|||
}
|
||||
}
|
||||
|
||||
/* The viewer fills its iframe; branding and supporting content live in dialogs. */
|
||||
/* The viewer fills its iframe. */
|
||||
.expedition {
|
||||
max-width: none;
|
||||
min-height: 100dvh;
|
||||
|
|
@ -1822,6 +1818,10 @@ button.difficulty-label:focus-visible {
|
|||
.difficulty-preview {
|
||||
text-transform: none;
|
||||
letter-spacing: normal;
|
||||
white-space: normal;
|
||||
}
|
||||
.difficulty-preview:popover-open {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.revise-choice {
|
||||
|
|
@ -1850,3 +1850,172 @@ button.difficulty-label:focus-visible {
|
|||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.game-tools {
|
||||
min-height: 62px;
|
||||
gap: 24px;
|
||||
flex-wrap: nowrap;
|
||||
border-bottom: 1px solid #9bbaa52b;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.game-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex: none;
|
||||
}
|
||||
.fuji-mark {
|
||||
width: 43px;
|
||||
height: 38px;
|
||||
color: var(--gold);
|
||||
}
|
||||
.game-brand h1 {
|
||||
font:
|
||||
32px/1 Georgia,
|
||||
"Times New Roman",
|
||||
serif;
|
||||
letter-spacing: -1px;
|
||||
color: #f4efd9;
|
||||
}
|
||||
.game-brand h1 > span {
|
||||
color: var(--gold);
|
||||
}
|
||||
.game-brand p {
|
||||
font-size: 9px;
|
||||
line-height: 1.5;
|
||||
color: var(--muted);
|
||||
letter-spacing: 0.25px;
|
||||
white-space: nowrap;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.game-tools .round-status {
|
||||
margin: 0 0 0 auto;
|
||||
flex-wrap: nowrap;
|
||||
white-space: nowrap;
|
||||
gap: 9px;
|
||||
font-size: 10px;
|
||||
}
|
||||
.phase-status {
|
||||
text-transform: capitalize;
|
||||
color: var(--muted);
|
||||
}
|
||||
.game-tools .status-short {
|
||||
display: none;
|
||||
}
|
||||
.game-utilities {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex: none;
|
||||
}
|
||||
.utility-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border: 1px solid #a0b39b28;
|
||||
border-radius: 50%;
|
||||
background: #c7ddc508;
|
||||
color: #c9d3b7;
|
||||
position: relative;
|
||||
}
|
||||
.utility-button:hover {
|
||||
color: #fff1bd;
|
||||
background: #c7ddc51a;
|
||||
border-color: #a0b39b65;
|
||||
}
|
||||
.utility-button svg {
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
}
|
||||
.utility-count {
|
||||
position: absolute;
|
||||
right: -5px;
|
||||
top: -5px;
|
||||
min-width: 17px;
|
||||
border-radius: 20px;
|
||||
background: var(--gold);
|
||||
color: var(--ink);
|
||||
padding: 1px 4px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.game-tools .playback-skip.idle {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.game-tools {
|
||||
gap: 16px;
|
||||
}
|
||||
.game-tools .phase-status {
|
||||
display: none;
|
||||
}
|
||||
.game-tools .playtest-menu summary {
|
||||
font-size: 0;
|
||||
width: 22px;
|
||||
text-align: center;
|
||||
list-style: none;
|
||||
}
|
||||
.game-tools .playtest-menu summary::after {
|
||||
content: "⋯";
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 650px) {
|
||||
.game-tools {
|
||||
min-height: 54px;
|
||||
gap: 10px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
.game-brand {
|
||||
gap: 6px;
|
||||
}
|
||||
.game-brand .fuji-mark,
|
||||
.game-brand .designer-credit,
|
||||
.game-brand .publisher-suffix {
|
||||
display: none;
|
||||
}
|
||||
.game-brand h1 {
|
||||
font-size: 27px;
|
||||
}
|
||||
.game-brand p {
|
||||
font-size: 8px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.game-tools .round-status {
|
||||
gap: 6px;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
.game-tools .status-full {
|
||||
display: none;
|
||||
}
|
||||
.game-tools .status-short {
|
||||
display: inline;
|
||||
}
|
||||
.game-tools .difficulty-label {
|
||||
padding-left: 6px;
|
||||
}
|
||||
.game-utilities {
|
||||
gap: 4px;
|
||||
}
|
||||
.utility-button {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 360px) {
|
||||
.game-tools {
|
||||
gap: 6px;
|
||||
}
|
||||
.game-tools .round-status {
|
||||
gap: 3px;
|
||||
}
|
||||
.game-tools .difficulty-label {
|
||||
padding-left: 3px;
|
||||
}
|
||||
.game-utilities {
|
||||
gap: 2px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue