Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(rooms): set people's names in the same type as bot names

Brunofc04ee2573f9
diff --git a/DESIGN.md b/DESIGN.md
index 64e9cf8cd3..600cf03b35 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -110,6 +110,7 @@ and never add fonts.
| Menu item (`MENU_ITEM`) | 14 / 18px | 400 | `ink` |
| Body, rows, menu rows (`MENU_ROW`) | 13 / 18px | 400 | `ink` or `ink-secondary` |
| Names in lists | 13 / 18px | 500 | `ink` |
+| Speaker names in transcripts (people and bots) | 13px | 600 | bot colour, else `ink-secondary` |
| Meta, hints, group labels | 12 / 16px | 400 (group labels 500) | `ink-tertiary` |
| Keycaps (`ShortcutHint`), tiny badges | 11px | 400 | `ink-secondary` or `ink-tertiary` |
@@ -118,8 +119,8 @@ Rules:
- **Buttons size their own labels.** `.ui-button` and its variants set the
size and weight; don't add text classes to them.
- **Stick to the table.** No 16px or 18px body text, and no new text under 11px.
-- **Three weights:** 400 for text, 500 for names and labels, 600 for titles.
- No 700.
+- **Three weights:** 400 for text, 500 for names and labels, 600 for titles
+ and for speaker names in transcripts. No 700.
- **Sentence case everywhere.** Titles, buttons, menu items and labels.
No ALL CAPS labels and no Title Case.
- **One line for titles and rows.** Truncate with `truncate` and keep the
diff --git a/src/components/ChatView.team.test.ts b/src/components/ChatView.team.test.ts
index c420cfaf45..a930b731e2 100644
--- a/src/components/ChatView.team.test.ts
+++ b/src/components/ChatView.team.test.ts
@@ -67,6 +67,14 @@ it("names a teammate's line on a shared server without a team, and not the viewe
expect(row("noted").textContent).not.toContain("Ada");
});
+it("sets a person's name in the same type as a bot's name", () => {
+ draw(luna([line("o1", { name: "Olive", id: "p_olive" }, "plant is memory-Fernando")]), {});
+ const name = [...row("plant is memory-Fernando").querySelectorAll("div")].find((element) => element.textContent === "Olive")!;
+ expect(name.className).toContain("text-[13px]");
+ expect(name.className).toContain("font-semibold");
+ expect(name.className).toContain("text-ink-secondary");
+});
+
it("says a member's own MausBot is theirs, not everyone's", () => {
draw(luna([], { defaultBot: { person: "[email protected]" } } as Partial<Bot>));
expect(container.textContent).not.toContain(t("team.sharedHeader", { team: "Acme" }));
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsx
index 2245b56820..2b4a032f18 100644
--- a/src/components/ChatView.tsx
+++ b/src/components/ChatView.tsx
@@ -420,7 +420,7 @@ const Bubble = memo(function Bubble({
return (
<div {...{ [MESSAGE_ROW]: "" }} data-look={user ? "message-user" : "message-bot"} className={cn("group flex w-full flex-col", user ? "animate-msg-in items-end" : "items-start", simple && join?.above && SIMPLE_STACKED)}>
{message.relay ? <RelayLabel message={message} /> : peer && <PeerLabel peer={peer} />}
- {speaker && <div className="mb-0.5 px-1 text-right text-[12px] [overflow-wrap:anywhere] font-medium text-ink-secondary">{speaker}</div>}
+ {speaker && <div className="mb-0.5 px-1 text-right text-[13px] [overflow-wrap:anywhere] font-semibold text-ink-secondary">{speaker}</div>}
<div className={cn("flex w-full items-center gap-1.5", user ? "justify-end" : "justify-start")}>
{user && (
<MessageActions
diff --git a/src/components/GroupView.speaker.test.ts b/src/components/GroupView.speaker.test.ts
index b27aaceb33..aa77899d6a 100644
--- a/src/components/GroupView.speaker.test.ts
+++ b/src/components/GroupView.speaker.test.ts
@@ -101,6 +101,8 @@ describe("room speaker names", () => {
const shared = markup(messages);
expect(shared).toContain(">Olive<");
expect(shared).not.toContain(">Ada<");
+ const nameClasses = shared.match(/class="([^"]*)">Olive</)![1].split(" ");
+ expect(nameClasses).toEqual(expect.arrayContaining(["text-[13px]", "font-semibold", "text-ink-secondary"]));
viewer.reactor = "user";
const solo = markup(messages);
expect(solo).not.toContain(">Olive<");
diff --git a/src/components/GroupView.tsx b/src/components/GroupView.tsx
index 09283d4372..b17747b302 100644
--- a/src/components/GroupView.tsx
+++ b/src/components/GroupView.tsx
@@ -203,7 +203,7 @@ function RoomTextMessage({
);
return (
<div {...{ [MESSAGE_ROW]: "" }} data-look={user ? "message-user" : "message-bot"} className={cn("group flex w-full flex-col", user ? "items-end" : "items-start")}>
- {speaker && <div className="mb-0.5 px-1 text-right text-[12px] [overflow-wrap:anywhere] font-medium text-ink-secondary">{speaker}</div>}
+ {speaker && <div className="mb-0.5 px-1 text-right text-[13px] [overflow-wrap:anywhere] font-semibold text-ink-secondary">{speaker}</div>}
<div className={cn("flex w-full items-end gap-1.5", user ? "justify-end" : "justify-start")}>
{user && (
<MessageActions side="user" menu={[...userMessageMenu({ messageId: m.id, pin }), ...forkAction]}>