Skip to content

Commit bf4b831

Browse files
committed
Hook the OpenMuse skin onto OpenBot's navigation list and data-slots
The menu sheet kept its own list of OpenBot destinations, which would miss any page OpenBot adds. Its destinations now come from the shared navigation list OpenBot's sidebar draws, filtered for the signed-in person; conversations and the skin's tabs stay as they were. The stylesheet reached OpenBot's components through Tailwind classes and ARIA labels, so restyling the composer or the conversation header in OpenBot would have broken the skin without a test failing. It now uses only the data-slot hooks those components publish: composer, composer-input, composer-attach/send/stop, conversation-header and page-title. The system font is set through the font-sans token rather than by overriding OpenBot's font classes.
1 parent b92a7bc commit bf4b831

3 files changed

Lines changed: 61 additions & 142 deletions

File tree

‎app/src/skins/openmuse/menu-sheet.tsx‎

Lines changed: 10 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
import {
2-
IconBell,
3-
IconBolt,
4-
IconBox,
5-
IconBrain,
6-
IconCalendarRepeat,
7-
IconHandStop,
82
IconHome,
93
IconLogout,
104
IconMessageCircle,
115
IconPin,
126
IconPinFilled,
137
IconPinnedOff,
14-
IconPlug,
158
IconPlus,
169
IconSearch,
17-
IconSettings,
18-
IconShieldLock,
19-
IconTargetArrow,
2010
IconTrash,
2111
IconUsersGroup,
2212
} from "@tabler/icons-react";
@@ -41,6 +31,7 @@ import {
4131
channelListQueryOptions,
4232
} from "@/lib/channels/queries";
4333
import { appConfig } from "@/lib/generated/application-config";
34+
import { useNavigationItems } from "@/lib/navigation";
4435
import { relativeTime } from "@/lib/relative-time";
4536
import { cn } from "@/lib/utils";
4637
import { queryClient } from "@/query-client";
@@ -66,6 +57,7 @@ export function MenuSheet({ onClose }: { onClose: () => void }) {
6657
const channels = useInfiniteQuery(channelListQueryOptions());
6758
const navigate = useNavigate();
6859
const signOut = useMutation(signOutMutationOptions(queryClient));
60+
const navigation = useNavigationItems();
6961
const [search, setSearch] = useState("");
7062
const body = useRef<HTMLDivElement>(null);
7163
const searching = search.trim().length > 0;
@@ -147,90 +139,20 @@ export function MenuSheet({ onClose }: { onClose: () => void }) {
147139
<Divider className="my-1.5" />
148140
<div>
149141
<LinkRow
150-
detail="Start a conversation with any Bot"
151142
icon={IconHome}
152143
render={<Link onClick={onClose} to="/" />}
153144
title="Home"
154145
/>
155-
<LinkRow
156-
detail="Yours, shared with you, and your team's"
157-
icon={IconBolt}
158-
render={<Link onClick={onClose} to="/bots" />}
159-
title="Bots"
160-
/>
161-
{bot ? (
162-
<LinkRow
163-
detail={`What ${bot.name} keeps doing for you`}
164-
icon={IconTargetArrow}
165-
render={
166-
<Link
167-
onClick={onClose}
168-
params={{ agentId: bot.id }}
169-
to="/bots/$agentId/responsibilities"
170-
/>
171-
}
172-
tint="green"
173-
title="Responsibilities"
174-
/>
175-
) : null}
176-
<LinkRow
177-
detail="What your Bots do on a schedule"
178-
icon={IconCalendarRepeat}
179-
render={<Link onClick={onClose} to="/routines" />}
180-
tint="green"
181-
title="Routines"
182-
/>
183-
<LinkRow
184-
detail="What your Bots know how to do"
185-
icon={IconBox}
186-
render={<Link onClick={onClose} to="/capabilities/skills" />}
187-
tint="lavender"
188-
title="Skills"
189-
/>
190-
<LinkRow
191-
detail="What your Bots remember about you"
192-
icon={IconBrain}
193-
render={<Link onClick={onClose} to="/capabilities/memory" />}
194-
tint="lavender"
195-
title="Memory"
196-
/>
197-
<LinkRow
198-
detail="The apps your Bots use as you"
199-
icon={IconPlug}
200-
render={<Link onClick={onClose} to="/connections" />}
201-
tint="orange"
202-
title="Connections"
203-
/>
204-
<LinkRow
205-
detail="What your Bots ask you before they act"
206-
icon={IconHandStop}
207-
render={<Link onClick={onClose} to="/settings/approvals" />}
208-
tint="orange"
209-
title="Approvals"
210-
/>
211-
<LinkRow
212-
detail="Where your Bots reach you"
213-
icon={IconBell}
214-
render={<Link onClick={onClose} to="/settings/notifications" />}
215-
tint="orange"
216-
title="Notifications"
217-
/>
218-
<LinkRow
219-
detail="Theme, skin and preferences"
220-
icon={IconSettings}
221-
render={<Link onClick={onClose} to="/settings" />}
222-
tint="plain"
223-
title="Settings"
224-
/>
225-
{user.data?.role === "admin" ? (
146+
{/* OpenBot's own destinations, from the one list its sidebar draws. */}
147+
{navigation.map((item) => (
226148
<LinkRow
227-
detail="People, Bots and policy for everyone here"
228-
icon={IconShieldLock}
229-
render={<Link onClick={onClose} to="/admin" />}
230-
tint="plain"
231-
title="Admin"
149+
icon={item.icon}
150+
key={item.id}
151+
render={<Link onClick={onClose} to={item.to} />}
152+
tint={item.section === "account" ? "plain" : "sky"}
153+
title={item.label}
232154
/>
233-
) : null}
155+
))}
234156
</div>
235157
<MuseButton
236158
className="self-start"

‎app/src/skins/openmuse/skin.css‎

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
--openmuse-font:
4949
-apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
5050
Helvetica, Arial, sans-serif;
51+
--font-sans: var(--openmuse-font);
5152
--openmuse-accent: #1473c8;
5253
--openmuse-blue: #c8e7ff;
5354
--openmuse-sky: #edf7fd;
@@ -125,6 +126,7 @@
125126
--openmuse-font:
126127
-apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
127128
Helvetica, Arial, sans-serif;
129+
--font-sans: var(--openmuse-font);
128130
--openmuse-accent: #6fb6f0;
129131
--openmuse-blue: #2a5576;
130132
--openmuse-sky: #13242e;
@@ -164,20 +166,17 @@
164166
}
165167

166168
/*
167-
* OpenMuse is set in the device's own system font. OpenBot sets Inter on `html` through a layered
168-
* utility, which this unlayered rule outranks; `.font-sans` and `.font-heading` name Inter directly,
169-
* so they are pointed back at the same stack.
169+
* OpenMuse is set in the device's own system font. `--font-sans` above is the token OpenBot's
170+
* headings read; the page itself takes it here, because OpenBot names Inter on `html` directly.
170171
*/
171-
:root[data-skin="openmuse"],
172-
:root[data-skin="openmuse"] .font-sans,
173-
:root[data-skin="openmuse"] .font-heading {
174-
font-family: var(--openmuse-font);
172+
:root[data-skin="openmuse"] {
173+
font-family: var(--font-sans);
175174
}
176175

177176
/*
178-
* OpenBot's own pages, worn the OpenMuse way. These reach only into the frame's stage and only by
179-
* the attributes OpenBot's components already publish (`data-slot`, ARIA labels), so nothing about
180-
* the components changes; only how they look inside OpenMuse.
177+
* OpenBot's own pages, worn the OpenMuse way. Every rule below reaches OpenBot's components only
178+
* through the `data-slot` hooks they publish for this, so restyling a component inside OpenBot cannot
179+
* silently break the skin.
181180
*/
182181

183182
/* OpenMuse's buttons are pills. */
@@ -186,7 +185,7 @@
186185
}
187186

188187
/* Page titles at OpenMuse's 25px, semibold and tight. */
189-
:root[data-skin="openmuse"] .openmuse-stage header > div > h1 {
188+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="page-title"] {
190189
font-size: 25px;
191190
font-weight: 600;
192191
letter-spacing: -0.7px;
@@ -232,9 +231,7 @@
232231
}
233232

234233
/* A conversation's own header row carries no rule beneath it; the frame above already separates. */
235-
:root[data-skin="openmuse"]
236-
.openmuse-stage
237-
[class~="sticky"][class~="border-b"] {
234+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="conversation-header"] {
238235
border-bottom-color: transparent;
239236
padding-inline: 0;
240237
}
@@ -249,7 +246,7 @@
249246

250247
:root[data-skin="openmuse"]
251248
.openmuse-stage[data-openmuse-width="page"]
252-
[class~="sticky"][class~="border-b"] {
249+
[data-slot="conversation-header"] {
253250
padding-inline: 12px;
254251
}
255252
}
@@ -280,7 +277,7 @@
280277
}
281278

282279
/* The composer: OpenMuse's white pill with a soft shadow, a "+" on the left and a round send. */
283-
:root[data-skin="openmuse"] .openmuse-stage form:has([aria-label="Message"]) {
280+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer"] {
284281
min-height: 62px;
285282
padding: 8px;
286283
border: 1px solid var(--openmuse-composer-border);
@@ -291,60 +288,46 @@
291288

292289
:root[data-skin="openmuse"]
293290
.openmuse-stage
294-
form:has([aria-label="Message"]):focus-within {
291+
[data-slot="composer"]:focus-within {
295292
border-color: var(--openmuse-focus);
296293
box-shadow: 0 4px 20px var(--openmuse-composer-shadow);
297294
}
298295

299-
:root[data-skin="openmuse"] .openmuse-stage form [aria-label="Message"],
300-
:root[data-skin="openmuse"] .openmuse-stage form .prompt-area-container {
296+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer-input"] > * {
301297
font-size: 17px;
302298
line-height: 24px;
303299
}
304300

305-
:root[data-skin="openmuse"] .openmuse-stage form [aria-label="Attach a file"],
306-
:root[data-skin="openmuse"] .openmuse-stage form [aria-label="Send message"],
307-
:root[data-skin="openmuse"] .openmuse-stage form [aria-label="Stop the Bot"],
308-
:root[data-skin="openmuse"]
309-
.openmuse-stage
310-
form
311-
[aria-label="Dictate a message"] {
301+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer-attach"],
302+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer-send"],
303+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer-stop"] {
312304
width: 44px;
313305
height: 44px;
314306
border-radius: 9999px;
315307
align-self: flex-end;
316308
}
317309

318-
:root[data-skin="openmuse"]
319-
.openmuse-stage
320-
form
321-
[aria-label="Attach a file"]
322-
svg {
310+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer-attach"] svg {
323311
width: 24px;
324312
height: 24px;
325313
stroke-width: 1.5;
326314
}
327315

328-
:root[data-skin="openmuse"] .openmuse-stage form [aria-label="Send message"],
329-
:root[data-skin="openmuse"] .openmuse-stage form [aria-label="Stop the Bot"] {
316+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer-send"],
317+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer-stop"] {
330318
background: var(--primary);
331319
color: var(--primary-foreground);
332320
}
333321

334322
:root[data-skin="openmuse"]
335323
.openmuse-stage
336-
form
337-
[aria-label="Send message"]:disabled {
324+
[data-slot="composer-send"]:disabled {
338325
background: var(--openmuse-send-idle);
339326
color: var(--openmuse-quiet);
340327
opacity: 1;
341328
}
342329

343-
:root[data-skin="openmuse"]
344-
.openmuse-stage
345-
form
346-
[aria-label="Send message"]
347-
svg {
330+
:root[data-skin="openmuse"] .openmuse-stage [data-slot="composer-send"] svg {
348331
width: 22px;
349332
height: 22px;
350333
}

‎app/tests/skins-openmuse.test.tsx‎

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import type { BotActivity, BotAttention } from "@/lib/bot-lifecycle/queries";
3030
import type { ChannelSummary } from "@/lib/channels/queries";
3131
import { appConfig } from "@/lib/generated/application-config";
3232
import type { MemoryRecord } from "@/lib/memory";
33+
import { navigationFor } from "@/lib/navigation";
3334
import type { PluginsPage } from "@/lib/plugins/queries";
3435
import type { ProactiveSetting, ProactiveSuggestion } from "@/lib/proactive";
3536
import type { ResponsibilityRecord } from "@/lib/responsibilities";
@@ -747,17 +748,13 @@ describe("every OpenBot surface stays reachable", () => {
747748
[/^Main chat/, "/channel/c-muse"],
748749
[/^New chat$/, "/channel/new?agent=picked-harness"],
749750
[/^New group$/, "/channel/new"],
750-
[/^Home/, "/"],
751-
[/^Bots/, "/bots"],
752-
[/^Responsibilities/, "/bots/picked-harness/responsibilities"],
753-
[/^Routines/, "/routines"],
754-
[/^Skills/, "/capabilities/skills"],
755-
[/^Memory/, "/capabilities/memory"],
756-
[/^Connections/, "/connections"],
757-
[/^Approvals/, "/settings/approvals"],
758-
[/^Notifications/, "/settings/notifications"],
759-
[/^Settings/, "/settings"],
760-
[/^Admin/, "/admin"],
751+
[/^Home$/, "/"],
752+
// OpenBot's own destinations, from the shared navigation list its sidebar draws.
753+
[/^Bots$/, "/bots"],
754+
[/^Capabilities$/, "/capabilities"],
755+
[/^Connections$/, "/connections"],
756+
[/^Admin$/, "/admin"],
757+
[/^Settings$/, "/settings"],
761758
];
762759

763760
test("the menu reaches every surface, every conversation and every group", async () => {
@@ -784,12 +781,29 @@ describe("every OpenBot surface stays reachable", () => {
784781
).toBe("/group/g-team");
785782
});
786783

784+
test.each(["admin", "user"] as const)(
785+
"the menu draws OpenBot's whole navigation list for a %s",
786+
async (role) => {
787+
serve({ role });
788+
renderAt("/s/goals");
789+
const menu = within(await openMenu());
790+
await menu.findByRole("link", { name: /^Settings$/ });
791+
for (const item of navigationFor(role)) {
792+
expect(
793+
menu
794+
.getByRole("link", { name: new RegExp(`^${item.label}$`) })
795+
.getAttribute("href"),
796+
).toBe(item.to);
797+
}
798+
},
799+
);
800+
787801
test("Admin is offered only to administrators", async () => {
788802
serve({ role: "user" });
789803
renderAt("/s/activity");
790804
const menu = within(await openMenu());
791-
await menu.findByRole("link", { name: /^Settings/ });
792-
expect(menu.queryByRole("link", { name: /^Admin/ })).toBeNull();
805+
await menu.findByRole("link", { name: /^Settings$/ });
806+
expect(menu.queryByRole("link", { name: /^Admin$/ })).toBeNull();
793807
});
794808

795809
test.each([
@@ -804,7 +818,7 @@ describe("every OpenBot surface stays reachable", () => {
804818
serve();
805819
const router = renderAt(path);
806820
const menu = within(await openMenu());
807-
const settings = await menu.findByRole("link", { name: /^Settings/ });
821+
const settings = await menu.findByRole("link", { name: /^Settings$/ });
808822
expect(settings.getAttribute("href")).toBe("/settings");
809823
fireEvent.click(settings);
810824
await waitFor(() =>

0 commit comments

Comments
 (0)