diff --git a/src/renderer/src/components/cloud-workspaces/CloudWorkspaceConfirmDialog.tsx b/src/renderer/src/components/cloud-workspaces/CloudWorkspaceConfirmDialog.tsx index 1b445e87ac5..212be79ac56 100644 --- a/src/renderer/src/components/cloud-workspaces/CloudWorkspaceConfirmDialog.tsx +++ b/src/renderer/src/components/cloud-workspaces/CloudWorkspaceConfirmDialog.tsx @@ -1,7 +1,8 @@ // Confirmation for row actions that take something away from people: making a shared workspace // private (teammates' computers are disconnected), handing ownership to someone else, and archiving // a teammate's running workspace (their agents stop). -import { useArchiveSnapshotDefinition } from '@/components/orca-cloud/ArchiveSnapshotTooltip' +import { archiveDialogKeptLine } from '@/components/orca-cloud/archive-snapshot-copy' +import { useArchiveTtlDays } from '@/lib/orca-cloud/archive-ttl' import React, { useEffect, useState } from 'react' import { Loader2 } from 'lucide-react' import { Button } from '@/components/ui/button' @@ -126,8 +127,8 @@ export function CloudWorkspaceConfirmDialog({ : t('auto.components.cloudWorkspaces.reassignTitle', 'Make {{name}} the owner?', { name: memberName(directory, pending.ownerUserId, selfId, t) }) - // What archive keeps, until when, and that it costs no sandbox hours (one shared definition). - const archiveDefinition = useArchiveSnapshotDefinition() + // How long archive keeps it, in the same relative words as the Archive tooltip. + const archiveKept = archiveDialogKeptLine(t, useArchiveTtlDays()) const losesManagement = pending.kind === 'owner' && w.ownerUserId === selfId && !canAdmin // Destructive for someone else (their agents stop, or you lose access): focus starts on Cancel. const focusCancel = losesManagement || pending.kind === 'archive' || pending.kind === 'delete' @@ -142,7 +143,7 @@ export function CloudWorkspaceConfirmDialog({ {t( 'auto.components.sidebar.DeleteCloudWorkspace.bodyNoSnapshot', - "Deletes the sandbox and its disk, including chats, terminals and uncommitted changes. This can't be undone." + 'Deletes the workspace and all its files, chats and uncommitted changes. This can’t be undone.' )} ) : pending.kind === 'archive' ? ( @@ -152,7 +153,7 @@ export function CloudWorkspaceConfirmDialog({ "{{owner}}'s agents in this workspace will stop.", { owner: memberName(directory, w.ownerUserId, selfId, t) } )}{' '} - {archiveDefinition} + {archiveKept} ) : ( <> diff --git a/src/renderer/src/components/orca-cloud/ArchiveSnapshotTooltip.tsx b/src/renderer/src/components/orca-cloud/ArchiveSnapshotTooltip.tsx index 2a50166b7b6..7151d6c1733 100644 --- a/src/renderer/src/components/orca-cloud/ArchiveSnapshotTooltip.tsx +++ b/src/renderer/src/components/orca-cloud/ArchiveSnapshotTooltip.tsx @@ -1,31 +1,27 @@ -// The archive "snapshot" definition (archive-snapshot-copy.ts) as a tooltip on Archive controls. Every -// Archive control and every place the copy says "snapshot" reuses the one string, so it can't drift -// between the delete dialog, the menus, the hovercard and the archived view. +// What Archive does (archive-snapshot-copy.ts), as a tooltip on every Archive control, so the delete +// dialog and the menus can't drift apart. import type React from 'react' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' import { useTranslate } from '@/i18n/use-translate' import { useArchiveTtlDays } from '@/lib/orca-cloud/archive-ttl' import { archiveSnapshotDefinition } from './archive-snapshot-copy' -/** The definition for this workspace: its kept-until date once archived, else today + the TTL. */ -export function useArchiveSnapshotDefinition(keptUntil?: number | null): string { +/** The tooltip sentence, with the control plane's retention once it has loaded. */ +export function useArchiveSnapshotDefinition(): string { const t = useTranslate() const ttlDays = useArchiveTtlDays() - return archiveSnapshotDefinition(t, { keptUntil, ttlDays }) + return archiveSnapshotDefinition(t, { ttlDays }) } export function ArchiveSnapshotTooltip({ children, - keptUntil, side = 'top' }: { /** The Archive control: a Button or a DropdownMenuItem (Radix `asChild` needs a ref-forwarding element). */ children: React.ReactElement - /** An archived workspace's own kept-until date. */ - keptUntil?: number | null side?: 'top' | 'right' | 'bottom' | 'left' }): React.JSX.Element { - const definition = useArchiveSnapshotDefinition(keptUntil) + const definition = useArchiveSnapshotDefinition() return ( {children} diff --git a/src/renderer/src/components/orca-cloud/CloudArchivedWorkspaceView.tsx b/src/renderer/src/components/orca-cloud/CloudArchivedWorkspaceView.tsx index 27800b62d70..7bbdcdc3f38 100644 --- a/src/renderer/src/components/orca-cloud/CloudArchivedWorkspaceView.tsx +++ b/src/renderer/src/components/orca-cloud/CloudArchivedWorkspaceView.tsx @@ -19,13 +19,12 @@ import { cn } from '@/lib/class-names' import { buildFileTree, formatRelative, - formatShortDate, type FileTreeNode } from '@/lib/orca-cloud/orca-cloud-workspace-state' import type { CloudArchiveInfo } from '../../../../shared/hosted-sandbox/cloud-workspace-api' import type { HostedArchivePullRequest } from '../../../../shared/hosted-sandbox/hosted-sandbox-wire' import { CloudGitChanges } from './CloudGitChanges' -import { archivedSnapshotLine } from './archive-snapshot-copy' +import { archivedCountdownShort } from './archive-snapshot-copy' import { CloudWorkspaceHeader } from './CloudWorkspaceHeader' import { FOCUS_RING } from './cloud-focus' @@ -193,11 +192,7 @@ export function CloudArchivedWorkspaceView({ when: formatRelative(archivedAt, now) }) : t('orcaCloudWorkspace.state.archived', 'Archived'), - expiresAt - ? t('orcaCloudWorkspace.archived.keptUntilShort', 'kept until {{date}}', { - date: formatShortDate(expiresAt) - }) - : null + expiresAt ? archivedCountdownShort(t, expiresAt, now) : null ] .filter(Boolean) .join(' · ') @@ -213,8 +208,18 @@ export function CloudArchivedWorkspaceView({ title={workspaceName ?? t('orcaCloudWorkspace.archived.title', 'Archived workspace')} state="archived" stateLine={stateLine} - // The snapshot defined inline, with this workspace's own deletion date. - note={archivedSnapshotLine(t, expiresAt)} + // The countdown is in the state line; without a date, the note names the 30-day rule. + note={ + expiresAt + ? t( + 'orcaCloudWorkspace.archiveSnapshot.archivedNote', + 'Read-only. Unarchive it to keep working.' + ) + : t( + 'orcaCloudWorkspace.archiveSnapshot.archived', + 'Read-only. Deletes 30 days after archiving unless you unarchive it.' + ) + } headingRef={headingRef} action={ )}