Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude/skills/openbot-copy/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ than showing an empty row. `app/src/lib/primitives.ts` holds the names, the orde
| **Setup** | A Bot's name and instructions. | |
| **Vault** | Your saved logins and keys. No Bot sees what is in it. | Saved logins, Passwords, Keys, Credentials (as pages) |

**The sidebar strip's short names.** The strip writes each section's name under its icon, in a
column too narrow for the long ones, so there alone Conversations is **Chats**. The panel it opens
keeps its full name, and sentences still say "conversation". Nowhere else uses this short name.
**The sidebar strip's names.** The strip shows each section's name in a tooltip beside its icon,
and says it to a screen reader, so a section keeps its full name there too: **Conversations**, as
the panel it opens says. The strip has no short names of its own.

The scopes are **this Bot** (the Bot's page), **every Bot** (Settings, and Apps in the sidebar)
and, in the team edition, **everyone** (Admin). The words in the "Not" column may still appear in a
Expand Down
16 changes: 16 additions & 0 deletions app/src/assets/patterns/window-matrix.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
167 changes: 93 additions & 74 deletions app/src/components/admin/admin-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { IconArrowLeft } from "@/components/icons";
import { Link, type LinkOptions } from "@tanstack/react-router";
import type * as React from "react";
import { useAdminSections } from "@/components/admin/admin-sections";
import { usePendingRequestCounts } from "@/components/plugins/access-requests";
import {
MenuSidebarBack,
MenuSidebarNotch,
MenuSidebarPanel,
menuSidebarActiveProps,
menuSidebarButtonClassName,
menuSidebarGroupClassName,
menuSidebarLabelClassName,
} from "@/components/layout/menu-sidebar";
import { SIDEBAR_SLAB } from "@/components/layout/sidebar-shell";
import {
Sidebar,
SidebarContent,
Expand Down Expand Up @@ -37,95 +46,105 @@ export function AdminSidebar({
*/
const waiting = usePendingRequestCounts()?.total ?? 0;
return (
<Sidebar variant="inset" {...props}>
// A slab on the window, as the app's sidebar is.
<Sidebar className={SIDEBAR_SLAB} variant="inset" {...props}>
{/*
* Pinned to the same height as the app sidebar's header. Left to itself this one is 60px
* against the app's 45px — `p-2` around a `size="lg"` button rather than a fixed height — so
* the nav list started lower here and the sidebar appeared to shift on the way into Admin.
*
* The button takes its default height rather than `h-full`. `h-full` resolves against the
* parent, which in the app sidebar is a flex row holding a second control and here is not, so
* the same class produces two different heights.
* On the slab's top row, beside the window's buttons in OpenBot Desktop on macOS, at the same
* height as Settings'. The button takes its default height rather than `h-full`, which
* resolves against the parent and so drew two different heights in two shells.
*/}
<SidebarHeader className="h-12 p-2">
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton
className="hover:bg-sidebar-accent/50"
render={(props) => (
<Link {...appLinkOptions} {...props}>
<IconArrowLeft className="mr-2 h-4 w-4" />
Back to app
<MenuSidebarBack />
</Link>
)}
/>
</SidebarMenuItem>
</SidebarMenu>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarMenu>
<SidebarMenuItem>
{/*
* `activeOptions.exact`, because /admin is a prefix of every other route here and
* would otherwise light up on all of them.
*/}
<SidebarMenuButton
size="page"
render={(props) => (
<Link
{...adminLinkOptions}
activeOptions={{ exact: true }}
activeProps={{ className: "bg-foreground/5" }}
{...props}
>
Overview
</Link>
)}
/>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
{sections.map((group) => (
<SidebarGroup key={group.title}>
<SidebarGroupLabel>{group.title}</SidebarGroupLabel>
<SidebarMenu className="gap-px">
{group.items.map((item) => {
const count = item.linkOptions.to === APPS_TO ? waiting : 0;
return (
<SidebarMenuItem key={item.title}>
<SidebarMenuButton
size="page"
render={(props) => (
<Link
{...item.linkOptions}
activeProps={{ className: "bg-foreground/5" }}
{...props}
>
<item.icon className="mr-2 h-4 w-4" />
{/* Cut short on one line in a narrow sidebar, never wrapped out of the row. */}
<span className="min-w-0 truncate">{item.title}</span>
{count > 0 ? (
<span className="sr-only">
, {count} {count === 1 ? "request" : "requests"}{" "}
waiting
</span>
) : null}
</Link>
)}
/>
{/* As Settings badges Setup: the count beside the name, read out once in the link. */}
{count > 0 ? (
<SidebarMenuBadge aria-hidden="true">
{count}
</SidebarMenuBadge>
) : null}
</SidebarMenuItem>
);
})}
<MenuSidebarPanel title="Admin">
<SidebarContent>
<SidebarGroup className={menuSidebarGroupClassName}>
<SidebarMenu>
<SidebarMenuItem>
<MenuSidebarNotch />
{/*
* `activeOptions.exact`, because /admin is a prefix of every other route here and
* would otherwise light up on all of them.
*/}
<SidebarMenuButton
className={menuSidebarButtonClassName}
size="page"
render={(props) => (
<Link
{...adminLinkOptions}
activeOptions={{ exact: true }}
activeProps={menuSidebarActiveProps}
{...props}
>
Overview
</Link>
)}
/>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroup>
))}
</SidebarContent>
{sections.map((group) => (
<SidebarGroup
className={menuSidebarGroupClassName}
key={group.title}
>
<SidebarGroupLabel className={menuSidebarLabelClassName}>
{group.title}
</SidebarGroupLabel>
<SidebarMenu className="gap-1">
{group.items.map((item) => {
const count = item.linkOptions.to === APPS_TO ? waiting : 0;
return (
<SidebarMenuItem key={item.title}>
<MenuSidebarNotch />
<SidebarMenuButton
className={menuSidebarButtonClassName}
size="page"
render={(props) => (
<Link
{...item.linkOptions}
activeProps={menuSidebarActiveProps}
{...props}
>
<item.icon />
{/* Cut short on one line in a narrow sidebar, never wrapped out of the row. */}
<span className="min-w-0 truncate">
{item.title}
</span>
{count > 0 ? (
<span className="sr-only">
, {count} {count === 1 ? "request" : "requests"}{" "}
waiting
</span>
) : null}
</Link>
)}
/>
{/* As Settings badges Setup: the count beside the name, read out once in the link. */}
{count > 0 ? (
<SidebarMenuBadge aria-hidden="true">
{count}
</SidebarMenuBadge>
) : null}
</SidebarMenuItem>
);
})}
</SidebarMenu>
</SidebarGroup>
))}
</SidebarContent>
</MenuSidebarPanel>
<SidebarRail />
</Sidebar>
);
Expand Down
35 changes: 31 additions & 4 deletions app/src/components/app-sidebar/app-sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import type * as React from "react";
import { useState } from "react";
import { useBeforeCommandNavigate } from "@/components/navigation/command-menu";
import { SIDEBAR_SLAB } from "@/components/layout/sidebar-shell";
import { SIDEBAR_SHORTCUT_LABEL } from "@/components/layout/sidebar-toggle";
import { Sidebar, SidebarRail, useSidebar } from "@/components/ui/sidebar";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { useChannelEvents } from "@/lib/channels/use-channel-events";
import { useOpenSection } from "@/lib/sections";
import { cn } from "@/lib/utils";
import { BotsPanel } from "./bots-panel";
import { ConversationsPanel } from "./conversations-panel";
import { SectionStrip } from "./section-strip";
Expand All @@ -27,7 +35,7 @@ export {
* Bots' on the Bots section, Conversations' everywhere else.
*/
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
const { setOpenMobile } = useSidebar();
const { setOpenMobile, state } = useSidebar();
const { section } = useOpenSection();
/*
* Both panels stay mounted once shown, the one not open out of sight: going back to a panel finds
Expand All @@ -45,18 +53,37 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {

return (
<Sidebar
className="overflow-hidden"
// A slab on the window, the window showing at its edges and in the seam beside the page.
className={cn("overflow-hidden", SIDEBAR_SLAB)}
collapsible="icon"
variant="inset"
{...props}
>
{/* In OpenBot Desktop on macOS, what shows of this row past the strip moves the window too. */}
{/*
* In OpenBot Desktop on macOS, what shows of this row past the strip moves the window too. In
* a narrow window the sheet is the slab, and the panel lies in it the same way.
*/}
<div className="flex h-full min-h-0 flex-row" data-desktop-drag="">
<SectionStrip />
<ConversationsPanel hidden={bots} />
{botsShown ? <BotsPanel hidden={!bots} /> : null}
</div>
<SidebarRail />
{/* Folded down to the strip, its edge says how to bring the panel back. */}
{state === "collapsed" ? (
<Tooltip>
{/* The rail's own slot, which the trigger's would otherwise replace. */}
<TooltipTrigger
data-slot="sidebar-rail"
render={<SidebarRail title={undefined} />}
/>
<TooltipContent side="right" sideOffset={4}>
Show sidebar
<span className="text-background/60">{SIDEBAR_SHORTCUT_LABEL}</span>
</TooltipContent>
</Tooltip>
) : (
<SidebarRail />
)}
</Sidebar>
);
}
30 changes: 16 additions & 14 deletions app/src/components/app-sidebar/bots-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const HeldReads = createContext<(botId: string, held: unknown) => void>(

/** The row under a Bot that is not a conversation: Show more. */
const BOT_LIST_ACTION_ROW =
"w-full justify-start px-2.5 font-normal text-muted-foreground text-sm";
"w-full justify-start pr-3 pl-1.5 font-normal text-muted-foreground text-sm";

/**
* One Bot's latest conversations, under its row: {@link BOT_CONVERSATIONS_PAGE} at a time, read from
Expand Down Expand Up @@ -198,7 +198,7 @@ function BotConversations({

/** The squares after a Bot's name: + for a new conversation, and the caret. */
const BOT_ROW_SQUARE =
"flex size-9 shrink-0 items-center justify-center rounded-lg bg-transparent text-muted-foreground outline-hidden ring-sidebar-ring transition-colors hover:bg-foreground/5 hover:text-sidebar-foreground focus-visible:ring-2";
"flex size-9 shrink-0 items-center justify-center rounded-md bg-transparent text-muted-foreground outline-hidden ring-sidebar-ring transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-foreground focus-visible:ring-2";

/**
* One Bot: its orb and name, a link to its page, with a dot when something waits on the person from
Expand Down Expand Up @@ -230,7 +230,7 @@ function BotRow({
<ContextMenu>
<ContextMenuTrigger className="min-w-0 flex-1">
<Link
className="flex h-9 min-w-0 flex-1 items-center gap-2.5 rounded-lg pr-2.5 pl-2.5 text-sm outline-hidden ring-sidebar-ring transition-colors hover:bg-foreground/5 focus-visible:ring-2"
className="flex h-9 min-w-0 flex-1 items-center gap-2 rounded-md pr-3 pl-1.5 font-medium text-sm outline-hidden ring-sidebar-ring transition-colors hover:bg-sidebar-accent/50 focus-visible:ring-2"
params={{ agentId: bot.id }}
to="/bots/$agentId"
>
Expand Down Expand Up @@ -282,8 +282,9 @@ function BotRow({
</button>
</div>
{expanded ? (
// The line stops short of the next Bot's orb, which sits right under it otherwise.
<div className="mb-2 ml-5 border-sidebar-border border-l pl-1.5">
// The line stops short of the next Bot's orb, which sits right under it otherwise. It keeps
// to the orb's left of centre as the row's 6px gutter moves the orb.
<div className="mb-2 ml-4 border-sidebar-border border-l pl-1.5">
<BotConversations botId={bot.id} botName={bot.name} />
</div>
) : null}
Expand Down Expand Up @@ -337,7 +338,7 @@ export function BotsPanel({ hidden = false }: { hidden?: boolean }) {
actions={
<Button
aria-label="New Bot"
className="hover:bg-foreground/5"
className="hover:bg-sidebar-accent/50"
render={(props) => (
<Link {...props} search={{ new: true }} to="/bots" />
)}
Expand All @@ -351,8 +352,9 @@ export function BotsPanel({ hidden = false }: { hidden?: boolean }) {
hidden={hidden}
title="Bots"
>
<SidebarContent className="scroll-fade-b px-2 pb-2">
<InputGroup className="h-9 rounded-lg bg-background text-sm">
{/* The panel's 12px gutter, as the Conversations panel keeps it. */}
<SidebarContent className="scroll-fade-b px-3 pt-2 pb-2">
<InputGroup className="h-8 text-sm">
<InputGroupInput
aria-label="Search Bots"
onChange={(event) => setSearch(event.target.value)}
Expand All @@ -363,16 +365,16 @@ export function BotsPanel({ hidden = false }: { hidden?: boolean }) {
<IconSearch />
</InputGroupAddon>
</InputGroup>
<div className="h-2 shrink-0" />
<div className="h-3 shrink-0" />
{bots.isPending ? (
<p
role="status"
className="px-2.5 py-1.5 text-muted-foreground text-xs"
className="px-1.5 py-1.5 text-muted-foreground text-xs"
>
Loading…
</p>
) : !bots.data ? (
<div className="px-2.5 py-2">
<div className="px-1.5 py-2">
<p role="alert" className="mb-1 text-muted-foreground text-xs">
{loadFailure(
bots.error,
Expand All @@ -389,15 +391,15 @@ export function BotsPanel({ hidden = false }: { hidden?: boolean }) {
</Button>
</div>
) : shown.length === 0 ? (
<p className="px-2.5 py-2 text-muted-foreground text-xs">
<p className="px-1.5 py-2 text-muted-foreground text-xs">
{term
? `No Bots match “${search.trim()}”.`
: "No Bots yet. Make one with New Bot."}
</p>
) : (
<HeldReads.Provider value={reportHeld}>
{held !== undefined ? (
<div className="flex items-center gap-2 px-2.5 pb-1">
<div className="flex items-center gap-2 px-1.5 pb-1">
<p
role="alert"
className="min-w-0 flex-1 text-muted-foreground text-xs"
Expand All @@ -417,7 +419,7 @@ export function BotsPanel({ hidden = false }: { hidden?: boolean }) {
</Button>
</div>
) : null}
<ul className="flex flex-col gap-px">
<ul className="flex flex-col gap-1">
{shown.map((bot) => (
<BotRow
bot={bot}
Expand Down
Loading