Skip to content
Merged
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
61 changes: 40 additions & 21 deletions .claude/skills/openbot-screen-layout/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ deviation worth stating out loud and worth a comment saying why.
Four components make the frame. They compose in this order and nest no other way.

```
PageShell the page: header (title, description, action, backButton) then children
PageSection a titled group of unrelated decisions, with a deliberately large gap above it
PageRows the grouped card: rounded-lg border bg-card
PageShell the page: header (title, one-sentence description, action, backButton) then children
PageSection a group of unrelated decisions under a small label, a large gap above it
PageRows the list: flat rows, no card, split by hairline dividers
Item one row, size="sm", divided from its neighbours by <Separator />
PageEmpty what a section says when it has nothing to list
```
Expand All @@ -68,21 +68,22 @@ components above; a screen that sets its own is drifting.
|---------|-----|----------------|
| Page edge (top / sides / bottom) | 48 / 16 / 64px | `PageShell` column (`pt-12` or `pt-8` under the bar, `px-4`, `pb-16`) |
| Title → description | 8px | `PageShell` header |
| Section label → description | 0px | `PageSection` |
| Title block → first content | 32px | `PageShell`: `[&>header+*]:mt-8` |
| Title → tabs, tabs → content | 24px, then 32px | `PageShell`: `[&>header+nav]`, `[&>header+nav+*]` |
| Section → section | 48px | `PageSection` (`mt-12`) |
| Section heading → description | 4px | `PageSection` |
| Heading block → section content | 16px | `PageRows` / `PageEmpty` (`mt-4`) |
| Label block → section content | 8px | `PageRows` / `PageEmpty` (`mt-2`) |
| Controls stacked inside a section | 12px | the screen, with `gap-3` |
| A row in `PageRows` | 71px with a description, never under 56px | `Item` (`px-4 py-3.5 gap-3`), `PageRows` (`min-h-14`) |
| Divider between rows | inset 16px from both edges | `PageRows`, on every horizontal `Separator` inside it |
| A row in `PageRows` | about 59px with a description, never under 48px | `PageRows` sets each row's `py-2` and `min-h-12` |
| Row text → column edge | 0px: the text lines up with the label above | `PageRows` (`-mx-2`, rows `px-2`) |
| Divider between rows | lined up with the rows' text | `PageRows`, on every horizontal `Separator` inside it |

The 32px under the title is deliberately tighter than the 48px between sections: the title belongs
to the page it introduces. Those `PageShell` selectors outrank the first child's own `mt-*`, so a
section or notice keeps its usual margin everywhere else and loses it only at the top.

A page with one section gives that section no `title`: the page title already names it, and a second
heading 32px below the first says the same thing twice. Put the description on `PageShell` instead
A page with one section gives that section no `title`: the page title already names it, and a label
32px below it says the same thing twice. Put the description on `PageShell` instead
(`connections.index.tsx`). A count or filter that belongs to a search sits on the search's row, not
on a line of its own.

Expand All @@ -92,6 +93,20 @@ sentence of description saying how the first one arrives, and an `action` — th
page already has — when there is one to offer. Don't repeat "Add one with X" in the description when
the action is right there. A search with no results uses `IconSearch` and "No matches".

## Words Under A Title

A page's `description` and a section's `description` are each **one short sentence**: what the page
or the group is for. A longer explanation (how rules combine, what happens in each case, an
exception) goes in `learnMore`, on `PageShell` or `PageSection`. It opens under the sentence when the
person presses "Learn more". While closed it is hidden until found, so find-in-page still reaches
it. A
section whose title and rows already say it needs no description.

The section title is a small label, not a heading to read: `text-sm`, medium weight, in the text
color so it reads as a title over the grey description. A count of what the section lists goes in
`count`, after the title, muted and in tabular figures. That is the one way to show a section's
count. The rows under it are what a person reads.

## Screens, Not Dialogs

**A dialog is used only where the request explicitly asks for one. Everything else is a new
Expand All @@ -109,25 +124,27 @@ button.

### Procedure 1: Lay out a screen

1. Open with `PageShell`, giving it `title` and `description`. Leave `width` alone.
1. Open with `PageShell`, giving it `title` and a one-sentence `description` (Words Under A Title).
Leave `width` alone.
2. On a detail screen reached from a list, pass `backButton={{ label, linkProps }}` — it draws a
chevron-left bar above the header. Do not put a Back button in `action`; `action` is for the
page's one primary verb, on the title's baseline.
3. Group the page's decisions into `PageSection`s, each with a `title` and, where the grouping is not
self-evident, a `description`.
4. Give each section one `PageRows` card. Rows go inside it as `Item size="sm"`, with `<Separator />`
between them and none after the last. `PageRows` is a card with dividers, not a stack of cards —
gaps between rows are the wrong shape.
self-evident, a one-sentence `description`.
4. Give each section one `PageRows`. Rows go inside it as `Item size="sm"`, with `<Separator />`
between them and none after the last. `PageRows` is a flat list with dividers, not a card and not
a stack of cards: gaps between rows are the wrong shape.
5. Read `admin/plugins/index.tsx` for the whole pattern end to end, and
`admin/plugins/$key.tsx` or `admin/components/$name.tsx` for a screen with several sections and
mixed row kinds.

### Procedure 2: Compose a row

1. `ItemMedia variant="icon"` holds a leading icon from `@/components/icons`, drawn as a 16px glyph on
a 32px muted tile. It is what makes a card of rows scannable; a row without one reads as a
paragraph. Pass the bare icon — the variant sizes and colours it — and use plain `ItemMedia` only
for something that is its own picture, such as a Bot's avatar.
1. A row has no leading icon by default: a glyph beside every row repeats what its title says.
Give the rows icons only where the icon tells them apart: an app's mark, a file's kind. Then
each row's `ItemMedia variant="icon"` holds the icon from `@/components/icons` (a 16px glyph on a
32px tile). Plain `ItemMedia` is for something that is its own picture, such as a Bot's avatar
or an app's logo.
2. `ItemContent` holds `ItemTitle` and, where the row needs a second line, `ItemDescription`.
3. `ItemActions` holds the control, or the value when the row is read-only.
4. `ItemHeader` and `ItemFooter` are `basis-full`, so they wrap onto a line of their own inside the
Expand Down Expand Up @@ -178,7 +195,7 @@ itself when the screen behind it changes something.

### Procedure 4: Sizes and variants

1. `Item size="sm"` for rows inside a card. `default` only for a row standing on its own.
1. `Item size="sm"` for rows inside a list. `default` only for a row standing on its own.
2. `Button size="sm"` for a control inside a row or a dialog footer; `lg` for a page's own actions;
`icon-sm` for a control floating over artwork.
The page's main add action is one filled button, in the header or in the page's sticky toolbar
Expand Down Expand Up @@ -255,8 +272,10 @@ is actually on screen. The root was once 15px, and every constant taken from the

| Signal | What it means | Do instead |
|--------|---------------|------------|
| A hand-written `rounded-lg border border-border bg-card` div wrapping rows | `PageRows` re-implemented, and it will drift from the other seven screens | Use `PageRows` |
| Rows separated by `gap-*` instead of `<Separator />` | A stack of cards rather than one card of rows | `<Separator />` between rows, none after the last |
| A hand-written `rounded-lg border border-border bg-card` div wrapping rows | A card around a list, which `PageRows` no longer draws | Use `PageRows` |
| Rows separated by `gap-*` instead of `<Separator />` | A stack of cards rather than one list of rows | `<Separator />` between rows, none after the last |
| `ItemMedia variant="icon"` on rows whose icons are one per kind of setting | A tile that repeats the title, the look this layout dropped | No media; keep tiles for app marks and file kinds |
| A page or section description of two or more sentences | A paragraph between the title and the rows | One sentence; the rest in `learnMore` |
| `width="wide"` or `"full"` on rows or a form | Prose width is the default for a reason; the others are for a grid of cards and a table | Leave `width` alone |
| A `max-w-*`, `p-*` or text size invented for one screen | A fifth container width, which is what this layout exists to stop | Reach for the existing component |
| Children on an element passed to `Item`'s `render` | They replace the row's own children; the row draws empty | Pass a childless element |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { useMutation, useQuery } from "@tanstack/react-query";
import { IconUsers } from "@/components/icons";
import { PageRows, PageSection } from "@/components/layout/page-shell";
import {
Item,
ItemActions,
ItemContent,
ItemDescription,
ItemMedia,
ItemTitle,
} from "@/components/ui/item";
import { Switch } from "@/components/ui/switch";
Expand Down Expand Up @@ -43,9 +41,6 @@ export function ArtifactCollaborationSection() {
) : null}
<PageRows>
<Item size="sm">
<ItemMedia variant="icon">
<IconUsers />
</ItemMedia>
<ItemContent>
<ItemTitle>Show who has an artifact open</ItemTitle>
<ItemDescription className="line-clamp-none">
Expand Down
19 changes: 2 additions & 17 deletions app/src/components/admin/controls/capabilities-section.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import {
IconChevronRight,
IconSparkles,
IconToggleRight,
IconUsersGroup,
} from "@/components/icons";
import { useMutation, useQuery } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
import { useState } from "react";
import { BusinessComputerLink } from "@/components/edition/team-features-dialog";
import { IconChevronRight } from "@/components/icons";
import { PageRows } from "@/components/layout/page-shell";
import { Button } from "@/components/ui/button";
import {
Expand All @@ -23,7 +18,6 @@ import {
ItemActions,
ItemContent,
ItemDescription,
ItemMedia,
ItemTitle,
} from "@/components/ui/item";
import { Label } from "@/components/ui/label";
Expand All @@ -44,7 +38,7 @@ import type {
CapabilitySetting,
EnterpriseOverview,
} from "@/lib/enterprise/queries";
import { loadFailure, failureSaid } from "@/lib/load-failure";
import { failureSaid, loadFailure } from "@/lib/load-failure";
import { MISSING_TEAM } from "@/lib/teams/names";
import { teamListQueryOptions } from "@/lib/teams/queries";
import { queryClient } from "@/query-client";
Expand Down Expand Up @@ -87,9 +81,6 @@ export function CapabilitiesSection() {
return (
<div key={capability.capability}>
<Item size="sm">
<ItemMedia variant="icon">
<IconToggleRight />
</ItemMedia>
<ItemContent>
<ItemTitle>{capability.title}</ItemTitle>
<ItemDescription>
Expand Down Expand Up @@ -134,9 +125,6 @@ export function CapabilitiesSection() {
}
size="sm"
>
<ItemMedia variant="icon">
<IconUsersGroup />
</ItemMedia>
<ItemContent>
<ItemTitle>Role and team overrides</ItemTitle>
<ItemDescription>
Expand All @@ -154,9 +142,6 @@ export function CapabilitiesSection() {
render={<Link to="/admin/permissions/describe" />}
size="sm"
>
<ItemMedia variant="icon">
<IconSparkles />
</ItemMedia>
<ItemContent>
<ItemTitle>Describe it in words</ItemTitle>
<ItemDescription>
Expand Down
34 changes: 1 addition & 33 deletions app/src/components/admin/controls/computer-sections.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import {
IconAppWindow,
IconBrandWindows,
IconChevronRight,
IconDeviceDesktop,
IconNetwork,
IconPlus,
IconUsersGroup,
IconWorld,
} from "@/components/icons";
import { useMutation, useQuery } from "@tanstack/react-query";
import { useId, useState } from "react";
import { useEdition } from "@/components/edition/for-a-team";
import { IconChevronRight } from "@/components/icons";
import { PageRows, PageSection } from "@/components/layout/page-shell";
import { Button } from "@/components/ui/button";
import {
Expand All @@ -34,7 +25,6 @@ import {
ItemActions,
ItemContent,
ItemDescription,
ItemMedia,
ItemTitle,
} from "@/components/ui/item";
import { Label } from "@/components/ui/label";
Expand Down Expand Up @@ -135,9 +125,6 @@ export function InactiveComputersSection() {
}
size="sm"
>
<ItemMedia variant="icon">
<IconDeviceDesktop />
</ItemMedia>
<ItemContent>
<ItemTitle>Stop inactive computers</ItemTitle>
<ItemDescription>
Expand Down Expand Up @@ -230,9 +217,6 @@ export function WindowsAllowlistSection() {
<PageSection title={WINDOWS_ALLOWLIST_TITLE}>
<PageRows>
<Item size="sm">
<ItemMedia variant="icon">
<IconBrandWindows />
</ItemMedia>
<ItemContent>
<ItemTitle>Only the programs listed here</ItemTitle>
<ItemDescription className="line-clamp-none">
Expand All @@ -258,9 +242,6 @@ export function WindowsAllowlistSection() {
<div key={program}>
<Separator />
<Item size="sm">
<ItemMedia variant="icon">
<IconAppWindow />
</ItemMedia>
<ItemContent>
<ItemTitle className="font-mono">{program}</ItemTitle>
</ItemContent>
Expand Down Expand Up @@ -298,9 +279,6 @@ export function WindowsAllowlistSection() {
}
size="sm"
>
<ItemMedia variant="icon">
<IconPlus />
</ItemMedia>
<ItemContent>
<ItemTitle>Add a program</ItemTitle>
<ItemDescription>
Expand Down Expand Up @@ -441,9 +419,6 @@ function NetworkPolicies({ data }: { data: EnterpriseOverview }) {
}
size="sm"
>
<ItemMedia variant="icon">
<IconWorld />
</ItemMedia>
<ItemContent>
<ItemTitle>Organization</ItemTitle>
<ItemDescription>
Expand Down Expand Up @@ -471,13 +446,6 @@ function NetworkPolicies({ data }: { data: EnterpriseOverview }) {
}
size="sm"
>
<ItemMedia variant="icon">
{policy.scopeKind === "team" ? (
<IconUsersGroup />
) : (
<IconNetwork />
)}
</ItemMedia>
<ItemContent>
{/* A long team name wraps, and the row is a button, whose words center unless told. */}
<ItemTitle className="text-left">{titleOf(policy)}</ItemTitle>
Expand Down
37 changes: 7 additions & 30 deletions app/src/components/admin/controls/describe-capabilities.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
import type { UseQueryResult } from "@tanstack/react-query";
import { Fragment } from "react";
import type { AuditEvent } from "@/components/audit/audit-cells";
import {
type ReplayRow,
ReplayRows,
} from "@/components/boundaries/dry-run-changes";
import {
IconBuilding,
IconChecklist,
IconCircleDashed,
IconDeviceDesktop,
IconFolder,
IconKey,
IconMessage,
IconPlug,
IconRobot,
IconTrash,
IconUser,
IconUserShield,
IconUsersGroup,
} from "@/components/icons";
import type { UseQueryResult } from "@tanstack/react-query";
import { Fragment } from "react";
import type { AuditEvent } from "@/components/audit/audit-cells";
import {
type ReplayRow,
ReplayRows,
} from "@/components/boundaries/dry-run-changes";
import { PageRows } from "@/components/layout/page-shell";
import { Button } from "@/components/ui/button";
import { Field, FieldDescription, FieldLabel } from "@/components/ui/field";
Expand All @@ -28,7 +23,6 @@ import {
ItemActions,
ItemContent,
ItemDescription,
ItemMedia,
ItemTitle,
} from "@/components/ui/item";
import { Separator } from "@/components/ui/separator";
Expand Down Expand Up @@ -65,13 +59,6 @@ function scopeWords(change: CapabilityChange, teams: Teams): string {
return change.scopeId;
}

const SCOPE_ICONS: Partial<Record<string, typeof IconBuilding>> = {
organization: IconBuilding,
role: IconUserShield,
team: IconUsersGroup,
group: IconUsersGroup,
};

/** What a switch is set to, in the overrides dialog's words: a team grants, the rest turn on or off. */
function settingWords(change: CapabilityChange): {
text: string;
Expand Down Expand Up @@ -116,7 +103,6 @@ export function ChangeRows({
<PageRows>
{changes.map((change, index) => {
const row = index + 1;
const Icon = SCOPE_ICONS[change.scopeKind] ?? IconCircleDashed;
const setting = settingWords(change);
const title = titles[change.capability] ?? change.capability;
const wrong = problems.filter((problem) => problem.change === row);
Expand All @@ -125,9 +111,6 @@ export function ChangeRows({
// biome-ignore lint/suspicious/noArrayIndexKey: see above
<Fragment key={index}>
<Item size="sm">
<ItemMedia variant="icon">
<Icon />
</ItemMedia>
<ItemContent>
<ItemTitle>{title}</ItemTitle>
<ItemDescription>{scopeWords(change, teams)}</ItemDescription>
Expand Down Expand Up @@ -335,12 +318,6 @@ export function PermissionsPreview({
return (
<Fragment key={person.id}>
<Item size="sm">
<ItemMedia
className="translate-y-0.5 self-start"
variant="icon"
>
<IconUser />
</ItemMedia>
<ItemContent className="min-w-0">
<ItemTitle>{nameOf(person)}</ItemTitle>
<ItemDescription className="line-clamp-none">
Expand Down
Loading