Skip to content

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

Leave Active Threads to the Inbox: no Simple button here

milind-soni9d23532cb47e
diff --git a/docs/verification/threads.md b/docs/verification/threads.md
index 81960ed67b..337696c3e9 100644
--- a/docs/verification/threads.md
+++ b/docs/verification/threads.md
@@ -73,9 +73,7 @@ switching and Stop can be exercised without a real provider or account.
`openmausbot://bot/<id>` link opens the main thread. A row or tile with a
mark on it opens the thread the mark is about (waiting on you, then unread,
then work under way, a thread another bot opened included); a second click
- returns to the main thread. In Simple mode **Active Threads** appears beside
- Search while anything is active and lists what the phone's Updates sheet
- lists.
+ returns to the main thread.
13. Stop a running job through its activity entry while a sibling is queued;
verify only the chosen job stops and the queued message starts normally.
Reload and confirm Show threads remains off. Turn it back on to recover
diff --git a/src/components/NotificationsPanel.test.ts b/src/components/NotificationsPanel.test.ts
index 5d58182a58..100e7c9e42 100644
--- a/src/components/NotificationsPanel.test.ts
+++ b/src/components/NotificationsPanel.test.ts
@@ -29,7 +29,9 @@ describe("a row in the bell", () => {
}
it("lands on a thread another bot opened, and reveals its row in the sidebar", () => {
- expect(click("work")).toEqual([{ type: "select", id: "scout" }, { type: "switchTask", botId: "scout", threadId: "work" }, { type: "revealThread", threadId: "work" }]);
+ const actions = click("work");
+ expect(actions).toContainEqual({ type: "switchTask", botId: "scout", threadId: "work" });
+ expect(actions).toContainEqual({ type: "revealThread", threadId: "work" });
});
it("says so when that thread is gone, never landing silently on another chat", () => {
diff --git a/src/components/Sidebar.simple-layout.test.ts b/src/components/Sidebar.simple-layout.test.ts
index 282d3e671c..bbe871d204 100644
--- a/src/components/Sidebar.simple-layout.test.ts
+++ b/src/components/Sidebar.simple-layout.test.ts
@@ -107,23 +107,6 @@ afterEach(() => {
});
describe("Simple-mode sidebar layout", () => {
- describe("Active Threads, the desktop's list of what the phone's Updates shows", () => {
- const working = bot("spuernase", { threadId: "main", tasks: [{ threadId: "main", title: "Main", createdAt: 1 }, { threadId: "work", title: "@CoS · work", createdAt: 2, busy: true, activity: "working" }] });
- const opened = (tree: ReactElement<Props>[]) => tree.find((node) => node.props["aria-label"] === "Active Threads, 1");
-
- it("stays away while nothing is going on", () => {
- expect(labelled(render().tree, "Active Threads")).toBe(false);
- });
-
- it("is there while a bot works in a thread another bot opened, and leaves the corner room for it", () => {
- fixture.state = { ...fixture.state, bots: [working, bot("chief", { chiefOfStaff: true })] };
- const { tree } = render();
- expect(opened(tree), "reachable with no thread list in Simple").toBeTruthy();
- const grid = tree.find((node) => node.type === SidebarTileGrid)!.props as Parameters<typeof SidebarTileGrid>[0];
- expect(grid.cornerButtons).toBe(3);
- });
- });
-
it("lists the bots with no heading, then gives group chats and a person's own departments a quiet heading with a count", () => {
const { tree } = render();
expect(sectionOrder(tree)).toEqual([BOTS_SECTION_ID, CHANNELS_SECTION_ID, userSectionId("Work")]);
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 1ec10d5fc4..dd39e8a939 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -1141,7 +1141,7 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {
const { interactive: layoutInteractive, collapsed: sectionCollapsed, toggle: toggleSection } = sections;
const archivedBots = state.bots.filter((bot) => bot.hidden && !bot.movedTo);
const archivedEntry = remoteClient ? undefined : { count: archivedBots.length, open: () => setArchivedBotsOpen(true) };
- const attention = crossBotAttentionThreads(state.bots, state.pendingQueued, undefined, state.groups), activeThreadsShown = advanced || attention.length > 0;
+ const attention = crossBotAttentionThreads(state.bots, state.pendingQueued, undefined, state.groups);
const pinnedThreads = crossBotPinnedThreads(state.bots, state.groups, state.pendingQueued);
const pendingBotUndo = teamFeedback?.restoreBot;
const botRow = (bot: Bot) => botRowProps(state, dispatch, bot, { density, query: q, onMenu: setMenu, renameRequest: renameRequest?.botId === bot.id ? renameRequest.nonce : 0, ...drops.row(bot.id) });
@@ -1312,18 +1312,18 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {
>
<Search size={20} strokeWidth={1.5} />
</button>}
- {activeThreadsShown && <div ref={attentionMenuRef} className={density === "icons" ? "relative" : "contents"}>
+ {advanced && <div ref={attentionMenuRef} className={density === "icons" ? "relative" : "contents"}>
<button
type="button"
onClick={() => setAttentionOpen((o) => !o)}
aria-label={attentionTriggerLabel(attention.length)}
title={attentionTriggerLabel(attention.length)}
className={cn(
- "relative", corner ? SIMPLE_CORNER_BUTTON : simpleDesk ? SIMPLE_TOP_BUTTON : "flex items-center justify-center text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
- !corner && !simpleDesk && (density === "icons" ? "size-[46px] shrink-0 rounded-xl" : phone ? "size-10 shrink-0 rounded-full border border-hairline bg-card text-ink" : "size-8 rounded-full"),
+ "relative flex items-center justify-center text-ink-secondary transition-colors hover:bg-ink/[0.06] hover:text-ink focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
+ density === "icons" ? "size-[46px] shrink-0 rounded-xl" : phone ? "size-10 shrink-0 rounded-full border border-hairline bg-card text-ink" : "size-8 rounded-full",
)}
>
- <Activity size={corner ? 17 : density === "icons" ? 20 : 18} strokeWidth={1.5} />
+ <Activity size={density === "icons" ? 20 : 18} strokeWidth={1.5} />
{attention.length > 0 && (
<span className="absolute -right-0.5 -top-0.5 flex min-w-4 items-center justify-center rounded-full bg-accent px-0.5 text-[10px] font-semibold leading-4 text-ink">{attention.length > 9 ? "9+" : attention.length}</span>
)}
@@ -1420,7 +1420,7 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {
onToggle={layoutInteractive ? () => toggleSection(PINNED_THREADS_SECTION_ID) : undefined}
/>
)}
- {tiles && <SidebarTileGrid primary={primary} pinned={pinnedBots} row={botRow} corner={corner} cornerButtons={activeThreadsShown ? 3 : 2} />}
+ {tiles && <SidebarTileGrid primary={primary} pinned={pinnedBots} row={botRow} corner={corner} />}
{simpleDesk && !tiles && <SidebarNoBots />}
</GlassBar>
diff --git a/src/components/SidebarTiles.tsx b/src/components/SidebarTiles.tsx
index 5438e0206d..da2daa7eea 100644
--- a/src/components/SidebarTiles.tsx
+++ b/src/components/SidebarTiles.tsx
@@ -134,19 +134,19 @@ export function SidebarNoBots() {
return <p data-sidebar-empty="" className="px-5 pt-4 text-[13px] leading-[18px] text-ink-tertiary">{t("onboarding.shell.noBots")}</p>;
}
-/** How much of the grid's right end each button takes in a framed window's corner (Sidebar's corner row). */
-const CORNER_BUTTON = 30;
+/** How much of the grid's right end Search and New take in a framed window's corner (Sidebar's corner row). */
+const CORNER_CLEAR = 60;
/** Whether the tiles' first row, as laid out, ends before the corner's buttons: the sidebar's width and the number of
* tiles decide it. */
-export function tilesClearCorner(tiles: { top: number; right: number }[], gridRight: number, buttons = 2): boolean {
+export function tilesClearCorner(tiles: { top: number; right: number }[], gridRight: number): boolean {
if (!tiles.length) return false;
const top = tiles[0]!.top;
- return Math.max(...tiles.filter((tile) => Math.abs(tile.top - top) < 1).map((tile) => tile.right)) <= gridRight - buttons * CORNER_BUTTON;
+ return Math.max(...tiles.filter((tile) => Math.abs(tile.top - top) < 1).map((tile) => tile.right)) <= gridRight - CORNER_CLEAR;
}
/** While the tiles clear the corner they rise beside its buttons (styles.css); else they start under them. */
-function useBesideCorner(corner: boolean, count: number, buttons: number) {
+function useBesideCorner(corner: boolean, count: number) {
const ref = useRef<HTMLDivElement>(null);
const [beside, setBeside] = useState(false);
useLayoutEffect(() => {
@@ -154,20 +154,20 @@ function useBesideCorner(corner: boolean, count: number, buttons: number) {
if (!corner || !grid) { setBeside(false); return; }
const measure = () => {
const tiles = [...grid.querySelectorAll<HTMLElement>("[data-sidebar-tile]")].map((tile) => tile.getBoundingClientRect());
- setBeside(tilesClearCorner(tiles, grid.getBoundingClientRect().right, buttons));
+ setBeside(tilesClearCorner(tiles, grid.getBoundingClientRect().right));
};
measure();
if (typeof ResizeObserver === "undefined") return;
const observer = new ResizeObserver(measure);
observer.observe(grid);
return () => observer.disconnect();
- }, [corner, count, buttons]);
+ }, [corner, count]);
return { ref, beside };
}
-export function SidebarTileGrid({ primary, pinned, row, corner = false, cornerButtons = 2 }: { primary: Bot | null; pinned: Bot[]; row: (bot: Bot) => BotRowProps; corner?: boolean; cornerButtons?: number }) {
+export function SidebarTileGrid({ primary, pinned, row, corner = false }: { primary: Bot | null; pinned: Bot[]; row: (bot: Bot) => BotRowProps; corner?: boolean }) {
const order = usePinnedCircleDrag(pinned);
- const besideCorner = useBesideCorner(corner, (primary ? 1 : 0) + order.ranked.length, cornerButtons);
+ const besideCorner = useBesideCorner(corner, (primary ? 1 : 0) + order.ranked.length);
if (!primary && order.ranked.length === 0) return null;
return (
<div ref={besideCorner.ref} data-sidebar-tiles="" data-beside-corner={besideCorner.beside ? "" : undefined}
diff --git a/src/components/WindowFrameBar.test.ts b/src/components/WindowFrameBar.test.ts
index 3f1681f440..9493d17982 100644
--- a/src/components/WindowFrameBar.test.ts
+++ b/src/components/WindowFrameBar.test.ts
@@ -182,7 +182,5 @@ describe("Simple's sidebar corner", () => {
expect(tilesClearCorner([...row(2), ...row(1, 106)], 280), "a second row under it changes nothing").toBe(true);
expect(tilesClearCorner(row(2), 240), "a narrower sidebar").toBe(false);
expect(tilesClearCorner([], 280)).toBe(false);
- expect(tilesClearCorner(row(2), 280, 3), "Active Threads beside them while anything is active").toBe(false);
- expect(tilesClearCorner(row(1), 280, 3)).toBe(true);
});
});
diff --git a/src/state/store.test.ts b/src/state/store.test.ts
index 8f23c5f61a..17071c28c6 100644
--- a/src/state/store.test.ts
+++ b/src/state/store.test.ts
@@ -941,7 +941,7 @@ describe("notification routing", () => {
const followed = (threadId: string, threadsShown: boolean) => {
const dispatch = vi.fn();
openThread(dispatch, { botId: "bot-1", threadId }, { bots: [bot], groups: [] }, threadsShown);
- return dispatch.mock.calls.map(([action]) => action as Action).filter((action) => action.type !== "revealThread");
+ return dispatch.mock.calls.map(([action]) => action as Action).filter((action) => action.type !== "revealThread" && action.type !== "notice");
};
it("opens a thread a notification names without passing the reply the bot was left on as read, with threads hidden", () => {