Skip to content

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

fix(bot-panel): keep settings row titles readable on narrow phones

Bugfixer 25ac298165768
diff --git a/src/components/bot-panel/rows.test.ts b/src/components/bot-panel/rows.test.ts
new file mode 100644
index 0000000000..0f399722cb
--- /dev/null
+++ b/src/components/bot-panel/rows.test.ts
@@ -0,0 +1,13 @@
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { expect, it } from "vitest";
+import { NavRow } from "./rows";
+
+const classes = (html: string, tag: string) => [...html.matchAll(new RegExp(`<${tag} class="([^"]*)"`, "g"))][0]?.[1].split(" ") ?? [];
+
+it("keeps room for the title on a phone and lets a long value shrink instead", () => {
+ const html = renderToStaticMarkup(createElement(NavRow, { title: "Apps it can use", value: "google-calendar, gmail, notion, slack, linear, github", onClick: () => {} }));
+ expect(classes(html, "div")).toContain("min-w-[45%]");
+ expect(classes(html, "span")).toContain("min-w-0");
+ expect(classes(html, "span")).not.toContain("shrink-0");
+});
diff --git a/src/components/bot-panel/rows.tsx b/src/components/bot-panel/rows.tsx
index 1c08e780ef..fcb59a4e25 100644
--- a/src/components/bot-panel/rows.tsx
+++ b/src/components/bot-panel/rows.tsx
@@ -134,12 +134,12 @@ export function NavRow({ title, hint, value, icon, onClick, drill = true, danger
className={cn(rowCls, "w-full text-left enabled:hover:bg-ink/[0.03] disabled:cursor-default disabled:opacity-45")}
>
{icon && <RowIcon icon={icon} />}
- <div className="min-w-0 flex-1">
+ <div className="min-w-[45%] flex-1">
<div className={cn(titleCls, danger && "text-danger")}>{title}</div>
{hint && <div className={hintCls}>{hint}</div>}
</div>
{value !== undefined && value !== null && value !== "" && (
- <span className="inline-flex max-w-[45%] shrink-0 items-center gap-1 truncate text-[13px] text-ink-secondary">{value}</span>
+ <span className="inline-flex min-w-0 max-w-[45%] items-center gap-1 truncate text-[13px] text-ink-secondary">{value}</span>
)}
{drill && <ChevronRight size={15} className="shrink-0 text-ink-tertiary" aria-hidden="true" />}
</button>