mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-13 19:46:16 +03:00
fix(app): drop the server from the session header breadcrumb
The breadcrumb now shows only the project and worktree for every session. The location card still names the server.
This commit is contained in:
@@ -153,8 +153,6 @@ 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")
|
||||
// The current server is never named in the breadcrumb.
|
||||
await expect(trigger(page).locator('[data-slot="session-location-server"]')).toHaveCount(0)
|
||||
await trigger(page).click()
|
||||
const card = page.locator('[data-slot="session-location-card"]')
|
||||
await expect(card.locator('[data-slot="session-location-path"]')).toHaveText(worktree)
|
||||
@@ -163,16 +161,16 @@ test.describe("location", () => {
|
||||
await expect.poll(() => page.evaluate(() => navigator.clipboard.readText())).toBe(worktree)
|
||||
})
|
||||
|
||||
test("names a session's server when it is not the current one", async ({ page }) => {
|
||||
test("names another server only in the card, not the breadcrumb", async ({ page }) => {
|
||||
await mockWorkspace(page, { name: "Location", sessions: [] })
|
||||
await mockRemoteServer(page, {
|
||||
name: "apollo",
|
||||
directory: "/srv/apollo/project",
|
||||
directory: "/srv/remote/project",
|
||||
sessions: [
|
||||
{
|
||||
id: "ses_remote",
|
||||
title: "Remote session",
|
||||
directory: "/srv/apollo/project",
|
||||
directory: "/srv/remote/project",
|
||||
slug: "ses_remote",
|
||||
version: "dev",
|
||||
time: { created: 1, updated: 1 },
|
||||
@@ -181,8 +179,10 @@ test.describe("location", () => {
|
||||
})
|
||||
await seed(page, { tabs: [{ session: "ses_remote", server: REMOTE_SERVER }] })
|
||||
await page.goto(sessionHref("ses_remote", REMOTE_SERVER))
|
||||
await expect(trigger(page).locator('[data-slot="session-location-server"]')).toHaveText("apollo")
|
||||
await expect(trigger(page).locator('[data-slot="session-location-project"]')).toHaveText("project")
|
||||
await expect(trigger(page)).not.toContainText("apollo")
|
||||
await trigger(page).click()
|
||||
await expect(page.locator('[data-slot="session-location-card"]').getByText("apollo", { exact: true })).toBeVisible()
|
||||
})
|
||||
|
||||
test("shows the location bar under the mobile view tabs", async ({ page }) => {
|
||||
|
||||
@@ -49,8 +49,8 @@ export function SessionTitleHeader(props: ParentProps) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Where the session runs: the server (only when it is not the current one), the project and its worktree. Opens a card
|
||||
* with the full path and the location's actions.
|
||||
* Where the session runs: the project and its worktree. Opens a card with the server, the full path and the location's
|
||||
* actions.
|
||||
*/
|
||||
export function SessionLocation(props: {
|
||||
project?: Omit<LocalProject, "expanded">
|
||||
@@ -79,7 +79,6 @@ export function SessionLocation(props: {
|
||||
return root ? getFilename(root) : undefined
|
||||
})
|
||||
|
||||
const remote = () => (servers.current(server.conn) ? undefined : servers.label(server.conn))
|
||||
const git = () => !!props.project?.vcs
|
||||
|
||||
const branch = () =>
|
||||
@@ -151,19 +150,6 @@ export function SessionLocation(props: {
|
||||
data-slot="session-location-trigger"
|
||||
class="flex h-6 min-w-0 max-w-[60%] shrink items-center gap-1.5 rounded-md ps-1 pe-2 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"
|
||||
>
|
||||
<Show when={!props.compact && remote()}>
|
||||
{(name) => (
|
||||
<>
|
||||
<span data-slot="session-location-server" class="flex min-w-0 shrink-[10] items-center gap-1">
|
||||
<Icon name="server" size="small" class="shrink-0" />
|
||||
<bdi dir="auto" class="min-w-0 truncate">
|
||||
{name()}
|
||||
</bdi>
|
||||
</span>
|
||||
<Icon name="chevron-right" class="-mx-1 shrink-0 text-v2-icon-icon-faint" />
|
||||
</>
|
||||
)}
|
||||
</Show>
|
||||
<ProjectAvatar
|
||||
class="shrink-0"
|
||||
aria-hidden="true"
|
||||
|
||||
Reference in New Issue
Block a user