Merge pull request #814 from nwparker/cloud/tab-chip-delete-labels

fix(desktop): remove the W-number tab chip; delete dialog says Archive / Delete
This commit is contained in:
Neil
2026-11-15 22:22:29 -08:00
committed by GitHub
9 changed files with 8 additions and 191 deletions
@@ -10,7 +10,6 @@ import { selectActiveTerminalChromeState } from './active-terminal-chrome-select
import { hasCustomTitleBar } from './app-window-chrome'
import type { AppChromeLayout } from './use-app-chrome-layout'
import { RunActionButton } from '../components/run-actions/RunActionButton'
import { CloudWorkspaceNumberChip } from '../components/cloud-workspaces/CloudWorkspaceNumberChip'
import { CloudWorkspaceOwnerChangedChip } from '../components/cloud-workspaces/CloudWorkspaceOwnerChangedChip'
import { CloudWorkspacePeople } from '../components/cloud-workspaces/CloudWorkspacePeople'
@@ -75,7 +74,6 @@ export function TitlebarMainStrip({ layout }: { layout: AppChromeLayout }): Reac
<>
<CloudWorkspacePeople worktreeId={activeWorktreeId} />
<CloudWorkspaceOwnerChangedChip worktreeId={activeWorktreeId} />
<CloudWorkspaceNumberChip worktreeId={activeWorktreeId} />
</>
) : null}
{layout.workspaceChromeActive && !layout.creationLayoutActive && activeWorktreeId ? (
@@ -203,7 +203,7 @@ export function CloudWorkspaceConfirmDialog({
{pending.kind === 'private'
? t('auto.components.cloudWorkspaces.makePrivate', 'Make private')
: pending.kind === 'delete'
? t('auto.components.sidebar.DeleteCloudWorkspace.delete', 'Delete workspace')
? t('auto.components.sidebar.DeleteCloudWorkspace.delete', 'Delete')
: pending.kind === 'archive'
? t('auto.components.cloudWorkspaces.archive', 'Archive')
: busy
@@ -1,77 +0,0 @@
import { defineFixture } from '../../component-fixtures/component-fixture'
import { CloudWorkspaceNumberChip } from './CloudWorkspaceNumberChip'
import { refreshCloudWorktreeBindings, rememberCloudWorkspaces } from './cloud-workspace-identity'
import { workspace } from './cloud-workspaces.test-fixture'
const WORKTREE = 'repo-1::/vercel/orca/workspaces/app/fix-login'
const SANDBOX = 'sbx_00000000000000000000c197'
async function seed(): Promise<void> {
Object.assign(window.api.cloudWorkspaces, {
localWorkspaces: () =>
Promise.resolve([{ sandboxId: SANDBOX, worktreeId: WORKTREE, runtimeEnvironmentId: null }]),
environmentBindings: () => Promise.resolve({}),
get: () => Promise.resolve({ ok: false as const, error: 'not_found' })
})
// The headless frame has no clipboard permission; the chip only needs the write to succeed.
Object.defineProperty(navigator, 'clipboard', {
configurable: true,
value: { writeText: () => Promise.resolve() }
})
rememberCloudWorkspaces([
workspace({ id: SANDBOX, number: 197, link: 'orca://cloud/acme/W-197', title: 'Fix login' })
])
await refreshCloudWorktreeBindings()
}
async function chip(frame: HTMLElement): Promise<HTMLButtonElement | null> {
await seed()
const deadline = performance.now() + 2000
let button = frame.querySelector<HTMLButtonElement>('button')
while (!button && performance.now() < deadline) {
await new Promise((resolve) => setTimeout(resolve, 25))
button = frame.querySelector<HTMLButtonElement>('button')
}
return button
}
/** Shown beside Run in the workspace's tab bar: link glyph + W-number, muted at rest. */
export const atRest = defineFixture({
width: 160,
render: () => (
<div className="flex items-center p-2">
<CloudWorkspaceNumberChip worktreeId={WORKTREE} />
</div>
),
interact: async (frame) => {
await chip(frame)
}
})
/** Keyboard focus shows the ring and the "Copy link to W-197" tooltip. */
export const focused = defineFixture({
width: 260,
render: () => (
<div className="flex h-20 items-start p-2">
<CloudWorkspaceNumberChip worktreeId={WORKTREE} />
</div>
),
interact: async (frame) => {
;(await chip(frame))?.focus()
await new Promise((resolve) => setTimeout(resolve, 400))
}
})
/** After a click: check glyph, same width, "Link copied" in the tooltip for about 1.5 s. */
export const copied = defineFixture({
width: 260,
render: () => (
<div className="flex h-20 items-start p-2">
<CloudWorkspaceNumberChip worktreeId={WORKTREE} />
</div>
),
interact: async (frame) => {
;(await chip(frame))?.click()
await new Promise((resolve) => setTimeout(resolve, 150))
}
})
@@ -1,100 +0,0 @@
// W-123 in the top bar when the workspace in front is a cloud workspace; click copies its link
// (the same as ⌘⌥⇧L) and confirms in place; the tooltip says who the link is for. Renders nothing for local workspaces or before the
// number is known.
import React, { useEffect, useState } from 'react'
import { Check, Link2 } from 'lucide-react'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import { formatOptionalPrimaryShortcutLabel } from '@/hooks/useShortcutLabel'
import { useTranslate } from '@/i18n/use-translate'
import { cn } from '@/lib/class-names'
import { useAppStore } from '@/store'
import { formatWorkspaceNumber } from '../../../../shared/cloud-workspaces/cloud-workspaces-wire'
import { sandboxIdForWorktree, useCloudWorkspaceIdentities } from './cloud-workspace-identity'
import { copyCloudWorkspaceLink } from './open-cloud-workspace'
const COPIED_MS = 1_500
export function CloudWorkspaceNumberChip({
worktreeId
}: {
worktreeId: string
}): React.JSX.Element | null {
const t = useTranslate()
const hostId = useAppStore((s) => s.activeWorkspaceExecutionHostId)
const keybindings = useAppStore((s) => s.keybindings)
const identities = useCloudWorkspaceIdentities()
const [copied, setCopied] = useState(false)
// Hover/focus opens the tooltip; a copy holds it open to confirm, so the chip never changes width.
const [tipOpen, setTipOpen] = useState(false)
useEffect(() => {
if (!copied) {
return
}
const timer = setTimeout(() => setCopied(false), COPIED_MS)
return () => clearTimeout(timer)
}, [copied])
const sandboxId = sandboxIdForWorktree({ id: worktreeId, hostId }, identities)
const number = sandboxId ? (identities.bySandbox.get(sandboxId)?.number ?? null) : null
if (!sandboxId || !number) {
return null
}
const label = formatWorkspaceNumber(number)
const shortcut = formatOptionalPrimaryShortcutLabel('cloudWorkspace.copyLink', keybindings)
const copiedLabel = t('auto.components.cloudWorkspaces.linkCopiedShort', 'Link copied')
const hint = t(
'auto.components.cloudWorkspaces.copyLinkHint',
'Teammates with access can open this workspace'
)
return (
<>
<Tooltip open={tipOpen || copied} onOpenChange={setTipOpen}>
<TooltipTrigger asChild>
<button
type="button"
onClick={() => {
// The workspace only: a teammate opening it shouldn't land on your terminal or chat.
void copyCloudWorkspaceLink(sandboxId, null, { quiet: true }).then(
(ok) => ok && setCopied(true)
)
}}
aria-label={t('auto.components.cloudWorkspaces.copyLinkTo', 'Copy link to {{number}}', {
number: label
})}
aria-description={hint}
className={cn(
'mr-2 flex h-6 items-center gap-1 rounded-md px-1.5 font-mono max-[960px]:hidden text-2xs tabular-nums text-muted-foreground outline-none [-webkit-app-region:no-drag] hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-focus-ring',
copied && 'text-foreground'
)}
>
{/* The link glyph says what the chip does before anyone hovers it (N-05). */}
{copied ? (
<Check className="size-3 shrink-0" aria-hidden />
) : (
<Link2 className="size-3 shrink-0" aria-hidden />
)}
{label}
</button>
</TooltipTrigger>
<TooltipContent side="bottom" sideOffset={6}>
{copied ? (
copiedLabel
) : (
<>
<div>
{t('auto.components.cloudWorkspaces.copyLinkTo', 'Copy link to {{number}}', {
number: label
})}
{shortcut ? <span className="ml-1.5 text-muted-foreground">{shortcut}</span> : null}
</div>
{/* Says what the link is for: the W-number alone didn't (N-05 follow-up). */}
<div className="text-muted-foreground">{hint}</div>
</>
)}
</TooltipContent>
</Tooltip>
<span aria-live="polite" className="sr-only">
{copied ? copiedLabel : ''}
</span>
</>
)
}
@@ -53,7 +53,7 @@ type Front = {
let front: Front = null
/**
* ⌘⌥⇧L: the workspace's own link (its W-number), like the tab-bar chip and the cloud workspace
* ⌘⌥⇧L: the workspace's own link (its W-number), like the cloud workspace
* list's "Copy link to W-n". A link to the focused chat or terminal is a separate menu item, never the shortcut.
*/
export function copyShortcutLink(sandboxId: string): Promise<boolean> {
@@ -166,18 +166,18 @@ export function DeleteCloudWorkspaceFooter({
<ArchiveSnapshotTooltip>
<Button variant="outline" size="sm" onClick={onArchive} disabled={isDeleting}>
<Archive />
{t('auto.components.sidebar.DeleteCloudWorkspace.archiveInstead', 'Archive instead')}
{t('auto.components.sidebar.DeleteCloudWorkspace.archiveInstead', 'Archive')}
</Button>
</ArchiveSnapshotTooltip>
<Button variant="destructive" size="sm" onClick={onDelete} disabled={isDeleting}>
{isDeleting ? <Loader2 className="animate-spin" /> : <Trash2 />}
{t('auto.components.sidebar.DeleteCloudWorkspace.delete', 'Delete workspace')}
{t('auto.components.sidebar.DeleteCloudWorkspace.delete', 'Delete')}
</Button>
</>
)
}
/** "Archive instead": close the dialog and run the ordinary archive (Sleep, snapshot, Undo toast). */
/** "Archive": close the dialog and run the ordinary archive (Sleep, snapshot, Undo toast). */
export function archiveInsteadOfDelete(
worktree: { id: string; displayName?: string },
closeModal: () => void
@@ -109,7 +109,7 @@ export const cloudWorkspaceArchiveTooltip = defineFixture({
interact: () =>
focusWhenShown(() =>
[...document.querySelectorAll<HTMLButtonElement>('[role="dialog"] button')].find((button) =>
button.textContent?.includes('Archive instead')
button.textContent?.trim() === 'Archive'
)
)
})
@@ -26,7 +26,6 @@ import { UNFOCUSED_SPLIT_GROUP_OPACITY } from './split-group-dim'
import { useWindowBackdropActive } from '@/app-shell/appearance/window-backdrop'
import { EditorRevealFlash } from './EditorRevealFlash'
import { SplitPaneLanding } from './SplitPaneLanding'
import { CloudWorkspaceNumberChip } from '../cloud-workspaces/CloudWorkspaceNumberChip'
import { CloudWorkspaceOwnerChangedChip } from '../cloud-workspaces/CloudWorkspaceOwnerChangedChip'
import { CloudWorkspacePeople } from '../cloud-workspaces/CloudWorkspacePeople'
import { CloudGitSetupStrip } from '../orca-cloud/CloudGitSetupStrip'
@@ -320,7 +319,6 @@ export default function TabGroupPanel({
<>
<CloudWorkspacePeople worktreeId={worktreeId} />
<CloudWorkspaceOwnerChangedChip worktreeId={worktreeId} />
<CloudWorkspaceNumberChip worktreeId={worktreeId} />
</>
) : null}
{!hasSplitGroups || isFocused ? <RunActionButton worktreeId={worktreeId} /> : null}
+2 -4
View File
@@ -8460,8 +8460,8 @@
"DeleteCloudWorkspace": {
"title": "Delete {{name}}?",
"cancel": "Cancel",
"archiveInstead": "Archive instead",
"delete": "Delete workspace",
"archiveInstead": "Archive",
"delete": "Delete",
"uncommitted_one": "{{count}} uncommitted change",
"uncommitted_other": "{{count}} uncommitted changes",
"bodyNoSnapshot": "Deletes the sandbox and its disk, including chats, terminals and uncommitted changes. This can't be undone.",
@@ -21335,9 +21335,7 @@
"errorSeatSandboxLimitOwner_one": "{{name}} already has {{count}} sandbox running. This workspace runs on their seat, so ask them to put it to sleep, then try again.",
"errorSeatSandboxLimitOwner_other": "{{name}} already has {{count}} sandboxes running. This workspace runs on their seat, so ask them to put one to sleep, then try again.",
"viewOwnerProfile": "View {{name}}'s profile",
"linkCopiedShort": "Link copied",
"copyLinkTo": "Copy link to {{number}}",
"copyLinkHint": "Teammates with access can open this workspace",
"linkNoAccess": "You don't have access to {{number}}.",
"linkOtherTeam2": "{{number}} is in {{team}}.",
"linkSwitchTeam": "Switch and open",