From 3b93f999a424653148fe59b4cff27028ba2157f1 Mon Sep 17 00:00:00 2001 From: Guido Vizoso Date: Wed, 2 Dec 2026 10:28:55 -0300 Subject: [PATCH 01/10] A field's edge is back at 20% in light and 16% in dark, while lines stay at 10% and 12% --- app/src/lib/artifacts/tokens.css | 4 +-- app/src/theme.css | 4 +-- app/tests/ui-look-theme.test.ts | 49 +++++++++++++++++++------------- desktop/src/styles.css | 4 +-- docs/app-guidelines.md | 10 ++++--- docs/design-system.md | 6 ++-- mobile/src/scheme.ts | 4 +-- tokens/src/scheme.ts | 13 +++++---- 8 files changed, 55 insertions(+), 39 deletions(-) diff --git a/app/src/lib/artifacts/tokens.css b/app/src/lib/artifacts/tokens.css index 1c1d3ce30e..d3ad547e9f 100644 --- a/app/src/lib/artifacts/tokens.css +++ b/app/src/lib/artifacts/tokens.css @@ -20,7 +20,7 @@ --success: oklch(0.514 0.1 167.2); --warning: oklch(0.521 0.143 47.7); --border: oklch(0.108 0.042 264.7 / 10%); - --input: oklch(0.108 0.042 264.7 / 10%); + --input: oklch(0.108 0.042 264.7 / 20%); --ring: oklch(0.638 0.167 276.1); --chart-1: oklch(0.46 0.2 264); --chart-2: oklch(0.66 0.146 66); @@ -59,7 +59,7 @@ --success: oklch(0.832 0.13 170.1); --warning: oklch(0.828 0.189 84.4); --border: oklch(0.956 0.004 252 / 12%); - --input: oklch(0.956 0.004 252 / 12%); + --input: oklch(0.956 0.004 252 / 16%); --ring: oklch(0.713 0.151 277.7); --chart-1: oklch(0.58 0.2 264); --chart-2: oklch(0.76 0.168 66); diff --git a/app/src/theme.css b/app/src/theme.css index 6bc3c73c7a..1e5af47e22 100644 --- a/app/src/theme.css +++ b/app/src/theme.css @@ -32,7 +32,7 @@ --success: oklch(0.514 0.1 167.2); --warning: oklch(0.521 0.143 47.7); --border: oklch(0.108 0.042 264.7 / 10%); - --input: oklch(0.108 0.042 264.7 / 10%); + --input: oklch(0.108 0.042 264.7 / 20%); --ring: oklch(0.638 0.167 276.1); --chart-1: oklch(0.46 0.2 264); --chart-2: oklch(0.66 0.146 66); @@ -85,7 +85,7 @@ --success: oklch(0.832 0.13 170.1); --warning: oklch(0.828 0.189 84.4); --border: oklch(0.956 0.004 252 / 12%); - --input: oklch(0.956 0.004 252 / 12%); + --input: oklch(0.956 0.004 252 / 16%); --ring: oklch(0.713 0.151 277.7); --chart-1: oklch(0.58 0.2 264); --chart-2: oklch(0.76 0.168 66); diff --git a/app/tests/ui-look-theme.test.ts b/app/tests/ui-look-theme.test.ts index fd64a85bed..ea824f9668 100644 --- a/app/tests/ui-look-theme.test.ts +++ b/app/tests/ui-look-theme.test.ts @@ -53,27 +53,38 @@ describe("the look's theme values", () => { * A hairline is the text color, at 10% in light and 12% in dark (Sam, 2026-12-01): about 1.25:1 * against a card in light and 1.38:1 in dark. At 20% and 16% (1.6:1) cards and rows read heavy and * boxed beside ChatGPT, Claude and Grok, whose lines are 4% to 10%. One value for lines between - * things, a field's edge and the sidebar's lines, so no line in the app is fainter than another. - * An edge that must reach 3:1 (a checkbox's) is `muted-foreground`, never a line. + * things and the sidebar's lines, so no line in the app is fainter than another. + * + * A field's edge (`input`) stays at 20% and 16% (Guido, 2026-12-02). A field on a card is filled + * in the card's own color, so at rest its edge is the only thing that shows where it is, and at + * 1.25:1 it all but vanished. An edge that must reach 3:1 (a checkbox's) is `muted-foreground`, + * never a line. */ test.each([ - [":root", "10%"], - [".dark", "12%"], - ])("%s draws every line in the text color at %s", (selector, strength) => { - const block = - new RegExp( - `(?:^|[};])\\s*${selector.replace(".", "\\.")}\\s*\\{([^}]*)\\}`, - ).exec(withoutComments)?.[1] ?? ""; - const value = (name: string) => - new RegExp(`--${name}:\\s*([^;]+);`).exec(block)?.[1].trim(); - const foreground = value("foreground")?.replace(/\)$/, ""); - expect(foreground).toBeDefined(); - for (const name of ["border", "input", "sidebar-border"]) - expect({ name, value: value(name) }).toEqual({ - name, - value: `${foreground} / ${strength})`, - }); - }); + [":root", "10%", "20%"], + [".dark", "12%", "16%"], + ])( + "%s draws every line in the text color at %s, and a field's edge at %s", + (selector, line, field) => { + const block = + new RegExp( + `(?:^|[};])\\s*${selector.replace(".", "\\.")}\\s*\\{([^}]*)\\}`, + ).exec(withoutComments)?.[1] ?? ""; + const value = (name: string) => + new RegExp(`--${name}:\\s*([^;]+);`).exec(block)?.[1].trim(); + const foreground = value("foreground")?.replace(/\)$/, ""); + expect(foreground).toBeDefined(); + for (const [name, strength] of [ + ["border", line], + ["sidebar-border", line], + ["input", field], + ]) + expect({ name, value: value(name) }).toEqual({ + name, + value: `${foreground} / ${strength})`, + }); + }, + ); /* * A line is too faint for a mark someone has to find: the thumb that shows a list scrolls, and the diff --git a/desktop/src/styles.css b/desktop/src/styles.css index f15a804dc0..d50c3e9eb9 100644 --- a/desktop/src/styles.css +++ b/desktop/src/styles.css @@ -33,7 +33,7 @@ --destructive: oklch(0.46 0.173 22.6); --success: oklch(0.514 0.1 167.2); --border: oklch(0.108 0.042 264.7 / 10%); - --input: oklch(0.108 0.042 264.7 / 10%); + --input: oklch(0.108 0.042 264.7 / 20%); --ring: oklch(0.638 0.167 276.1); --sidebar: oklch(0.948 0.01 251.8); --sidebar-accent: oklch(0.832 0.085 281.4 / 30%); @@ -2528,7 +2528,7 @@ main > .sheet:has(.journey.handing-off) .self-contained-why { --destructive: oklch(0.792 0.121 16.4); --success: oklch(0.832 0.13 170.1); --border: oklch(0.956 0.004 252 / 12%); - --input: oklch(0.956 0.004 252 / 12%); + --input: oklch(0.956 0.004 252 / 16%); --ring: oklch(0.713 0.151 277.7); --sidebar: oklch(0.156 0.017 252); --sidebar-accent: oklch(0.832 0.085 281.4 / 12%); diff --git a/docs/app-guidelines.md b/docs/app-guidelines.md index 0f1a0a6bf2..5456437169 100644 --- a/docs/app-guidelines.md +++ b/docs/app-guidelines.md @@ -228,10 +228,12 @@ changes, for every screen at once, in a change agreed first. `rounded-xl` (14px), round things `rounded-full`. `rounded-none` squares a part off. No other step and no corner of its own (`rounded-[20px]`). 4. **Surfaces.** The frame (`sidebar`), the panel the page sits in (`background`), cards on it - (`card`). A card has a hairline border in light and in dark. Every line (`border`, a field's - `input`, the sidebar's `sidebar-border`) is the text color at 10% in light and 12% in dark, - about 1.25:1 against a card in light and 1.38:1 in dark, so no line in the app is fainter than - another. A line is never the only cue of a control: a checkbox's edge is `muted-foreground`. + (`card`). A card has a hairline border in light and in dark. Every line (`border`, the + sidebar's `sidebar-border`) is the text color at 10% in light and 12% in dark, about 1.25:1 + against a card in light and 1.38:1 in dark, so no line in the app is fainter than another. A + field's edge (`input`) is stronger, at 20% in light and 16% in dark (about 1.6:1): a field is + filled in the card's own color, so its edge is what shows where it is. A checkbox's edge is + `muted-foreground`. 5. **Shadows.** A shadow says how far something floats, as Linear draws it, and Tailwind's own steps only: - none for everything in the page: the panel, cards, rows, fields, the sidebar; diff --git a/docs/design-system.md b/docs/design-system.md index 08ae60b509..954deba92c 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -54,7 +54,9 @@ A screen is a few surfaces, one on another. Each level has its token, and the to On a surface, a fill marks a part of it: `secondary` and `muted` for a button, a badge or a tile, `accent` for the highlighted row of a menu. Each surface and fill has a `-foreground` for the text on it. Every line is `border`, the text color at one strength (10% in light, 12% in dark), so no -line is fainter than another. +line is fainter than another. A field's edge, `input`, is the one exception: 20% in light and 16% +in dark, because a field is filled in the color of the card it sits on and its edge is all that +shows where it is. - **Choose the level by what the thing is,** never by the shade you want. A form is a card. A list of rows sits on the panel, split by lines, with no card. If a card looks wrong where you @@ -204,7 +206,7 @@ A change to a token or a primitive changes every screen, so it lands differently | [`app/tests/color-scheme.test.ts`](../app/tests/color-scheme.test.ts) | No class from Tailwind's palette in a screen. | | [`app/tests/ui-look-guard.test.ts`](../app/tests/ui-look-guard.test.ts) | No corner, shadow, text size, `dark:` color or hand-drawn card of a screen's own. | | [`app/tests/ui-primitives-look.test.ts`](../app/tests/ui-primitives-look.test.ts) | Every primitive keeps the look's corner and shadow steps, a copied shadcn one included. | -| [`app/tests/ui-look-theme.test.ts`](../app/tests/ui-look-theme.test.ts) | The one radius, the icons' line, and every line at one strength. | +| [`app/tests/ui-look-theme.test.ts`](../app/tests/ui-look-theme.test.ts) | The one radius, the icons' line, every line at one strength, and a field's edge at its own. | | [`app/tests/icon-set.test.ts`](../app/tests/icon-set.test.ts) | One icon set in the web app, the extension and OpenBot Desktop, taken from its module. | | [`tokens/tests/slate.test.ts`](../tokens/tests/slate.test.ts) | The grays are one family, in light and in dark. | | [`tokens/tests/contrast.test.ts`](../tokens/tests/contrast.test.ts) | Text reads on the surfaces it is set on (4.5:1) and the focus ring shows (3:1), in light and in dark. | diff --git a/mobile/src/scheme.ts b/mobile/src/scheme.ts index 69e1a20777..935752a6da 100644 --- a/mobile/src/scheme.ts +++ b/mobile/src/scheme.ts @@ -21,7 +21,7 @@ export const scheme = { success: "#12795b", warning: "#a84900", border: "#0103131a", - input: "#0103131a", + input: "#01031333", ring: "#727eef", "chart-1": "#1949c5", "chart-2": "#cd7d04", @@ -57,7 +57,7 @@ export const scheme = { success: "#5fe3bb", warning: "#ffb900", border: "#eef1f31f", - input: "#eef1f31f", + input: "#eef1f329", ring: "#8d97ff", "chart-1": "#3a70ee", "chart-2": "#f79807", diff --git a/tokens/src/scheme.ts b/tokens/src/scheme.ts index 53796c0e94..5d54555125 100644 --- a/tokens/src/scheme.ts +++ b/tokens/src/scheme.ts @@ -82,13 +82,14 @@ const light: Palette = { success: "oklch(0.514 0.1 167.2)", warning: "oklch(0.521 0.143 47.7)", /* - * Every line (`border`, `input`, `sidebar-border`) is the text color at one strength: 10% here, - * 12% in dark. That is about 1.25:1 against a card in light and 1.38:1 in dark, as light as the - * lines in ChatGPT, Claude and Grok. A line is never the only cue of a control: a checkbox's or a - * radio's edge is `muted-foreground` (docs/design-system.md). + * A line (`border`, `sidebar-border`) is the text color at 10% here, 12% in dark: about 1.25:1 + * against a card in light and 1.38:1 in dark, as light as the lines in ChatGPT, Claude and Grok. + * A field's edge (`input`) is the one exception, at 20% here and 16% in dark (about 1.6:1): a + * field sits on a card in the card's own color, so its edge is all that shows where it is. A + * checkbox's or a radio's edge is `muted-foreground` (docs/design-system.md). */ border: "oklch(0.108 0.042 264.7 / 10%)", - input: "oklch(0.108 0.042 264.7 / 10%)", + input: "oklch(0.108 0.042 264.7 / 20%)", ring: "oklch(0.638 0.167 276.1)", /* * The chart series are OpenBot's own hues: the brand blue, warning's amber, success's teal, @@ -138,7 +139,7 @@ const dark: Palette = { success: "oklch(0.832 0.13 170.1)", warning: "oklch(0.828 0.189 84.4)", border: "oklch(0.956 0.004 252 / 12%)", - input: "oklch(0.956 0.004 252 / 12%)", + input: "oklch(0.956 0.004 252 / 16%)", ring: "oklch(0.713 0.151 277.7)", "chart-1": "oklch(0.58 0.2 264)", "chart-2": "oklch(0.76 0.168 66)", From c1b8eb3a88dff14c8f0b4fd6aab2caee38f7567c Mon Sep 17 00:00:00 2001 From: Guido Vizoso Date: Wed, 2 Dec 2026 10:28:55 -0300 Subject: [PATCH 02/10] shadcn's Badge, with a muted and a warning variant beside its own --- app/src/components/ui/badge.tsx | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 app/src/components/ui/badge.tsx diff --git a/app/src/components/ui/badge.tsx b/app/src/components/ui/badge.tsx new file mode 100644 index 0000000000..ec6f5fa28d --- /dev/null +++ b/app/src/components/ui/badge.tsx @@ -0,0 +1,61 @@ +import { mergeProps } from "@base-ui/react/merge-props"; +import { useRender } from "@base-ui/react/use-render"; +import { cva, type VariantProps } from "class-variance-authority"; + +import { cn } from "@/lib/utils"; + +/* + * shadcn's Badge, in its Base UI flavor. Two edits, both to the look (docs/app-guidelines.md): + * the corner is `rounded-full`, the step for round things, where shadcn writes `rounded-4xl`; and + * the `dark:` overrides are gone, since every token already carries its dark value. + * + * `muted` and `warning` are ours, beside shadcn's variants and never in place of one: `muted` for a + * quiet state ("Paused"), `warning` for one that wants a look ("needs review"). + */ +const badgeVariants = cva( + "inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&>svg]:pointer-events-none [&>svg]:size-3!", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80", + secondary: + "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80", + destructive: + "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 [a]:hover:bg-destructive/20", + outline: + "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground", + ghost: "hover:bg-muted hover:text-muted-foreground", + link: "text-primary underline-offset-4 hover:underline", + muted: "bg-muted text-muted-foreground", + warning: "bg-warning/10 text-warning", + }, + }, + defaultVariants: { + variant: "default", + }, + }, +); + +function Badge({ + className, + variant = "default", + render, + ...props +}: useRender.ComponentProps<"span"> & VariantProps) { + return useRender({ + defaultTagName: "span", + props: mergeProps<"span">( + { + className: cn(badgeVariants({ className, variant })), + }, + props, + ), + render, + state: { + slot: "badge", + variant, + }, + }); +} + +export { Badge, badgeVariants }; From 92a824ad8165665e1028509c4d9e9b00c908e951 Mon Sep 17 00:00:00 2001 From: Guido Vizoso Date: Wed, 2 Dec 2026 10:34:49 -0300 Subject: [PATCH 03/10] Desktop's sign-in tab draws with the scheme: no glow, no floating shadow, the card's corner, type on the scale --- desktop/src-tauri/src/connected/sign_in.rs | 44 +++++++++------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/desktop/src-tauri/src/connected/sign_in.rs b/desktop/src-tauri/src/connected/sign_in.rs index 6c3a15d8c4..635922fd5a 100644 --- a/desktop/src-tauri/src/connected/sign_in.rs +++ b/desktop/src-tauri/src/connected/sign_in.rs @@ -1353,12 +1353,13 @@ pub fn end_page_for(ending: Ending) -> String { /** The styles of the tab's page, inline: it is served by this app from 127.0.0.1 and loads nothing. OpenBot's own tokens (written here from `tokens/src/scheme.ts` by `bun run tokens:generate`), in -the sign-in pages' look: the page's background with a soft, still orb glow behind a card with 20px -corners and a lavender shadow, the orb at 76px with its glow at the card's top, OpenBot's name at -the top left, and the card rising in (still when less motion is asked for). The glow stands in for -Home's animated orb field, which needs a script this page does not run. Light and dark follow the -system. Figtree when the computer has it, the system's own face otherwise: a font is a file, and -this page fetches none. +the web app's look (docs/app-guidelines.md, "The look"): the panel's plain background, a card on it +with a hairline border, no shadow and the `--radius` corner (`rounded-lg`), the orb at 76px at the +card's top, OpenBot's name at the top left, type on Tailwind's scale (a 24px heading, 16px text), +and the card rising in (still when less motion is asked for). Home's orb field is the app's one +decoration, so nothing glows behind the card or around the orb. Light and dark follow the system. +Figtree when the computer has it, the system's own face otherwise: a font is a file, and this page +fetches none. */ const END_PAGE_STYLE: &str = r#" :root { @@ -1370,9 +1371,7 @@ const END_PAGE_STYLE: &str = r#" --border: oklch(0.108 0.042 264.7 / 10%); --sidebar: oklch(0.948 0.01 251.8); /* end of tokens/src/scheme.ts */ - --shadow: 0 1px 2px oklch(0.108 0.042 264.7 / 4%), 0 24px 64px -16px oklch(0.45 0.12 276 / 22%); - --glow: oklch(0.82 0.08 285 / 55%); - --glow-2: oklch(0.86 0.07 340 / 35%); + --radius: 0.625rem; color-scheme: light; } @media (prefers-color-scheme: dark) { @@ -1385,9 +1384,6 @@ const END_PAGE_STYLE: &str = r#" --border: oklch(0.956 0.004 252 / 12%); --sidebar: oklch(0.156 0.017 252); /* end of tokens/src/scheme.ts */ - --shadow: 0 1px 2px oklch(0 0 0 / 30%), 0 24px 64px -16px oklch(0 0 0 / 60%); - --glow: oklch(0.45 0.12 280 / 28%); - --glow-2: oklch(0.45 0.13 340 / 16%); color-scheme: dark; } } @@ -1400,13 +1396,10 @@ body { align-items: center; justify-content: center; padding: 72px 16px 48px; - background: - radial-gradient(ellipse 34rem 26rem at 50% 50%, var(--glow), transparent 70%), - radial-gradient(ellipse 22rem 16rem at 58% 62%, var(--glow-2), transparent 70%), - var(--background); + background: var(--background); color: var(--foreground); font-family: "Figtree Variable", "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; - font-size: 15px; + font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; @@ -1417,10 +1410,11 @@ body { left: 24px; display: flex; align-items: center; - gap: 10px; - font-size: 16px; + gap: 8px; + font-size: 0.875rem; + line-height: 1.25rem; font-weight: 600; - letter-spacing: -0.01em; + letter-spacing: -0.025em; } .brand .orb { width: 24px; height: 24px; margin: 0; } main { @@ -1430,8 +1424,7 @@ main { padding: 36px 32px 32px; background: var(--card); border: 1px solid var(--border); - border-radius: 20px; - box-shadow: var(--shadow); + border-radius: var(--radius); text-align: center; animation: rise 700ms cubic-bezier(0.23, 1, 0.32, 1) both; } @@ -1456,7 +1449,6 @@ main { radial-gradient(circle at 62% 38%, var(--c4), transparent 62%); filter: saturate(0.9); } -main .orb { box-shadow: 0 0 28px 4px oklch(70% 0.18 300 / 35%); overflow: visible; } .orb::before { content: ""; position: absolute; @@ -1478,9 +1470,9 @@ main .orb { box-shadow: 0 0 28px 4px oklch(70% 0.18 300 / 35%); overflow: visibl } h1 { margin: 0; - font-size: 1.75rem; - line-height: 1.2; - font-weight: 650; + font-size: 1.5rem; + line-height: 2rem; + font-weight: 600; letter-spacing: -0.025em; text-wrap: balance; } From 74da17bdd400593be848dda242c0640b66c6c647 Mon Sep 17 00:00:00 2001 From: Guido Vizoso Date: Wed, 2 Dec 2026 10:37:01 -0300 Subject: [PATCH 04/10] Add a repository is a screen of its own, and GitHub's page keeps the standard icon tile and gaps --- .../connections/identity-connection-page.tsx | 4 +- .../components/settings/github-sources.tsx | 202 +++++++++--------- .../connections.$key_.repositories.new.tsx | 18 ++ app/tests/github-sources-settings.test.tsx | 75 ++++++- 4 files changed, 192 insertions(+), 107 deletions(-) create mode 100644 app/src/routes/_authed/_app/connections.$key_.repositories.new.tsx diff --git a/app/src/components/connections/identity-connection-page.tsx b/app/src/components/connections/identity-connection-page.tsx index b863332502..26c7520858 100644 --- a/app/src/components/connections/identity-connection-page.tsx +++ b/app/src/components/connections/identity-connection-page.tsx @@ -111,9 +111,9 @@ export function IdentityConnectionPage({ function IdentityMark({ provider }: { provider: LinkableProvider }) { const Icon = providerIcon(provider); return ( - + } + fallback={} logo={identityVendorLogo(provider)} name={linkableProviderTitle(provider)} /> diff --git a/app/src/components/settings/github-sources.tsx b/app/src/components/settings/github-sources.tsx index 2e9d2520f4..be2f98f309 100644 --- a/app/src/components/settings/github-sources.tsx +++ b/app/src/components/settings/github-sources.tsx @@ -1,4 +1,5 @@ import { useMutation, useQuery } from "@tanstack/react-query"; +import { Link, type LinkProps, useNavigate } from "@tanstack/react-router"; import { Fragment, useId, useState } from "react"; import { IconBrandGithub, @@ -7,9 +8,11 @@ import { IconPlus, } from "@/components/icons"; import { + PageCard, PageEmpty, PageRows, PageSection, + PageShell, } from "@/components/layout/page-shell"; import { copyText } from "@/components/settings/linked-accounts"; import { Button } from "@/components/ui/button"; @@ -19,15 +22,11 @@ import { CollapsibleTrigger, } from "@/components/ui/collapsible"; import { - Dialog, - DialogBody, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; -import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"; + Field, + FieldError, + FieldGroup, + FieldLabel, +} from "@/components/ui/field"; import { Input } from "@/components/ui/input"; import { Item, @@ -45,22 +44,37 @@ import { } from "@/lib/responsibilities"; import { queryClient } from "@/query-client"; +/** GitHub's page under Apps, where the repositories are listed. */ +const GITHUB_PAGE = { + to: "/connections/$key", + params: { key: "github" }, +} satisfies LinkProps; + +/** The screen a repository is added on, beside GitHub's page. */ +const ADD_REPOSITORY_PAGE = { + to: "/connections/$key/repositories/new", + params: { key: "github" }, +} satisfies LinkProps; + /** * The repositories whose GitHub events can start this person's responsibilities. One per person, not * per Bot: an event reaches every responsibility subscribed to it, whichever Bot holds it. * * Each repository is a row carrying the webhook address to paste into GitHub. Adding one is two - * inputs, so it is a dialog opened from the section's action. + * inputs, on a screen of its own (`AddGithubRepositoryPage`) opened from the section's action. */ export function GithubSources() { const bindings = useQuery(githubBindingsQueryOptions()); const remove = useMutation(removeGithubBindingMutationOptions(queryClient)); - const [adding, setAdding] = useState(false); const error = bindings.error ?? remove.error; return ( setAdding(true)} size="sm" variant="ghost"> + @@ -78,7 +92,11 @@ export function GithubSources() { 0 ? ( setAdding(true)} size="sm" variant="outline"> + @@ -103,7 +121,6 @@ export function GithubSources() { ))} )} - {adding ? setAdding(false)} /> : null} ); } @@ -114,10 +131,8 @@ export function GithubSources() { */ function HowToSetUp() { return ( - - } - > + + }> How to set up -
    +
    1. Add a repository here, with a webhook secret.
    2. Copy its webhook address.
    3. @@ -206,90 +221,81 @@ function RepositoryRow({ } /** - * A repository and the webhook secret GitHub will sign its events with. + * Adding a repository: the repository and the webhook secret GitHub will sign its events with, on a + * screen of its own reached from GitHub's page, which it returns to once the repository is added. + * + * It was a dialog over GitHub's page. Two fields still make a thing to add, so it has an address and + * a Back button like every other Add screen. */ -function AddRepositoryDialog({ onClose }: { onClose: () => void }) { +export function AddGithubRepositoryPage() { const formId = useId(); + const navigate = useNavigate(); const [repository, setRepository] = useState(""); const [secret, setSecret] = useState(""); const create = useMutation(createGithubBindingMutationOptions(queryClient)); return ( - !next && onClose()} open> - - - Add a repository - - Use the same secret when you add the webhook in GitHub. - - - - {/* The submit button is in the footer and reaches this form by id, so DialogBody stays a - direct child of DialogContent and keeps scrolling. */} -
      { - event.preventDefault(); - create.mutate( - { repository, secret }, - { - onSuccess: () => { - setSecret(""); - setRepository(""); - onClose(); - }, - }, - ); - }} - > - - - - Repository - - setRepository(event.target.value)} - placeholder="owner/repository" - required - value={repository} - /> - - - - Webhook secret - - setSecret(event.target.value)} - required - type="password" - value={secret} - /> - - -
      - {create.error ? ( -

      - {failureSaid(create.error)} -

      - ) : null} -
      - - - - -
      -
      + +
      { + event.preventDefault(); + create.mutate( + { repository, secret }, + { onSuccess: () => navigate(GITHUB_PAGE) }, + ); + }} + > + + + + + } + > + + + + Repository + + setRepository(event.target.value)} + placeholder="owner/repository" + required + value={repository} + /> + + + + Webhook secret + + setSecret(event.target.value)} + required + type="password" + value={secret} + /> + + {create.error ? ( + {failureSaid(create.error)} + ) : null} + + +
      +
      ); } diff --git a/app/src/routes/_authed/_app/connections.$key_.repositories.new.tsx b/app/src/routes/_authed/_app/connections.$key_.repositories.new.tsx new file mode 100644 index 0000000000..9d49d068e6 --- /dev/null +++ b/app/src/routes/_authed/_app/connections.$key_.repositories.new.tsx @@ -0,0 +1,18 @@ +import { createFileRoute, redirect } from "@tanstack/react-router"; +import { AddGithubRepositoryPage } from "@/components/settings/github-sources"; + +/** + * GitHub's page, Add a repository: a repository whose events can start work, on a screen of its + * own beside GitHub's page. Only GitHub has repositories, so any other app's address opens that + * app's own page. + */ +export const Route = createFileRoute( + "/_authed/_app/connections/$key_/repositories/new", +)({ + beforeLoad: ({ params }) => { + if (params.key !== "github") { + throw redirect({ to: "/connections/$key", params: { key: params.key } }); + } + }, + component: AddGithubRepositoryPage, +}); diff --git a/app/tests/github-sources-settings.test.tsx b/app/tests/github-sources-settings.test.tsx index 2c1dd0ea3c..33b743d6bc 100644 --- a/app/tests/github-sources-settings.test.tsx +++ b/app/tests/github-sources-settings.test.tsx @@ -1,13 +1,27 @@ import { afterAll, afterEach, beforeAll, expect, test } from "bun:test"; import { GlobalRegistrator } from "@happy-dom/global-registrator"; import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import { + createMemoryHistory, + createRootRoute, + createRoute, + createRouter, + Outlet, + RouterProvider, +} from "@tanstack/react-router"; import { cleanup, fireEvent, render, waitFor } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; -import { GithubSources } from "@/components/settings/github-sources"; +import { + AddGithubRepositoryPage, + GithubSources, +} from "@/components/settings/github-sources"; import { GITHUB_EVENT_SOURCES_PATH, pathOf } from "./schedules-api"; import { settleReactWork } from "./settle-react-work"; -/** Settings → Connected accounts: the repositories whose events can start a responsibility. */ +/** + * GitHub's page under Apps: the repositories whose events can start a responsibility, and the + * screen of its own a repository is added on. + */ beforeAll(() => GlobalRegistrator.register()); afterEach(cleanup); @@ -60,15 +74,33 @@ function serving() { }) as unknown as typeof fetch; } -function draw() { +/** GitHub's page and its Add a repository screen, at their addresses, opened on `start`. */ +function draw(start = "/connections/github") { const client = new QueryClient({ defaultOptions: { queries: { retry: false } }, }); - return render( + const root = createRootRoute({ component: Outlet }); + const githubPage = createRoute({ + getParentRoute: () => root, + path: "/connections/$key", + component: GithubSources, + }); + const addPage = createRoute({ + getParentRoute: () => root, + path: "/connections/$key/repositories/new", + component: AddGithubRepositoryPage, + }); + const history = createMemoryHistory({ initialEntries: [start] }); + const router = createRouter({ + routeTree: root.addChildren([githubPage, addPage]), + history, + }); + const view = render( - + , ); + return Object.assign(view, { history }); } test("a connected repository copies the webhook address the server answers, to paste into GitHub", async () => { @@ -146,14 +178,27 @@ test("a webhook address that can't be copied is shown, to copy by hand", async ( } }); -test("connecting a repository sends it with its secret", async () => { +test("Add a repository opens a screen of its own, which sends the repository with its secret and goes back", async () => { serving(); const view = draw(); const user = userEvent.setup({ document }); await view.findByText("acme/app"); await user.click(view.getByRole("button", { name: "Add a repository" })); + await waitFor(() => + expect(view.history.location.pathname).toBe( + "/connections/github/repositories/new", + ), + ); + // A screen, not a dialog: a heading of its own and a way back to GitHub's page. + expect(view.queryByRole("dialog")).toBeNull(); + expect( + await view.findByRole("heading", { name: "Add a repository" }), + ).toBeTruthy(); + expect( + view.getByRole("button", { name: "GitHub" }).getAttribute("href"), + ).toBe("/connections/github"); await user.type( - await view.findByRole("textbox", { name: "Repository" }), + view.getByRole("textbox", { name: "Repository" }), "acme/web", ); await user.type(view.getByLabelText("Webhook secret"), "s3cret"); @@ -164,4 +209,20 @@ test("connecting a repository sends it with its secret", async () => { body: { repository: "acme/web", secret: "s3cret" }, }), ); + // Added, it goes back to GitHub's page and its list. + await waitFor(() => + expect(view.history.location.pathname).toBe("/connections/github"), + ); + expect(await view.findByText("acme/app")).toBeTruthy(); +}); + +test("Cancel on Add a repository goes back to GitHub's page without sending anything", async () => { + serving(); + const view = draw("/connections/github/repositories/new"); + const user = userEvent.setup({ document }); + await user.click(await view.findByRole("button", { name: "Cancel" })); + await waitFor(() => + expect(view.history.location.pathname).toBe("/connections/github"), + ); + expect(writes).toEqual([]); }); From 0b99f9c2ed36f4524d29b6c048bbb10d190ad0a9 Mon Sep 17 00:00:00 2001 From: Guido Vizoso Date: Wed, 2 Dec 2026 10:37:21 -0300 Subject: [PATCH 05/10] The trial's Paused and Memory's Needs review are Badges, the avatars aren't faded, and Add a card sits on the right --- app/src/components/memory/memories.tsx | 5 ++- .../organization-settings-page.tsx | 42 ++++++++----------- .../components/plan/card-needed-dialog.tsx | 23 ++++++---- 3 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/src/components/memory/memories.tsx b/app/src/components/memory/memories.tsx index 121ceca4a6..3eaf769f14 100644 --- a/app/src/components/memory/memories.tsx +++ b/app/src/components/memory/memories.tsx @@ -8,6 +8,7 @@ import { PageRows, PageSection, } from "@/components/layout/page-shell"; +import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Dialog, @@ -201,9 +202,9 @@ function dayOf(iso: string, now: Date = new Date()): string | null { /** "Needs review", as a label: the fact waits on the person, so it is drawn in `warning`. */ function NeedsReview() { return ( - + Needs review - + ); } diff --git a/app/src/components/organizations/organization-settings-page.tsx b/app/src/components/organizations/organization-settings-page.tsx index 5f47e28cd9..76947b97af 100644 --- a/app/src/components/organizations/organization-settings-page.tsx +++ b/app/src/components/organizations/organization-settings-page.tsx @@ -234,42 +234,34 @@ function PlanRow() { ) : null} {/* - * An employee admin can pay for the members who aren't employees. Under the bar, not - * beside it, so the bar keeps its width in a narrow window. + * An employee admin can pay for the members who aren't employees. Whole on a phone + * too: a row's description stops at two lines. */} {employeePaysForOthers(plan) && plan.addCardUrl ? ( - <> - {/* Whole on a phone too: a row's description stops at two lines. */} - - {OTHERS_NEED_A_CARD} - - - {cardAction(plan)} - - + + {OTHERS_NEED_A_CARD} + ) : null} - {/* - * Once most of it is used, where the server sent the way to add a card. Under the bar, - * as the employee's button is, so the bar keeps its width in a narrow window. - */} - {trialRunningLow(plan) && plan.addCardUrl ? ( + + {/* + * The way to add a card, where the server sent one: once most of the trial is used, or + * for an employee admin, who can pay for the members who aren't employees. In the row's + * actions, on the right, on a line of their own under the bar, so the bar keeps its width + * in a narrow window. + */} + {(employeePaysForOthers(plan) || trialRunningLow(plan)) && + plan.addCardUrl ? ( + {cardAction(plan)} - ) : null} - + + ) : null} ); diff --git a/app/src/components/plan/card-needed-dialog.tsx b/app/src/components/plan/card-needed-dialog.tsx index ffe1ddeba4..475412173f 100644 --- a/app/src/components/plan/card-needed-dialog.tsx +++ b/app/src/components/plan/card-needed-dialog.tsx @@ -4,6 +4,7 @@ import sentry from "@/assets/sentry.webp"; import { AbstractAvatar } from "@/components/agents/abstract-avatar"; import { IconCheck, IconPlayerPause } from "@/components/icons"; import { PersonAvatar } from "@/components/organizations/person-avatar"; +import { Badge } from "@/components/ui/badge"; import { Button, buttonVariants } from "@/components/ui/button"; import { Dialog, @@ -74,7 +75,7 @@ import { queryClient } from "@/query-client"; /** * Bots can't run until a card is added: the free trial is used up, or the last payment failed. - * Top to bottom: the person's Bots, faded, marked Paused; the title, and a line with the size of + * Top to bottom: the person's Bots, marked Paused; the title, and a line with the size of * the trial the server sent, how many Bots that paused and that nothing is lost; the trial's bar, * full. An admin then gets a plan card (the price and what adding the card does) and the one way * on (`addCardUrl`, the server's verdict on who may add a card) with Not now beside it. A member gets the owners and admins to ask, as rows @@ -217,8 +218,9 @@ export function CardNeededDialog() { const BOTS_SHOWN = 4; /** - * The person's Bots, faded and overlapping, with a Paused pill: what the stop means, shown. Up to - * four, and the rest counted. + * The person's Bots, overlapping, with a Paused badge: what the stop means, shown. Up to four, and + * the rest counted on a circle the size of an avatar. The badge says they are paused, so the + * avatars keep their own colors rather than a faded shade of their own. */ function PausedBots({ bots }: { bots: readonly AgentProfile[] }) { const shown = bots.slice(0, BOTS_SHOWN); @@ -229,7 +231,7 @@ function PausedBots({ bots }: { bots: readonly AgentProfile[] }) { {shown.map((bot, index) => ( 0 && "-ml-2.5", )} key={bot.id} @@ -243,10 +245,10 @@ function PausedBots({ bots }: { bots: readonly AgentProfile[] }) { ) : null} - - + ); } @@ -265,7 +267,7 @@ function PlanCard() { - + {PRICE_AMOUNT} {" "} {PRICE_PER} @@ -316,6 +318,11 @@ function AdminsToAsk({ {shown.map((admin, index) => ( {index > 0 ? : null} + {/* + * Flush with the label above and the dialog's title: every `Item` size pads 10px or more + * in from the sides, and none has no inset. These rows are read, not pressed, so there is + * no hover fill for the padding to make room for. + */} From d2ffdf4b3d9a0a189d85093387a9280ab8943cff Mon Sep 17 00:00:00 2001 From: Guido Vizoso Date: Wed, 2 Dec 2026 10:37:21 -0300 Subject: [PATCH 06/10] Skills: an outline Cancel, a written skill's row links its content with no dead chevron, a 12px gap --- app/src/components/manage/skill-page.tsx | 6 +++--- app/src/components/skills/skills-settings-page.tsx | 9 ++++++--- app/tests/skills-settings-page.test.tsx | 12 ++++++++++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/src/components/manage/skill-page.tsx b/app/src/components/manage/skill-page.tsx index 0b97c49cc9..fab80542ad 100644 --- a/app/src/components/manage/skill-page.tsx +++ b/app/src/components/manage/skill-page.tsx @@ -185,8 +185,7 @@ export function SkillPage({ cancel: ( @@ -220,7 +219,8 @@ export function SkillPage({ description={skillByline(skill, me?.id, paths.edition)} title={skill.title} > -
      + {/* The one-liner and the overview: two blocks of one group, 12px apart (the Rhythm table). */} +
      {skill.summary ?

      {skill.summary}

      : null}
      diff --git a/app/src/components/skills/skills-settings-page.tsx b/app/src/components/skills/skills-settings-page.tsx index e7c9bdbf4f..014c68bd6d 100644 --- a/app/src/components/skills/skills-settings-page.tsx +++ b/app/src/components/skills/skills-settings-page.tsx @@ -102,9 +102,13 @@ export function SkillsSettingsPage({ creating }: { creating: boolean }) { const writtenRow = (skill: Skill) => ( - {/* The row opens the skill's screen; the menu sits beside that link, not inside it. */} + {/* + * The name and summary open the skill's screen. The menu sits beside that link, not inside + * it, so the row can't be one link through `render`, and has no chevron: a chevron outside + * the link would open nothing. + */} @@ -158,7 +162,6 @@ export function SkillsSettingsPage({ creating }: { creating: boolean }) { - ); diff --git a/app/tests/skills-settings-page.test.tsx b/app/tests/skills-settings-page.test.tsx index ed7862acb5..ec4b563902 100644 --- a/app/tests/skills-settings-page.test.tsx +++ b/app/tests/skills-settings-page.test.tsx @@ -280,10 +280,18 @@ test("a skill you wrote opens its own screen, and a workspace skill too", async const yours = section(view, "Your skills"); const written = within(yours).getByText("Weekly report").closest("a"); expect(written?.getAttribute("href")).toBe("/skills/weekly-report"); - // A chevron, as the learned and workspace rows have. + // Its menu sits beside the link, not inside it, and the row has no chevron: one outside the + // link would open nothing. + const row = written?.closest("[data-slot=item]"); expect( - written?.parentElement?.querySelector("[data-slot=item-actions] > svg"), + written?.querySelector('[aria-label="More for Weekly report"]'), + ).toBeNull(); + expect( + row?.querySelector( + '[data-slot=item-actions] [aria-label="More for Weekly report"]', + ), ).toBeTruthy(); + expect(row?.querySelector("[data-slot=item-actions] > svg")).toBeNull(); const workspace = section(view, "Workspace skills"); expect( within(workspace) From 469f05c4a6900bbab803280be45a27539416ef56 Mon Sep 17 00:00:00 2001 From: Guido Vizoso Date: Wed, 2 Dec 2026 10:42:33 -0300 Subject: [PATCH 07/10] Routines: Delete back in the actions card, On back in a row, Edit routine a screen of its own, New routine in one column, All routines on the right --- .../bot-profile/routines-summary.tsx | 21 +- .../components/responsibilities/goal-page.tsx | 91 +++--- app/src/components/routines/bot-group.tsx | 16 +- app/src/components/routines/delete-row.tsx | 6 +- ...utine-dialog.tsx => edit-routine-page.tsx} | 191 ++++++------ .../components/routines/new-routine-page.tsx | 279 +++++++++--------- app/src/components/routines/routine-page.tsx | 129 ++++---- app/src/components/routines/routines-home.tsx | 41 +-- app/src/components/routines/schedule-when.tsx | 5 +- .../components/suggestions/check-in-page.tsx | 67 ++--- .../routines_.schedules.$routineId_.edit.tsx | 23 ++ app/tests/bot-routines-summary.test.tsx | 14 +- app/tests/check-in-row.test.tsx | 12 + app/tests/goal-page-starts.test.tsx | 28 +- app/tests/routine-edit.test.tsx | 134 ++++++--- 15 files changed, 581 insertions(+), 476 deletions(-) rename app/src/components/routines/{edit-routine-dialog.tsx => edit-routine-page.tsx} (73%) create mode 100644 app/src/routes/_authed/_app/routines_.schedules.$routineId_.edit.tsx diff --git a/app/src/components/bot-profile/routines-summary.tsx b/app/src/components/bot-profile/routines-summary.tsx index 8618bfb4b4..c1f5e4266f 100644 --- a/app/src/components/bot-profile/routines-summary.tsx +++ b/app/src/components/bot-profile/routines-summary.tsx @@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query"; import { Link } from "@tanstack/react-router"; import { Fragment } from "react"; import { PageRows, PageSection } from "@/components/layout/page-shell"; -import { RoutineRow, routineCount } from "@/components/routines/routine-row"; +import { RoutineRow } from "@/components/routines/routine-row"; import { Button } from "@/components/ui/button"; import { Separator } from "@/components/ui/separator"; import { loadFailure } from "@/lib/load-failure"; @@ -47,10 +47,15 @@ export function BotRoutinesSummary({ agentId }: { agentId: string }) { return ( - {routineCount(listed.length)} - + } + count={listed.length} title="Routines" > {/* One read failing leaves the others listed, and says so. */} @@ -76,14 +81,6 @@ export function BotRoutinesSummary({ agentId }: { agentId: string }) { Every goal this Bot had is completed.

      )} -
      ); } diff --git a/app/src/components/responsibilities/goal-page.tsx b/app/src/components/responsibilities/goal-page.tsx index 90640ff4ef..195855a58b 100644 --- a/app/src/components/responsibilities/goal-page.tsx +++ b/app/src/components/responsibilities/goal-page.tsx @@ -262,45 +262,41 @@ export function GoalPage({ return ( - - action.mutate({ - id: goal.id, - action: active ? "resume" : "pause", - }) - } - /> - -
      - ) - } - description={ - <> - - {summaryFor(goal, triggers.data, routines)} - - {/* What starts it. A paused goal's summary already says nothing does. */} - {goal.status === "active" ? ( - {`Its ${starters} start it.`} - ) : null} - - } + description={summaryFor(goal, triggers.data, routines)} title={goal.title} > - {/* What else can be done to it. The page title names it, so this first section has no heading. */} + {/* What can be done to it now. The page title names it, so this first section has no heading. */} + {goal.status !== "completed" ? ( + <> + + + On + + {goal.status === "active" + ? `Its ${starters} start it.` + : `Paused. Its ${starters} won't start it.`} + + + + {/* Binary and immediate: it takes effect when switched, there is no save. */} + + action.mutate({ + id: goal.id, + action: active ? "resume" : "pause", + }) + } + /> + + + + + ) : null} {goal.status === "active" ? ( <>
      + + { + remove.reset(); + setConfirmingDelete(true); + }} + title="Delete goal" + /> {action.error ? (

      @@ -528,21 +534,6 @@ export function GoalPage({ - {/* Away from the everyday controls, at the bottom. */} - - - { - remove.reset(); - setConfirmingDelete(true); - }} - title="Delete goal" - /> - - -

      diff --git a/app/src/components/routines/bot-group.tsx b/app/src/components/routines/bot-group.tsx index d75de32942..b373694ba4 100644 --- a/app/src/components/routines/bot-group.tsx +++ b/app/src/components/routines/bot-group.tsx @@ -33,15 +33,19 @@ function useGroupName(group: BotGroup): string { } /** - * One Bot's routines on the Routines page: the Bot's orb, name and how many it has, then its rows in - * one card. The name opens the Bot's own Routines page, except for a Bot no list knows, which has none. + * One Bot's routines on the Routines page: the Bot's orb, name and how many it has, then its rows. + * The name opens the Bot's own Routines page, except for a Bot no list knows, which has none. + * + * A section of the page, spaced as `PageSection` spaces one (48px above it) and its rows under the + * label as `PageRows` puts them. Not a `PageSection` itself: its title is text only, and this one + * leads with the Bot's orb and links its name. */ export function BotGroupSection({ group }: { group: BotGroup }) { const name = useGroupName(group); return ( - // Spaced with padding, not margin: the group's height opens and folds, and a margin outside it - // would jump. -
      + // The margin is inside the group's `Unfold`, which clips while it moves, so it opens and folds + // with the group. +
      {group.known ? ( @@ -57,7 +61,7 @@ export function BotGroupSection({ group }: { group: BotGroup }) { )} {routineCount(group.rows.length)}
      - + {/* A routine made or removed while the page is open opens or folds; the rest just appear. */} {group.rows.map((row, index) => ( diff --git a/app/src/components/routines/delete-row.tsx b/app/src/components/routines/delete-row.tsx index f10efb22a4..b7bafd97ac 100644 --- a/app/src/components/routines/delete-row.tsx +++ b/app/src/components/routines/delete-row.tsx @@ -6,9 +6,9 @@ import { } from "@/components/ui/item"; /** - * Delete a goal, a schedule or a check-in, after a confirmation the page opens. A row in a card of - * its own, in the last section of the page: away from the everyday controls, so it is never pressed - * on the way to Run now, and still a row, never a button left on its own under the page. + * The last row of a goal's, a schedule's or a check-in's actions card: delete it, after a + * confirmation the page opens. A row in the card with the page's other actions, never a button left + * on its own under the page, which reads as something that fell out of the layout. */ export function DeleteRow({ title, diff --git a/app/src/components/routines/edit-routine-dialog.tsx b/app/src/components/routines/edit-routine-page.tsx similarity index 73% rename from app/src/components/routines/edit-routine-dialog.tsx rename to app/src/components/routines/edit-routine-page.tsx index 345bb07b45..06e52e4024 100644 --- a/app/src/components/routines/edit-routine-dialog.tsx +++ b/app/src/components/routines/edit-routine-page.tsx @@ -1,6 +1,11 @@ import { useSelector } from "@tanstack/react-form"; -import { useMutation } from "@tanstack/react-query"; -import { useEffect, useId, useRef, useState } from "react"; +import { useMutation, useQuery } from "@tanstack/react-query"; +import { Link, linkOptions, useNavigate } from "@tanstack/react-router"; +import { useEffect, useRef, useState } from "react"; +import { IconCalendarTime } from "@/components/icons"; +import { PageCard, PageShell } from "@/components/layout/page-shell"; +import { routinesOf } from "@/components/routines/new-routine-page"; +import { RoutineDetailMissing } from "@/components/routines/routine-detail-missing"; import { ScheduleWhen, useRoutineForm, @@ -14,15 +19,6 @@ import { ComboboxItem, ComboboxList, } from "@/components/ui/combobox"; -import { - Dialog, - DialogBody, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; import { Field, FieldDescription, @@ -33,6 +29,7 @@ import { import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; import type { UpdateRoutineRequest } from "@/lib/api/generated/model"; +import { failureSaid } from "@/lib/load-failure"; import { browserTimeZone, cronFrom, @@ -42,17 +39,19 @@ import { scheduleFrom, } from "@/lib/routines/form"; import { updateRoutineMutationOptions } from "@/lib/routines/mutations"; -import type { RoutineRecord } from "@/lib/routines/queries"; +import { + type RoutineRecord, + routinesQueryOptions, +} from "@/lib/routines/queries"; import { queryClient } from "@/query-client"; -import { failureSaid } from "@/lib/load-failure"; -/** The fields this dialog draws, each with the first rule its answer breaks. */ +/** The fields this page draws, each with the first rule its answer breaks. */ type Edited = "title" | "instruction" | "time"; type Messages = Partial>; const EDITED: readonly Edited[] = ["title", "instruction", "time"]; -/** The rules New routine holds a routine on, for the fields this dialog draws. */ +/** The rules New routine holds a routine on, for the fields this page draws. */ function brokenRules(values: RoutineFormValues): Messages { const messages: Messages = {}; const parsed = routineFormSchema.safeParse(values); @@ -75,7 +74,7 @@ function sameMessages(a: Messages, b: Messages): boolean { /** * Every time zone the browser knows, with the routine's own and the person's first. A zone the * browser doesn't list (an older alias the routine was saved with) is still offered, so opening the - * dialog never changes it. + * page never changes it. */ function timeZones(current: string): string[] { let known: string[] = []; @@ -88,54 +87,60 @@ function timeZones(current: string): string[] { } /** - * Edit routine: its name, what the Bot does, when it runs and the time zone that's read in. The same - * fields and the same schedule picker as New routine, prefilled with what it is now. Saving changes - * only what was changed, and the routine keeps its id, its conversation and its runs. + * Edit routine at `/routines/schedules/$routineId/edit`, reached from Edit on the routine's page. It + * was a dialog over that page; more than one value is edited, so it is a screen of its own. * - * A schedule the picker can't express (a Bot wrote "every other Tuesday") is offered first, by the - * words its row uses, and kept unless another is picked. A routine that runs a goal does what its - * goal says, so it has no What to do here. + * Read from the routines list, as the routine's page is. `agentId` is the Bot whose Routines page it + * came from, kept on the way back to the routine so the routine's own back link still returns there. */ -export function EditRoutineDialog({ - routine, - open, - onOpenChange, +export function EditRoutineRoutePage({ + routineId, + agentId, }: { - routine: RoutineRecord; - open: boolean; - onOpenChange: (open: boolean) => void; + routineId: string; + agentId?: string; }) { + const routines = useQuery(routinesQueryOptions()); + const routine = routines.data?.routines.find((row) => row.id === routineId); + if (!routine) + return ( + + ); return ( - - - - Edit routine - - It keeps its runs and its conversation. - - - {/* Mounted per opening, so each one starts from the routine as it is now. */} - {open ? ( - onOpenChange(false)} - routine={routine} - /> - ) : null} - - + ); } -function EditRoutineForm({ +/** + * Edit routine: its name, what the Bot does, when it runs and the time zone that's read in. The same + * fields and the same schedule picker as New routine, prefilled with what it is now, in one card. + * Saving changes only what was changed, and the routine keeps its id, its conversation and its runs. + * Save and Cancel both return to the routine's page. + * + * A schedule the picker can't express (a Bot wrote "every other Tuesday") is offered first, by the + * words its row uses, and kept unless another is picked. A routine that runs a goal does what its + * goal says, so it has no What to do here. + */ +export function EditRoutinePage({ routine, - onDone, + agentId, }: { routine: RoutineRecord; - onDone: () => void; + agentId?: string; }) { - const formId = useId(); + const navigate = useNavigate(); + const toRoutine = linkOptions({ + to: "/routines/schedules/$routineId", + params: { routineId: routine.id }, + search: agentId ? { agentId } : {}, + }); const update = useMutation(updateRoutineMutationOptions(queryClient)); - // Taken once, when the dialog opened: a refetch landing while it is open must not reset the answers. + // Taken once, when the page opened: a refetch landing while it is open must not reset the answers. const [opened] = useState(() => { const schedule = scheduleFrom(routine.cron); return { @@ -154,6 +159,7 @@ function EditRoutineForm({ const [timeZone, setTimeZone] = useState(routine.timezone); const [zones] = useState(() => timeZones(routine.timezone)); const runsGoal = routine.goalId !== null; + const done = () => navigate(toRoutine); const form = useRoutineForm(opened.values, async (value) => { if (Object.keys(brokenRules(value)).length > 0) return; @@ -168,18 +174,18 @@ function EditRoutineForm({ if (cron !== routine.cron) changes.cron = cron; } if (timeZone !== routine.timezone) changes.timezone = timeZone; - // Nothing changed is not a save: close as Cancel would. + // Nothing changed is not a save: go back as Cancel would. if (Object.keys(changes).length === 0) { - onDone(); + await done(); return; } try { await update.mutateAsync({ id: routine.id, changes }); } catch { - // Said under the fields, from `update.error`. Staying open says it wasn't saved. + // Said under the fields, from `update.error`. Staying here says it wasn't saved. return; } - onDone(); + await done(); }); // A message shows once its field was worked on, or on every field once Save was pressed. @@ -212,16 +218,40 @@ function EditRoutineForm({ const saving = update.isPending; return ( - <> - -
      { - event.preventDefault(); - if (!saving) void form.handleSubmit(); - }} - ref={formRef} + + { + event.preventDefault(); + if (!saving) void form.handleSubmit(); + }} + ref={formRef} + > + + {saving ? ( + + ) : ( + + )} + + + } > @@ -350,28 +380,15 @@ function EditRoutineForm({ The schedule's times are read in this time zone. + + {update.error ? ( +

      + {failureSaid(update.error)} +

      + ) : null}
      - - {update.error ? ( -

      - {failureSaid(update.error)} -

      - ) : null} -
      - - - - - + + + ); } diff --git a/app/src/components/routines/new-routine-page.tsx b/app/src/components/routines/new-routine-page.tsx index b406175cb6..a1f1feac0f 100644 --- a/app/src/components/routines/new-routine-page.tsx +++ b/app/src/components/routines/new-routine-page.tsx @@ -40,10 +40,12 @@ import { channelListQueryOptions, } from "@/lib/channels/queries"; import { deploymentCapabilitiesQueryOptions } from "@/lib/deployment/queries"; +import { failureSaid } from "@/lib/load-failure"; import { proactiveAllowedQueryOptions, proactiveSettingsQueryOptions, } from "@/lib/proactive"; +import { draftValues } from "@/lib/routines/draft"; import { browserTimeZone, DOES, @@ -54,7 +56,6 @@ import { type RoutineFormValues, STARTS, } from "@/lib/routines/form"; -import { draftValues } from "@/lib/routines/draft"; import { CHECK_IN_INTERVALS } from "@/lib/routines/merged"; import { createFromPlanMutationOptions, @@ -68,8 +69,6 @@ import { } from "@/lib/routines/rules"; import { openingOf } from "@/lib/voice/cut"; import { queryClient } from "@/query-client"; -import { failureSaid } from "@/lib/load-failure"; -import { cn } from "@/lib/utils"; /** The conversations a routine for this Bot may post in: live ones the Bot is in. */ function conversationsWith( @@ -297,11 +296,7 @@ export function NewRoutinePage({ onValueChange={(value) => field.handleChange(value as Starts)} value={field.state.value} > - + @@ -389,9 +384,9 @@ export function NewRoutinePage({ }} > {/* - * One card, labels straight above their fields, so the whole form and its Create button fit - * a laptop window: who and how, what to do, when, as one line of compact controls. What most - * routines leave alone (when it's done, where it posts, its name) is behind Advanced settings. + * One card, its fields in a single column with labels straight above them: the Bot, what it + * should do, what to do, when it starts and what that start needs. What most routines leave + * alone (when it's done, where it posts, its name) is behind Advanced settings. */} @@ -400,13 +395,9 @@ export function NewRoutinePage({ // Not drawn without check-ins: a picker with only Act for you asks nothing. Still // drawn for an Only tell you picked before an admin turned them off, to say so. const asksDoes = allowed || does === "tell"; + // Stacked, one field under another, as every form's fields are. return ( -
      + <> {(field) => { const isInvalid = field.name in shown; @@ -536,7 +527,7 @@ export function NewRoutinePage({ }} ) : null} -
      + ); }} @@ -573,8 +564,9 @@ export function NewRoutinePage({ }} - {/* When, as one line: Starts, then what that start needs. Only tell you has no start of - its own, only how often it looks. */} + {/* Starts, then under it what that start needs: the schedule, as one line of controls + because it is one answer, or the event. Only tell you has no start of its own, only + how often it looks. */} [ state.values.does, @@ -618,21 +610,24 @@ export function NewRoutinePage({ )} - ) : starts === "schedule" ? ( - // The time is the browser's own, so its zone goes unsaid: it is the reader's. - ) : ( - - When -
      + <> + + Starts {startsSelect} - {starts === "event" ? ( - <> + + {starts === "schedule" ? ( + // The time is the browser's own, so its zone goes unsaid: it is the reader's. + + ) : starts === "event" ? ( + // Where it comes from and what it is, on one line: together they name one event. + + Event +
      {(field) => ( - field.handleChange(String(value)) - } - value={ - field.state.value in items - ? field.state.value - : NEW_CONVERSATION - } + state.values.agentId}> + {(agentId) => { + const shared = conversationsWith(channels.data, agentId); + // The conversation the clock was pressed in, second and called what it is + // to the person who just left it, even when it is past the roster's first + // page. The server still checks the Bot is in it. + const here = + presetChannelId && agentId === presetAgentId + ? { [presetChannelId]: "This conversation" } + : {}; + const items: Record = { + [NEW_CONVERSATION]: "A new conversation", + ...here, + ...Object.fromEntries( + shared.map((channel) => [ + channel.id, + conversationName(channel), + ]), + ), + ...here, + }; + const choices = Object.entries(items); + return ( + + {(field) => ( + + + Posts in + + - - )} - - ); - }} - + + + + + {choices.map(([value, label]) => ( + + {label} + + ))} + + + + + )} + + ); + }} + - - {(field) => { - const isInvalid = field.name in shown; - return ( - - Name - - field.handleChange(event.target.value) - } - placeholder="Morning leads" - value={field.state.value} - /> - {isInvalid ? ( - - {shown[field.name]} - - ) : null} - - ); - }} - -
      + + {(field) => { + const isInvalid = field.name in shown; + return ( + + Name + + field.handleChange(event.target.value) + } + placeholder="Morning leads" + value={field.state.value} + /> + {isInvalid ? ( + + {shown[field.name]} + + ) : null} + + ); + }} + diff --git a/app/src/components/routines/routine-page.tsx b/app/src/components/routines/routine-page.tsx index efd8d6849e..ab759a2e28 100644 --- a/app/src/components/routines/routine-page.tsx +++ b/app/src/components/routines/routine-page.tsx @@ -11,13 +11,11 @@ import { } from "@/components/icons"; import { LoadingRows } from "@/components/layout/loading-rows"; import { - PageCard, PageRows, PageSection, PageShell, } from "@/components/layout/page-shell"; import { DeleteRow } from "@/components/routines/delete-row"; -import { EditRoutineDialog } from "@/components/routines/edit-routine-dialog"; import { routinesOf } from "@/components/routines/new-routine-page"; import { RoutineDetailMissing, @@ -238,6 +236,7 @@ export function RoutineRoutePage({ const botName = listed ?? alone.data?.name; return ( - {/* Binary and immediate: it takes effect when switched, there is no save. */} - - setEnabled.mutate({ id: routine.id, enabled }) - } - /> - - {/* More than one value, so a dialog: the same fields New routine asks for. */} - -
      + // More than one value, so a screen of its own: the same fields New routine asks for. + } backButton={{ label: "Routines", linkProps: back }} description={ @@ -354,15 +343,42 @@ export function RoutinePage({ > {/* What it does, word for word: New routine's What to do. */} - -

      {does}

      -
      + + + + + {does} + + + +
      - {/* What can be done with it besides switching and editing. The page title names it, so this - section has no heading. */} + {/* What can be done to it now. The page title names it, so this section has no heading. */} + + + On + + {routine.enabled + ? "It runs on its schedule." + : "Paused. It won't run on its schedule."} + + + + {/* Binary and immediate: it takes effect when switched, there is no save. */} + + setEnabled.mutate({ id: routine.id, enabled }) + } + /> + + + ) : null} + + { + remove.reset(); + setConfirming(true); + }} + title="Delete routine" + /> {setEnabled.error || runNow.error ? (

      @@ -494,27 +520,6 @@ export function RoutinePage({ - {/* Away from the everyday controls, at the bottom, as Delete is on every other settings page. */} - - - { - remove.reset(); - setConfirming(true); - }} - title="Delete routine" - /> - - - - - {/* It names the routine as its heading and its row do, never its schedule, which two can share. */}

      diff --git a/app/src/components/routines/routines-home.tsx b/app/src/components/routines/routines-home.tsx index 6a129f76ce..b91874f741 100644 --- a/app/src/components/routines/routines-home.tsx +++ b/app/src/components/routines/routines-home.tsx @@ -1,7 +1,7 @@ import { useQuery } from "@tanstack/react-query"; import { AnimatePresence } from "motion/react"; import { LoadingRows } from "@/components/layout/loading-rows"; -import { PageShell } from "@/components/layout/page-shell"; +import { PageSection, PageShell } from "@/components/layout/page-shell"; import { BotGroupSection } from "@/components/routines/bot-group"; import { RoutineBox } from "@/components/routines/routine-box"; import { Unfold } from "@/components/routines/unfold"; @@ -71,10 +71,10 @@ export function RoutinesHome() { examples={empty ? EXAMPLES : undefined} /> -
      - {/* One read failing leaves the others listed, and says which part is missing. */} - {failed.length > 0 ? ( -

      + {/* One read failing leaves the others listed, and says which part is missing. */} + {failed.length > 0 ? ( + +

      {loadFailure( [ routines.error, @@ -86,21 +86,24 @@ export function RoutinesHome() { `Couldn't load your ${failed.join(" and ")}. Try again in a moment.`, )}

      - ) : null} - {/* Pending draws the list's shape; rows already read stay while they refetch. */} - {pending ? ( + + ) : null} + {/* Pending draws the list's shape; rows already read stay while they refetch. Each Bot's group + is a section of the page, 48px under what is above it. */} + {pending ? ( + - ) : ( - // A Bot's first routine opens its group; its last one removed folds it away. - - {groups.map((group) => ( - - - - ))} - - )} -
      +
      + ) : ( + // A Bot's first routine opens its group; its last one removed folds it away. + + {groups.map((group) => ( + + + + ))} + + )} ); } diff --git a/app/src/components/routines/schedule-when.tsx b/app/src/components/routines/schedule-when.tsx index fea1eb95c4..d4ef085a04 100644 --- a/app/src/components/routines/schedule-when.tsx +++ b/app/src/components/routines/schedule-when.tsx @@ -67,7 +67,6 @@ export function ScheduleWhen({ describe, keep, label = "When", - lead, }: { form: RoutineForm; /** The picker's label: When on New routine, Schedule where it changes one. */ @@ -77,8 +76,6 @@ export function ScheduleWhen({ timeError?: string; /** What follows the sentence under the picker: where the time is read, and anything else to say. */ describe?: ReactNode; - /** A control drawn first on the picker's line, as New routine's Starts is. */ - lead?: ReactNode; keep?: { /** The schedule as its row says it. */ words: string; @@ -93,8 +90,8 @@ export function ScheduleWhen({ return ( {label} + {/* One line of controls: how often, the day and the time are one answer. */}
      - {lead} {(field) => ( - setDraft({ ...draft, providerId: event.target.value }) - } - placeholder="acme-okta" - required - value={draft.providerId} - /> -
      - -
      - - - setDraft({ ...draft, domain: event.target.value }) - } - placeholder="acme.com" - required - value={draft.domain} - /> - {/* Said out loud because it is the field that decides who this applies to. */} -

      - {words.domainHelp} -

      -
      - -
      - - - setDraft({ ...draft, issuer: event.target.value }) - } - placeholder="https://acme.okta.com" - required - type="url" - value={draft.issuer} - /> -
      - - {draft.protocol === "saml" ? ( - <> -
      - - - setDraft({ ...draft, entryPoint: event.target.value }) - } - placeholder="https://acme.okta.com/app/.../sso/saml" - required - type="url" - value={draft.entryPoint} - /> -
      -
      - -