mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-19 17:01:37 +03:00
fix(app): default the header separator to an 11px chevron (#58006)
This commit is contained in:
committed by
GitHub
Unverified
parent
a3883d6908
commit
1f059e0f51
@@ -224,24 +224,11 @@ test.describe("location", () => {
|
||||
.poll(() => header.getByRole("heading").evaluate((element) => element.scrollWidth <= element.clientWidth))
|
||||
.toBe(true)
|
||||
if (panel) {
|
||||
await expect
|
||||
.poll(() =>
|
||||
header.evaluate((element) => {
|
||||
const icon = element.querySelector('svg:has(use[href="#opencode-v2-icon-outline-worktree"])')
|
||||
const before = icon?.previousElementSibling?.getBoundingClientRect()
|
||||
const avatar = element
|
||||
.querySelector('[data-slot="session-location-trigger"]')
|
||||
?.firstElementChild?.getBoundingClientRect()
|
||||
const bounds = icon?.getBoundingClientRect()
|
||||
|
||||
return bounds && before && avatar ? [before.left - avatar.right, bounds.left - before.right] : []
|
||||
}),
|
||||
)
|
||||
.toEqual([10, 8])
|
||||
const separator = header.locator('[data-slot="session-title-separator"]')
|
||||
await expect(separator).toBeVisible()
|
||||
await expect(separator).toHaveText("")
|
||||
await expect(separator).toHaveAttribute("aria-hidden", "true")
|
||||
await expect(header.locator(".session-location-worktree-icon")).toBeHidden()
|
||||
const location = header.locator('[data-slot="session-location-trigger"]')
|
||||
await location.hover()
|
||||
await expect(location).toHaveCSS("padding-inline-start", "4px")
|
||||
@@ -256,7 +243,7 @@ test.describe("location", () => {
|
||||
await openSession(page, workspace)
|
||||
await expect(trigger(page).locator('[data-slot="session-location-project"]')).toHaveText("Location")
|
||||
await expect(trigger(page).locator('[data-slot="session-location-worktree"]')).toHaveText("quiet-falcon")
|
||||
await expect(trigger(page).getByText("/", { exact: true })).toBeVisible()
|
||||
await expect(trigger(page)).not.toContainText("/")
|
||||
await expect(trigger(page).locator('svg:has(use[href="#opencode-v2-icon-outline-worktree"])')).toBeVisible()
|
||||
await trigger(page).click()
|
||||
const card = page.locator('[data-slot="session-location-card"]')
|
||||
|
||||
@@ -7,14 +7,14 @@ const group = "Experiments"
|
||||
const glyph = motionTuning.choice("sessionHeader.separator", {
|
||||
label: "Header separator",
|
||||
group,
|
||||
value: "divider",
|
||||
value: "chevron",
|
||||
labels: { divider: "Divider", slash: "Slash", chevron: "Chevron", bold: "Bold chevron", dot: "Dot" },
|
||||
})
|
||||
|
||||
const size = motionTuning.number("sessionHeader.separator.size", {
|
||||
label: "Separator size",
|
||||
group,
|
||||
value: 14,
|
||||
value: 11,
|
||||
min: 6,
|
||||
max: 24,
|
||||
step: 1,
|
||||
@@ -93,18 +93,7 @@ export function SessionHeaderSeparator(props: { before?: number; after?: number
|
||||
<span class="block rounded-full bg-current" style={{ width: `${width()}px`, height: `${width()}px` }} />
|
||||
</Match>
|
||||
<Match when={tuning.glyph === "slash"}>
|
||||
<svg
|
||||
class="block fill-none stroke-current"
|
||||
width={tuning.size * 0.4}
|
||||
height={tuning.size}
|
||||
viewBox={`0 0 ${tuning.size * 0.4} ${tuning.size}`}
|
||||
stroke-width={tuning.weight}
|
||||
stroke-linecap="round"
|
||||
>
|
||||
<path
|
||||
d={`M${tuning.weight / 2} ${tuning.size - tuning.weight / 2}L${tuning.size * 0.4 - tuning.weight / 2} ${tuning.weight / 2}`}
|
||||
/>
|
||||
</svg>
|
||||
<span class="session-header-slash" />
|
||||
</Match>
|
||||
<Match when={true}>
|
||||
<svg
|
||||
|
||||
@@ -38,11 +38,7 @@
|
||||
margin-inline-end: 2px;
|
||||
}
|
||||
|
||||
.session-header-location [data-slot="session-location-project"] + span {
|
||||
padding-inline: 0;
|
||||
}
|
||||
|
||||
/* The icon-only trigger sits 4px from its icon and the row adds a 4px gap; the avatar's 2px margin counts too. */
|
||||
/* The avatar-only trigger sits 4px from its avatar and the row adds a 4px gap; the avatar's 2px margin counts too. */
|
||||
.session-header-location > .session-header-separator {
|
||||
--separator-before: 10px;
|
||||
}
|
||||
@@ -51,8 +47,9 @@
|
||||
--separator-before: 9px;
|
||||
}
|
||||
|
||||
.session-header-location:has([data-slot="session-location-worktree"]) > .session-header-separator {
|
||||
--separator-before: 9px;
|
||||
/* The collapsed header reads avatar, separator, title; the names stay in the trigger's title and accessible name. */
|
||||
.session-header-location .session-location-worktree-icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Keep the names available to assistive tech while the icons leave room for the title. */
|
||||
@@ -102,6 +99,16 @@
|
||||
calc(var(--separator-gap) - var(--separator-after, 6px) - 0.5px);
|
||||
}
|
||||
|
||||
/* The original "/" text, as generated content so the separator itself stays empty for assistive tech. */
|
||||
.session-header-slash::before {
|
||||
content: "/";
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
line-height: var(--line-height-base);
|
||||
/* Cancels the glyph's side bearings so the margins above measure to its ink. */
|
||||
margin-inline: -0.25px -0.34px;
|
||||
}
|
||||
|
||||
.session-header-separator[data-glyph="chevron"]:dir(rtl) > svg,
|
||||
.session-header-separator[data-glyph="bold"]:dir(rtl) > svg {
|
||||
transform: scaleX(-1);
|
||||
|
||||
@@ -182,6 +182,7 @@ export function SessionLocation(props: {
|
||||
<Menu placement="bottom-start" gutter={4} modal={false} onOpenChange={onOpenChange}>
|
||||
<Menu.Trigger
|
||||
data-slot="session-location-trigger"
|
||||
title={[projectName(), worktree()].filter(Boolean).join(" / ")}
|
||||
class="flex h-6 min-w-0 max-w-[60%] shrink items-center gap-1.5 rounded-[6px] px-1 text-start text-[13px] font-[440] leading-[var(--line-height-compact)] tracking-[-0.04px] text-v2-text-text-muted transition-colors hover:bg-v2-overlay-simple-overlay-hover hover:text-v2-text-text-base focus-visible:bg-v2-overlay-simple-overlay-hover focus-visible:text-v2-text-text-base focus-visible:outline-none data-[expanded]:bg-v2-overlay-simple-overlay-hover data-[expanded]:text-v2-text-text-base"
|
||||
>
|
||||
<ProjectAvatar
|
||||
@@ -198,10 +199,7 @@ export function SessionLocation(props: {
|
||||
<Show when={!props.compact && worktree()}>
|
||||
{(name) => (
|
||||
<>
|
||||
<span class="shrink-0 px-1 text-[11px] font-medium text-v2-text-text-faint" aria-hidden="true">
|
||||
/
|
||||
</span>
|
||||
<Icon name="outline-worktree" class="shrink-0 text-v2-icon-icon-muted" />
|
||||
<Icon name="outline-worktree" class="session-location-worktree-icon shrink-0 text-v2-icon-icon-muted" />
|
||||
<bdi dir="auto" data-slot="session-location-worktree" class="min-w-12 shrink-[1000] truncate">
|
||||
{name()}
|
||||
</bdi>
|
||||
|
||||
Reference in New Issue
Block a user