mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-17 05:26:47 +03:00
fix(app): give every session header hover state the same height (#58195)
Co-authored-by: iamdavidhill <1879069+iamdavidhill@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
6aaa989e6a
commit
1cbe48fe5d
@@ -30,6 +30,15 @@ for (const direction of ["ltr", "rtl"] as const) {
|
||||
const titleBounds = await header.getByRole("heading").boundingBox()
|
||||
expect(titleBounds).not.toBeNull()
|
||||
|
||||
// Every control in the header highlights the same 28px band on hover.
|
||||
const usage = header.getByRole("button", { name: "Toggle session context", exact: true })
|
||||
const heights = await Promise.all(
|
||||
[project, header.getByRole("heading"), options, usage, details, review].map(
|
||||
async (control) => (await control.boundingBox())?.height,
|
||||
),
|
||||
)
|
||||
expect(heights).toEqual([28, 28, 28, 28, 28, 28])
|
||||
|
||||
for (const editing of [false, true]) {
|
||||
if (editing) {
|
||||
await header.getByRole("heading").click()
|
||||
@@ -231,8 +240,9 @@ test.describe("location", () => {
|
||||
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")
|
||||
await expect(location).toHaveCSS("padding-inline-end", "4px")
|
||||
await expect(location).toHaveCSS("padding-inline-start", "6px")
|
||||
await expect(location).toHaveCSS("padding-inline-end", "6px")
|
||||
expect(await location.boundingBox()).toMatchObject({ width: 28, height: 28 })
|
||||
}
|
||||
await header.screenshot({ path: test.info().outputPath(`location-${panel ? "compact" : "expanded"}.png`) })
|
||||
}
|
||||
|
||||
@@ -31,16 +31,17 @@
|
||||
|
||||
.session-header-location > [data-slot="session-location-trigger"] {
|
||||
gap: 8px;
|
||||
padding-inline: 4px;
|
||||
padding-inline: 6px;
|
||||
}
|
||||
|
||||
/* The avatar-only trigger sits 4px from its avatar on every side, and the row adds a 4px gap. */
|
||||
/* The avatar-only trigger is square like the header's icon buttons, 6px from its avatar on every side, and the row
|
||||
adds a 4px gap. */
|
||||
.session-header-location > .session-header-separator {
|
||||
--separator-before: 8px;
|
||||
--separator-before: 10px;
|
||||
}
|
||||
|
||||
.session-header-location > .session-header-separator:dir(rtl) {
|
||||
--separator-before: 7px;
|
||||
--separator-before: 9px;
|
||||
}
|
||||
|
||||
/* The collapsed header reads avatar, separator, title; the names stay in the trigger's title and accessible name. */
|
||||
|
||||
@@ -183,7 +183,7 @@ export function SessionLocation(props: {
|
||||
<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"
|
||||
class="flex h-7 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
|
||||
class="shrink-0"
|
||||
@@ -541,7 +541,7 @@ export function SessionIdentityHeader(props: { sessionID: string; session?: Sess
|
||||
<h1
|
||||
data-slot={parentID() ? "session-title-child" : undefined}
|
||||
dir="auto"
|
||||
class="w-fit truncate rounded-[6px] px-1 py-1 text-[13px] font-[530] leading-4 tracking-[-0.04px] text-v2-text-text-base"
|
||||
class="w-fit truncate rounded-[6px] px-1 py-1.5 text-[13px] font-[530] leading-4 tracking-[-0.04px] text-v2-text-text-base"
|
||||
classList={{ "max-w-[45%] shrink-0": !!parentID() }}
|
||||
>
|
||||
{value()}
|
||||
|
||||
@@ -559,7 +559,7 @@ function MessageTimelineView(
|
||||
<h1
|
||||
data-slot="session-title-child"
|
||||
dir="auto"
|
||||
class="max-w-[45%] shrink-0 w-fit truncate rounded-[6px] px-1 py-1 text-[13px] font-[530] leading-4 tracking-[-0.04px] text-v2-text-text-base"
|
||||
class="max-w-[45%] shrink-0 w-fit truncate rounded-[6px] px-1 py-1.5 text-[13px] font-[530] leading-4 tracking-[-0.04px] text-v2-text-text-base"
|
||||
>
|
||||
{value()}
|
||||
</h1>
|
||||
@@ -572,7 +572,7 @@ function MessageTimelineView(
|
||||
fallback={
|
||||
<h1
|
||||
data-slot="session-title-child"
|
||||
class="truncate text-[13px] font-[530] leading-4 tracking-[-0.04px] text-v2-text-text-base w-fit rounded-[6px] px-1 py-1 hover:bg-v2-overlay-simple-overlay-hover"
|
||||
class="truncate text-[13px] font-[530] leading-4 tracking-[-0.04px] text-v2-text-text-base w-fit rounded-[6px] px-1 py-1.5 hover:bg-v2-overlay-simple-overlay-hover"
|
||||
classList={{ "max-w-[45%] shrink-0": !!parentID() }}
|
||||
onClick={openTitleEditor}
|
||||
>
|
||||
@@ -588,7 +588,7 @@ function MessageTimelineView(
|
||||
dir="auto"
|
||||
value={title.draft}
|
||||
disabled={props.pending.rename()}
|
||||
class="block text-[13px] font-[530] leading-4 tracking-[-0.04px] text-v2-text-text-base field-sizing-content rounded-[6px] px-1 py-1"
|
||||
class="block text-[13px] font-[530] leading-4 tracking-[-0.04px] text-v2-text-text-base field-sizing-content rounded-[6px] px-1 py-1.5"
|
||||
classList={{ "max-w-[45%] shrink-0": !!parentID() }}
|
||||
style={{
|
||||
"--inline-input-shadow": "none",
|
||||
|
||||
Reference in New Issue
Block a user