Skip to content

Commit 24ba379

Browse files
author
DavidQ
committed
Host/Tools UI collapsible section more intuitive..
1 parent 54f3990 commit 24ba379

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

tools/shared/assetUsageIntegration.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,24 +145,28 @@ export function getSharedShellActions(currentToolId, pageMode = "tool") {
145145
return [
146146
{
147147
id: "browse-assets",
148+
targetToolId: "asset-browser",
148149
label: SHARED_ACTION_LABELS.browseAssets,
149150
href: getSharedToolHref("asset-browser", pageMode, { view: "browse", sourceToolId: currentToolId }),
150151
current: currentToolId === "asset-browser" && view !== "import"
151152
},
152153
{
153154
id: "import-assets",
155+
targetToolId: "asset-browser",
154156
label: SHARED_ACTION_LABELS.importAssets,
155157
href: getSharedToolHref("asset-browser", pageMode, { view: "import", sourceToolId: currentToolId }),
156158
current: currentToolId === "asset-browser" && view === "import"
157159
},
158160
{
159161
id: "browse-palettes",
162+
targetToolId: "palette-browser",
160163
label: SHARED_ACTION_LABELS.browsePalettes,
161164
href: getSharedToolHref("palette-browser", pageMode, { view: "browse", sourceToolId: currentToolId }),
162165
current: currentToolId === "palette-browser" && view !== "manage"
163166
},
164167
{
165168
id: "manage-palettes",
169+
targetToolId: "palette-browser",
166170
label: SHARED_ACTION_LABELS.managePalettes,
167171
href: getSharedToolHref("palette-browser", pageMode, { view: "manage", sourceToolId: currentToolId }),
168172
current: currentToolId === "palette-browser" && view === "manage"

tools/shared/platformShell.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ body.tools-platform-surface {
188188
.tools-platform-frame__project {
189189
display: flex;
190190
align-items: center;
191-
justify-content: space-between;
191+
justify-content: center;
192+
flex-direction: column;
192193
gap: 14px;
193194
flex-wrap: wrap;
194195
margin-top: 10px;
@@ -200,8 +201,10 @@ body.tools-platform-surface {
200201
.tools-platform-frame__project-actions {
201202
display: flex;
202203
align-items: center;
204+
justify-content: center;
203205
gap: 10px;
204206
flex-wrap: wrap;
207+
text-align: center;
205208
}
206209

207210
.tools-platform-frame__project-label,
@@ -291,6 +294,8 @@ body.tools-platform-surface {
291294
.tools-platform-frame__shared-status {
292295
color: var(--muted, #e9ddff);
293296
font-size: 0.92rem;
297+
justify-content: center;
298+
text-align: center;
294299
}
295300

296301
.tools-platform-frame__shared-status strong {

tools/shared/platformShell.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,13 @@ function renderSharedActionLinks(currentToolId) {
111111
return "";
112112
}
113113
const sourceToolId = currentToolId || HEADER_EXPANDED_FALLBACK_TOOL;
114+
const visibleToolIds = new Set(
115+
getToolRegistry()
116+
.filter((entry) => entry.active === true && entry.visibleInToolsList === true)
117+
.map((entry) => entry.id)
118+
);
114119
return getSharedShellActions(sourceToolId, getPageMode())
120+
.filter((action) => !action.targetToolId || !visibleToolIds.has(action.targetToolId))
115121
.map((action) => {
116122
const currentClass = action.current ? " is-current" : "";
117123
return `<a class="tools-platform-frame__action-link${currentClass}" href="${escapeHtml(action.href)}">${escapeHtml(action.label)}</a>`;
@@ -147,6 +153,7 @@ function renderProjectSummary(currentTool) {
147153
const readiness = manifest?.tools?.[currentTool.id]
148154
? "shared project state synced"
149155
: "shared project shell ready";
156+
const sharedSelectionSummary = renderSharedSelectionSummary();
150157

151158
return `
152159
<div class="tools-platform-frame__project" aria-label="Project system controls">
@@ -163,12 +170,14 @@ function renderProjectSummary(currentTool) {
163170
<button type="button" class="tools-platform-frame__project-button is-secondary" data-project-action="close">Close Project</button>
164171
<input type="file" class="tools-platform-frame__project-input" data-project-open-input accept=".json,application/json" />
165172
</div>
173+
${sharedSelectionSummary}
166174
</div>
167175
`;
168176
}
169177

170178
function renderHeaderMarkup(currentTool, isHeaderExpanded) {
171179
const isLanding = getPageMode() === "landing";
180+
const sharedActionLinks = !isLanding ? renderSharedActionLinks(currentTool?.id ?? "") : "";
172181
const title = currentTool ? currentTool.displayName : (document.body.dataset.toolTitle || "Tools Platform");
173182
const description = currentTool
174183
? currentTool.description
@@ -199,10 +208,11 @@ function renderHeaderMarkup(currentTool, isHeaderExpanded) {
199208
</div>
200209
${renderProjectSummary(currentTool)}
201210
${!isLanding ? `
202-
<div class="tools-platform-frame__actions" aria-label="Shared asset and palette actions">
203-
${renderSharedActionLinks(currentTool?.id ?? "")}
204-
</div>
205-
${renderSharedSelectionSummary()}
211+
${sharedActionLinks ? `
212+
<div class="tools-platform-frame__actions" aria-label="Shared asset and palette actions">
213+
${sharedActionLinks}
214+
</div>
215+
` : ""}
206216
` : ""}
207217
</div>
208218
</section>

0 commit comments

Comments
 (0)