fix(app): unify dialog styles (#64216)

This commit is contained in:
Aarav Sareen
2026-11-16 18:42:40 +05:30
committed by GitHub
Unverified
parent a4c9642cf9
commit 56625a3e1f
18 changed files with 204 additions and 103 deletions
@@ -120,7 +120,7 @@ test("titlebar search lists recent sessions and opens the typed match", async ({
const input = dialog.getByRole("combobox")
await expect(input).toBeFocused()
await expect(input).toHaveAttribute("placeholder", "Search sessions")
await expect(dialog.getByText("Recent sessions", { exact: true })).toBeVisible()
await expect(dialog.getByText("Recent sessions", { exact: true })).toBeHidden()
await expect(dialog.getByRole("option", { name: /Palette fixture session/ })).toHaveAttribute("aria-selected", "true")
// Session search lists sessions only, never commands.
await input.fill("settings")
+23 -11
View File
@@ -1133,7 +1133,10 @@ test("the location dialog separates added projects from server projects and tags
const rows = options.filter({ has: page.locator(".new-session-location-name") })
const names = options.locator(".new-session-location-name")
const paths = options.locator(".command-palette-description")
const back = dialog.getByRole("button", { name: "Back to projects", exact: true })
const back = dialog.locator(".new-session-location-back")
const arrow = dialog.locator(".new-session-location-search-back")
const leading = dialog.locator("[data-slot='text-input-v2-leading-icon']")
const input = dialog.locator("[data-slot='text-input-v2-input']")
// Only the projects added to this client open expanded; other ready-server projects remain discoverable.
await expect(names).toHaveText(["opencodeapollo", "opencode"])
await expect(paths).toHaveText(["/home/dax/opencode", "C:/work/opencode"])
@@ -1150,8 +1153,8 @@ test("the location dialog separates added projects from server projects and tags
// It opens on the first row, not on the draft's current project (the second row).
await expect(options.nth(0)).toHaveAttribute("aria-selected", "true")
// The picker shares the palette's full-width search, compact rows, and single-line titles.
await expect(options.nth(0)).toHaveCSS("height", "28px")
// The picker shares the palette's full-width search, 32px rows, and single-line titles.
await expect(options.nth(0)).toHaveCSS("height", "32px")
await expect(dialog.locator(".palette-menu-search [data-component='text-input-v2']")).toHaveCSS("height", "28px")
await expect(dialog.locator(".new-session-location-hints")).toHaveCount(0)
await expect(dialog.locator("..")).toHaveCSS("width", "720px")
@@ -1174,12 +1177,23 @@ test("the location dialog separates added projects from server projects and tags
})
.toBeLessThanOrEqual(1)
await expect(arrow).toHaveCount(0)
const leadingBox = await leading.boundingBox()
const inputBox = await input.boundingBox()
await others.click()
await expect(names).toHaveText(["console", "sstapollo"])
await expect(back).toHaveCount(0)
await expect(arrow).toBeVisible()
await expect(search).toHaveAttribute("placeholder", "Search other projects")
expect(await leading.boundingBox()).toEqual(leadingBox)
expect(await input.boundingBox()).toEqual(inputBox)
await arrow.click()
await expect(names).toHaveText(["opencodeapollo", "opencode"])
await expect(search).toBeFocused()
await others.click()
await expect(names).toHaveText(["console", "sstapollo"])
await expect(back).toHaveText("Other projects")
await search.fill("no-project-matches")
await expect(options).toHaveCount(0)
await expect(back).toBeVisible()
await search.fill("")
await expect(names).toHaveText(["console", "sstapollo"])
await search.press("ArrowLeft")
@@ -1191,9 +1205,6 @@ test("the location dialog separates added projects from server projects and tags
await expect(names).toHaveText(["console", "sstapollo"])
await search.press("Escape")
await expect(names).toHaveText(["opencodeapollo", "opencode"])
await others.click()
await back.click()
await expect(names).toHaveText(["opencodeapollo", "opencode"])
await search.fill("apollo")
await expect(names).toHaveText(["opencodeapollo", "sstapollo"])
@@ -1225,7 +1236,8 @@ test("the location dialog separates added projects from server projects and tags
const open = (await page.evaluate(() => navigator.platform.includes("Mac"))) ? "Meta+o" : "Control+o"
await search.fill("open")
await page.keyboard.press(open)
await expect(back).toHaveText("Servers")
await expect(back).toHaveCount(0)
await expect(search).toHaveAttribute("placeholder", "Search servers")
await expect(search).toHaveValue("")
await page.keyboard.press("Escape")
await expect(back).toHaveText("Run session in")
@@ -1249,10 +1261,10 @@ test("the location dialog separates added projects from server projects and tags
await page.keyboard.press("ArrowUp")
await expect(options.nth(3)).toHaveAttribute("aria-selected", "true")
await page.keyboard.press(open)
await expect(back).toHaveText("Servers")
await expect(back).toHaveCount(0)
// The server the app runs beside shows its hostname and "This computer" instead of its address.
await expect(options).toHaveText(["hailmaryThis computer", "apollo"])
await back.click()
await search.press("Escape")
await options.filter({ hasText: "Add project" }).click()
await expect(options).toHaveText(["hailmaryThis computer", "apollo"])
await options.filter({ hasText: "apollo" }).click()
@@ -16,24 +16,36 @@
padding-inline-start: 6px;
}
/* The negative margin cancels the padding, so the button takes the icon's space. */
.new-session-location-search-back {
display: flex;
align-items: center;
justify-content: center;
margin: -4px;
padding: 4px;
border: 0;
border-radius: 4px;
background: transparent;
color: inherit;
cursor: default;
&:is(:hover, :focus-visible) {
background: var(--v2-overlay-simple-overlay-hover);
outline: none;
}
}
.new-session-location .palette-menu-search [data-slot="text-input-v2-input"]::placeholder {
color: var(--v2-text-text-base);
opacity: 0.5;
}
.new-session-location-divider {
position: relative;
height: 9px;
height: 1px;
flex-shrink: 0;
margin-block: 4px;
}
.new-session-location-divider::after {
position: absolute;
inset-inline: 0;
top: 4px;
border-top: 0.5px solid var(--v2-border-border-base);
content: "";
margin-block: 6px 2px;
background: var(--v2-border-border-base);
transform: scaleY(0.5);
}
.new-session-location .command-palette-results {
@@ -42,7 +54,11 @@
}
.new-session-location .command-palette-group {
gap: 4px;
gap: 2px;
}
.new-session-location .command-palette-group:not(:has(> .command-palette-group-title:first-child)) {
padding-top: 4px;
}
.new-session-location-action-divider {
@@ -50,19 +66,20 @@
flex-shrink: 0;
margin-block: 2px;
margin-inline: -6px;
background: var(--v2-border-border-muted);
background: var(--v2-border-border-base);
transform: scaleY(0.5);
}
.new-session-location .command-palette-group-title {
display: flex;
height: 28px;
flex-shrink: 0;
align-items: center;
margin: 0;
padding: 0 6px;
color: var(--v2-text-text-muted);
line-height: var(--line-height-compact);
padding: 10px 8px 2px;
color: var(--v2-text-text-faint);
font-size: 12px;
line-height: 18px;
letter-spacing: 0.05px;
}
.new-session-location-back {
@@ -81,7 +98,12 @@
}
.new-session-location .palette-menu-row[data-size="compact"] {
padding-inline: 6px;
height: 32px;
padding-inline: 8px 6px;
}
.new-session-location .palette-menu-title {
font-weight: 440;
}
.new-session-location .palette-menu-row:is([data-active], :focus-visible) {
@@ -12,6 +12,7 @@ import {
ProjectAvatar,
} from "@opencode/ui/project-avatar"
import { TextInput } from "@opencode/ui/text-input"
import { Tooltip } from "@opencode/ui/tooltip"
import { createTypeahead } from "@opencode/ui/typeahead"
import { createEventListener } from "@solid-primitives/event-listener"
import { getFilename } from "@opencode/util/path"
@@ -494,7 +495,21 @@ function NewSessionLocationDialog(props: {
appearance="large"
aria-label={placeholder()}
placeholder={placeholder()}
leadingIcon={<Icon name="magnifying-glass" />}
leadingIcon={
<Show when={view().ownsEscape && !view().titleKey} fallback={<Icon name="magnifying-glass" />}>
<Tooltip value={language.t("session.new.location.back")} placement="bottom-start">
<button
type="button"
class="new-session-location-search-back"
aria-label={language.t("session.new.location.back")}
onMouseDown={(event) => event.preventDefault()}
onClick={back}
>
<Icon name="arrow-left" />
</button>
</Tooltip>
</Show>
}
role="combobox"
aria-expanded="true"
aria-busy={step().type === "branches" && selectBranchBusy(picker()) ? "true" : undefined}
@@ -289,15 +289,15 @@ export function locationDialogView(state: LocationDialogState) {
case "others":
return {
drilled: undefined,
titleKey: "session.new.location.otherProjects",
placeholderKey: "session.new.project.search",
titleKey: undefined,
placeholderKey: "session.new.project.other.search",
ownsEscape: true,
otherGroupHeader: false,
} as const
case "servers":
return {
drilled: undefined,
titleKey: "session.new.location.servers",
titleKey: undefined,
placeholderKey: "session.new.location.servers.search",
ownsEscape: true,
otherGroupHeader: false,
@@ -110,6 +110,7 @@ export const DialogConnectProvider: Component<{
size="normal"
fit
anchored
containerClass="!bg-v2-background-bg-base"
preventBackdropDismiss={view().preventBackdropDismiss}
onCloseAutoFocus={(event) => {
if (view().completed && props.selection && props.onDone) {
@@ -53,7 +53,7 @@
&::after {
height: 1px;
margin-inline: -6px;
background: var(--v2-border-border-muted);
background: var(--v2-border-border-base);
content: "";
transform: scaleY(0.5);
}
@@ -99,7 +99,7 @@
}
[data-component="search-list"] [data-slot="search-list-results"] {
gap: 4px;
gap: 2px;
padding: 0 6px 6px;
}
@@ -118,7 +118,7 @@
[data-component="search-list"] [data-slot="search-list-header"] {
height: auto;
padding-block: 16px 2px;
padding-inline: 34px 6px;
padding-inline: 36px 6px;
background: var(--v2-background-bg-base);
color: var(--v2-text-text-faint);
font-size: 12px;
@@ -170,8 +170,8 @@
[data-component="search-list"] [data-slot="search-list-row"] {
justify-content: flex-start;
gap: 6px;
height: 28px;
padding-inline: 6px 3px;
height: 32px;
padding-inline: 8px 3px;
border-radius: 6px;
font-size: 13px;
font-weight: 440;
+1
View File
@@ -722,6 +722,7 @@ export const dict = {
"session.new.project.new": "New project",
"session.new.project.search": "Search projects",
"session.new.project.other.search": "Search other projects",
"session.new.project.add": "Add project",
"session.new.project.trigger.tooltip": "Choose project",
"session.new.worktree.creating": "Creating worktree",
@@ -205,6 +205,8 @@ export function DialogServer(props: {
<ConnectMethodSwitch
method={view().draft.method}
disabled={view().disabled}
align="start"
class="-mt-4"
onChange={(method) => form.dispatch({ type: "method.changed", method })}
/>
</div>
+4 -1
View File
@@ -7,6 +7,8 @@ export type ConnectMethod = "link" | "password"
export function ConnectMethodSwitch(props: {
method: ConnectMethod
disabled?: boolean
align?: "start" | "center"
class?: string
onChange: (method: ConnectMethod) => void
}) {
const language = useLanguage()
@@ -15,7 +17,8 @@ export function ConnectMethodSwitch(props: {
return (
<div
data-component="server-connect-method"
class="flex min-h-7 flex-wrap items-center justify-center gap-1 text-[13px]"
class={`flex min-h-7 flex-wrap items-center gap-1 text-[13px] ${props.class ?? ""}`}
classList={{ "justify-center": props.align !== "start", "justify-start": props.align === "start" }}
>
<span class="text-v2-text-text-faint">
{language.t(props.method === "link" ? "server.connect.password.prompt" : "server.connect.link.prompt")}
@@ -32,6 +32,7 @@ export function DialogCommandSearch() {
placeholder={language.t("command.commands.search")}
items={(query) => entries().filter((entry) => matchesCommandPaletteEntry(entry, query))}
sources={[]}
bare
highlight={preview.highlight}
select={select}
close={() => dialog.close()}
+41 -12
View File
@@ -76,6 +76,8 @@
.command-palette-meta {
flex-shrink: 0;
font-size: 11px;
letter-spacing: 0.05px;
font-variant-numeric: tabular-nums;
}
@@ -100,7 +102,7 @@
.command-palette-file-name {
flex-shrink: 0;
color: var(--v2-text-text-base);
font-weight: 530;
font-weight: 440;
white-space: nowrap;
}
@@ -128,17 +130,31 @@
}
}
/* A list with one category needs no header naming it; the header returns once a second section shows. */
.command-palette-bare
[data-slot="search-list-results"]:not(:has(> [data-slot="search-list-section"] ~ [data-slot="search-list-section"]))
[data-slot="search-list-header"] {
display: none;
}
.command-palette-bare
[data-slot="search-list-results"]:not(:has(> [data-slot="search-list-section"] ~ [data-slot="search-list-section"])) {
padding-top: 4px;
}
.command-palette-compact {
[data-slot="search-list-search"] {
position: relative;
padding: 6px 6px 17px;
display: flex;
flex-direction: column;
gap: 6px;
padding: 6px 6px 2px;
&::after {
position: absolute;
inset-inline: 0;
bottom: 8px;
border-top: 0.5px solid var(--v2-border-border-base);
height: 1px;
margin-inline: -6px;
background: var(--v2-border-border-base);
content: "";
transform: scaleY(0.5);
}
[data-component="text-input-v2"] {
@@ -170,19 +186,28 @@
}
[data-slot="search-list-section"] {
gap: 4px;
gap: 2px;
&:not(:last-child) {
padding-bottom: 4px;
}
}
[data-slot="search-list-header"] {
padding-inline: 12px;
&.command-palette [data-slot="search-list-header"] {
height: auto;
padding-block: 10px 2px;
padding-inline: 14px;
color: var(--v2-text-text-faint);
font-size: 12px;
line-height: 18px;
letter-spacing: 0.05px;
}
[data-slot="search-list-row"] {
padding-inline: 6px;
/* Outranks the list's compact row height. */
&.command-palette [data-slot="search-list-row"],
&.command-palette [data-slot="search-list-row"][data-size="compact"] {
height: 32px;
padding-inline: 8px 6px;
&:is([data-active], :focus-visible) {
background: var(--v2-overlay-simple-overlay-hover);
@@ -190,6 +215,10 @@
}
}
.palette-menu-title {
font-weight: 440;
}
.command-palette-row-text {
flex: 1;
}
+8 -1
View File
@@ -71,6 +71,8 @@ export function CommandPaletteView(props: {
/** The row whose selection is still in progress, such as an archived session being restored. */
busyEntryID?: string
unhide?: (entry: CommandPaletteEntry) => (() => void) | undefined
/** Drops the heading of a list that only ever has one category. */
bare?: boolean
}) {
const language = useLanguage()
const tabs = useTabs()
@@ -91,7 +93,12 @@ export function CommandPaletteView(props: {
})
return (
<Dialog class="command-palette command-palette-compact" size="large" fit>
<Dialog
class="command-palette command-palette-compact"
classList={{ "command-palette-bare": props.bare }}
size="large"
fit
>
<DialogBody class="command-palette-body">
<SearchList
query={store.query}
@@ -160,6 +160,7 @@ export function DialogSessionSearch(props: { archived?: boolean }) {
select={select}
close={() => dialog.close(layer?.id)}
busyEntryID={selectSessionRestoreEntryID(searchState())}
bare={!props.archived}
unhide={(entry) => {
const server = entry.server
const id = entry.sessionID
+12 -18
View File
@@ -138,7 +138,7 @@
.mcp-dialog-name {
color: var(--v2-text-text-base);
font-size: 13px;
font-weight: 530;
font-weight: 440;
line-height: var(--line-height-compact);
letter-spacing: -0.04px;
}
@@ -226,13 +226,6 @@
}
.fork-dialog [data-slot="search-list-search"] {
padding: 6px 6px 9px;
&::after {
bottom: 0;
border-color: var(--v2-border-border-muted);
}
[data-slot="text-input-v2-value"] {
gap: 8px;
}
@@ -244,15 +237,14 @@
.fork-dialog-section {
display: flex;
min-height: 28px;
flex-shrink: 0;
align-items: center;
padding: 4px 14px;
color: var(--v2-text-text-muted);
font-size: 13px;
padding: 10px 14px 2px;
color: var(--v2-text-text-faint);
font-size: 12px;
font-weight: 440;
line-height: var(--line-height-compact);
letter-spacing: -0.04px;
line-height: 18px;
letter-spacing: 0.05px;
[data-slot="dialog-description"] {
margin: 0;
@@ -266,12 +258,14 @@
}
.fork-dialog [data-slot="search-list-row"] {
height: 28px;
height: 32px;
gap: 12px;
padding-inline: 8px;
padding-inline: 8px 6px;
}
.fork-dialog .search-list-trailing {
font-size: 11px;
letter-spacing: 0.05px;
font-variant-numeric: tabular-nums;
}
@@ -328,7 +322,7 @@
&::after {
height: 1px;
margin-inline: -6px;
background: var(--v2-border-border-muted);
background: var(--v2-border-border-base);
content: "";
transform: scaleY(0.5);
}
@@ -351,6 +345,6 @@
flex-shrink: 0;
height: 1px;
margin: 4px -6px 6px;
background: var(--v2-border-border-muted);
background: var(--v2-border-border-base);
transform: scaleY(0.5);
}
+44 -29
View File
@@ -129,31 +129,37 @@ export function DialogUsage(props: {
when={ready()}
fallback={
<UsageFrame>
<div class="flex min-h-[120px] items-center justify-center px-4 pb-4">
<Switch>
<Match when={view().status === "loading"}>
<Loader />
</Match>
<Match when={view().status === "failed"}>
<div class="flex flex-col items-center gap-3">
<span class="text-[13px] leading-text-compact font-[440] tracking-[-0.04px] text-v2-text-text-muted">
{language.t("usage.error")}
</span>
<Button variant="neutral" onClick={() => dispatch({ type: "retry" })}>
{language.t("usage.retry")}
</Button>
</div>
</Match>
<Match when={view().status === "signed-out"}>
<Switch>
<Match when={view().status === "signed-out"}>
<div class="flex flex-col px-3 pb-3">
<Panel gap={8}>
<Item>
<Line class="font-[530] text-v2-text-text-base">{language.t("usage.signedOut.title")}</Line>
<Line class="text-v2-text-text-muted">{language.t("usage.signedOut.body")}</Line>
</Item>
<Message
title={language.t("usage.signedOut.title")}
body={language.t("usage.signedOut.body")}
/>
</Panel>
</Match>
</Switch>
</div>
</div>
</Match>
<Match when={true}>
<div class="flex min-h-[120px] items-center justify-center px-4 pb-4">
<Switch>
<Match when={view().status === "loading"}>
<Loader />
</Match>
<Match when={view().status === "failed"}>
<div class="flex flex-col items-center gap-3">
<span class="text-[13px] leading-text-compact font-[440] tracking-[-0.04px] text-v2-text-text-muted">
{language.t("usage.error")}
</span>
<Button variant="neutral" onClick={() => dispatch({ type: "retry" })}>
{language.t("usage.retry")}
</Button>
</div>
</Match>
</Switch>
</div>
</Match>
</Switch>
</UsageFrame>
}
>
@@ -375,12 +381,10 @@ export function UsageDialogContent(props: {
when={view().budgets.length > 0}
fallback={
<Panel gap={8}>
<Item>
<Line class="font-[530] text-v2-text-text-base">{language.t("usage.empty.title")}</Line>
<Line class="text-v2-text-text-muted">
{language.t("usage.empty.body", { workspace: workspace() })}
</Line>
</Item>
<Message
title={language.t("usage.empty.title")}
body={language.t("usage.empty.body", { workspace: workspace() })}
/>
</Panel>
}
>
@@ -495,6 +499,17 @@ function Item(props: { children: JSX.Element }) {
return <div class="flex flex-col gap-4 self-stretch px-4">{props.children}</div>
}
function Message(props: { title: string; body: string }) {
return (
<div class="flex flex-col gap-1 self-stretch px-4">
<Line class="font-[530] text-v2-text-text-base">{props.title}</Line>
<p class="m-0 text-[13px] leading-text-base font-[440] tracking-[-0.04px] text-v2-text-text-muted">
{props.body}
</p>
</div>
)
}
function Divider() {
return <div class="h-[0.5px] shrink-0 self-stretch bg-v2-border-border-base" />
}
-1
View File
@@ -36,7 +36,6 @@
[data-component="dialog-v2"].settings-wsl-not-installed-dialog [data-slot="dialog-content"] {
align-items: stretch;
border-radius: 10px;
overflow: hidden;
}
+1 -2
View File
@@ -26,7 +26,7 @@
max-height: calc(100vh - 32px);
background: var(--v2-background-bg-layer-01);
box-shadow: var(--v2-elevation-overlay);
border-radius: 6px;
border-radius: 12px;
overflow: hidden;
pointer-events: auto;
@@ -173,7 +173,6 @@
--dialog-height: min(calc(100vh - 96px), 600px);
width: min(calc(100vw - 32px), 720px);
background: var(--v2-background-bg-base);
border-radius: 12px;
}
&[data-size="x-large"] [data-slot="dialog-container"] {