Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions assets/theme-v2/css/status.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,119 @@
line-height: var(--line-height-copy)
}

.toolbox-status-bar {
width: 100%;
border-block: var(--border-standard);
background: var(--panel-overlay-strong);
color: var(--text)
}

.toolbox-status-bar__inner {
width: var(--container-width);
margin: var(--space-0) auto;
padding: var(--space-10) var(--space-0);
display: grid;
grid-template-columns: minmax(var(--space-0), 1fr) minmax(var(--space-0), 2fr);
gap: var(--space-16);
align-items: center
}

.toolbox-status-bar__game {
min-width: var(--space-0);
display: flex;
align-items: center;
flex-wrap: wrap;
gap: var(--space-14);
text-align: left
}

.toolbox-status-bar__field {
min-width: var(--space-0);
display: grid;
gap: var(--space-3)
}

.toolbox-status-bar__label {
color: var(--muted);
font-size: var(--font-size-xs);
font-weight: var(--font-weight-heavy);
letter-spacing: var(--letter-spacing-kicker);
text-transform: uppercase
}

.toolbox-status-bar__game-name {
color: var(--text);
font-size: var(--font-size-base);
overflow-wrap: anywhere
}

.toolbox-status-bar__purpose {
color: var(--muted);
font-size: var(--font-size-sm);
overflow-wrap: anywhere
}

.toolbox-status-bar__center {
min-width: var(--space-0);
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
gap: var(--space-10);
text-align: center
}

.toolbox-status-bar__context-type {
flex: 0 0 auto
}

.toolbox-status-bar__message {
margin: var(--space-0);
max-width: var(--measure-lg);
overflow-wrap: anywhere
}

.toolbox-status-bar__action {
flex: 0 0 auto
}

.toolbox-status-bar[data-selected-game-state="active"] {
border-color: color-mix(in srgb, var(--green) 52%, var(--line))
}

.toolbox-status-bar[data-selected-game-state="missing"] {
border-color: var(--gold-border-muted)
}

.toolbox-status-bar[data-selected-game-state="error"] {
border-color: color-mix(in srgb, var(--red) 52%, var(--line))
}

.toolbox-status-bar[data-toolbox-status-context-kind="error"] .toolbox-status-bar__context-type {
border-color: color-mix(in srgb, var(--red) 62%, var(--line));
color: var(--red)
}

.toolbox-status-bar[data-toolbox-status-context-kind="warning"] .toolbox-status-bar__context-type,
.toolbox-status-bar[data-toolbox-status-context-kind="validation"] .toolbox-status-bar__context-type {
border-color: var(--gold-border-muted);
color: var(--gold)
}

.toolbox-status-bar[data-toolbox-status-context-kind="save"] .toolbox-status-bar__context-type {
border-color: color-mix(in srgb, var(--green) 62%, var(--line));
color: var(--green)
}

body.tool-focus-mode .toolbox-status-bar {
position: fixed;
inset-block-end: var(--space-0);
inset-inline: var(--space-0);
z-index: var(--z-index-lg);
border-block-end: var(--space-0);
box-shadow: var(--shadow-md)
}

.platform-banner {
width: 100%;
border-bottom: var(--border-standard);
Expand Down Expand Up @@ -144,3 +257,16 @@
color: var(--bg);
text-shadow: none
}

@media (max-width: 720px) {
.toolbox-status-bar__inner {
width: var(--container-width);
grid-template-columns: 1fr;
text-align: center
}

.toolbox-status-bar__game {
justify-content: center;
text-align: center
}
}
30 changes: 28 additions & 2 deletions assets/theme-v2/js/gamefoundry-partials.js
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,32 @@
}
}

async function renderToolboxStatusBar() {
const pagePath = currentPagePath() || "";
if (pagePath.indexOf("toolbox/") !== 0) {
return;
Comment on lines +1053 to +1054

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mount the bar on the toolbox clean URL

When the toolbox landing is opened as /toolbox/ or /toolbox (the common directory-index URL), currentPagePath() returns toolbox, so this guard returns before loading the shared status bar. That leaves the toolbox index without the new selected-game/context UI even though /toolbox/index.html gets it; normalize the exact toolbox path to the index page or allow it here.

Useful? React with 👍 / 👎.

}
try {
const module = await import(assetUrl("js/toolbox-status-bar.js"));
if (typeof module.mountToolboxStatusBar === "function") {
module.mountToolboxStatusBar({
gameHubHref: routeHref("game-hub"),
pagePath
});
}
} catch (error) {
console.warn("[toolbox/status] Shared status bar could not be loaded.", error);
}
}

function refreshSharedSurfaces() {
renderPlatformBanner()
.then(renderToolboxStatusBar)
.catch(function (error) {
console.error(error);
});
}

enforcePageProtection();
document.addEventListener("DOMContentLoaded", function () {
enforcePageProtection();
Expand All @@ -1056,11 +1082,11 @@
replaceExisting("header-nav", "header.site-header"),
replaceExisting("footer", "footer.footer")
];
Promise.all(tasks).then(renderPlatformBanner).catch(function (error) {
Promise.all(tasks).then(refreshSharedSurfaces).catch(function (error) {
console.error(error);
});
});
window.addEventListener("gamefoundry:session-user-changed", refreshHeaderLoginState);
window.addEventListener("gamefoundry:data-changed", refreshHeaderOnly);
window.addEventListener("gamefoundry:platform-settings-changed", renderPlatformBanner);
window.addEventListener("gamefoundry:platform-settings-changed", refreshSharedSurfaces);
}());
Loading