From a2410d10eb9ee53eecbe2be9166b84cc68918ac8 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 10 Nov 2026 15:23:09 -0800 Subject: [PATCH] fix(cloud-start): composer footer wraps instead of overflowing; session plan row never shows a raw code; plan subtitle names GitHub - The footer's actions wrap under "Create more" at the modal's width, so "Set up and start" / "Give access and start" no longer run past the dialog's right edge. - A setup session's machine details ('subscription', 'trial', 'checkout', 'requested') read as words, or nothing for a plan that's simply done. - When the one browser visit also gives GitHub access, the subtitle says so. - Fixtures at the real modal width (CloudStartModalWidth) and unit tests. --- .../NewWorkspaceComposerFooter.tsx | 50 +++----- .../run-on/CloudStartModalWidth.fixture.tsx | 120 ++++++++++++++++++ .../run-on/OrcaCloudSetupPanel.test.tsx | 30 +++++ .../run-on/OrcaCloudSetupPanel.tsx | 56 ++++++-- .../run-on/cloud-start-model.test.ts | 13 ++ .../new-workspace/run-on/cloud-start-model.ts | 14 +- .../run-on/cloud-start-preview-fixture.tsx | 14 +- .../run-on/use-cloud-start-steps.ts | 6 +- src/renderer/src/i18n/locales/en.json | 6 +- 9 files changed, 263 insertions(+), 46 deletions(-) create mode 100644 src/renderer/src/components/new-workspace/run-on/CloudStartModalWidth.fixture.tsx create mode 100644 src/renderer/src/components/new-workspace/run-on/OrcaCloudSetupPanel.test.tsx diff --git a/src/renderer/src/components/new-workspace/NewWorkspaceComposerFooter.tsx b/src/renderer/src/components/new-workspace/NewWorkspaceComposerFooter.tsx index c005d38a729..1bc6b24bab0 100644 --- a/src/renderer/src/components/new-workspace/NewWorkspaceComposerFooter.tsx +++ b/src/renderer/src/components/new-workspace/NewWorkspaceComposerFooter.tsx @@ -2,7 +2,6 @@ import React from 'react' import { LoaderCircle } from 'lucide-react' import { Button } from '@/components/ui/button' import { SwitchIndicator } from '@/components/ui/switch' -import { cn } from '@/lib/utils' import { useTranslate } from '@/i18n/use-translate' import { ButtonKeyHint } from '@/components/ButtonKeyHint' import type { NewWorkspaceComposerCardProps } from './new-workspace-composer-card-props' @@ -57,12 +56,9 @@ export function NewWorkspaceComposerFooter({ ) : null} -
+ {/* Wraps instead of overflowing: "Use this computer instead" plus a long primary label + ("Give access and start") don't fit beside "Create more" in the modal's width. */} +
{showCreateMultiple ? ( ) : null} - {cloudStart?.onUseThisComputer ? ( +
+ {cloudStart?.onUseThisComputer ? ( + + ) : null} - ) : null} - +
{heldReason ? ( {heldReason} diff --git a/src/renderer/src/components/new-workspace/run-on/CloudStartModalWidth.fixture.tsx b/src/renderer/src/components/new-workspace/run-on/CloudStartModalWidth.fixture.tsx new file mode 100644 index 00000000000..c0f0b899ede --- /dev/null +++ b/src/renderer/src/components/new-workspace/run-on/CloudStartModalWidth.fixture.tsx @@ -0,0 +1,120 @@ +// "Start in Orca Cloud" at the real modal's width (sm:max-w-lg, ~448px of content) with its +// "Create more" switch, where np4-e2e saw the primary button overflow the dialog's right edge. +// Also the setup session's plan row (no raw "subscription") and the plan + GitHub subtitle. +import { defineFixture } from '../../../component-fixtures/component-fixture' +import type { OrcaCloudRunTargetAccess } from '../orca-cloud-run-target-access' +import type { CloudSetupStep } from './cloud-start-model' +import { ComposerPreview } from './cloud-start-preview-fixture' + +const setup = (): void => { + window.api.agentApiKeys = undefined + window.api.cloudSecrets = undefined + window.api.orcaCloudAgents = undefined + window.api.cloudWorkspaces = { ...window.api.cloudWorkspaces, available: async () => true } +} +const CARD_WIDTH = 480 +const noPlan: OrcaCloudRunTargetAccess = { + state: 'no-plan', + lapsed: false, + canManageBilling: true +} +const githubNeeded: CloudSetupStep = { + id: 'github', + state: 'needed', + need: 'github', + canFix: true, + label: 'GitHub access', + status: 'Needed', + detail: 'Orca Cloud can’t reach nwparker/orca-sandbox-push-test yet.', + note: 'It clones your code from GitHub. Give access to this repository once.' +} + +/** Signed out at the modal's width: "Create more", "Use this computer instead", "Set up and start". */ +export const modalSignedOut = defineFixture({ + width: CARD_WIDTH + 40, + setup, + render: () => ( + + ) +}) + +/** Only GitHub is missing: the longer "Give access and start" at the modal's width. */ +export const modalGiveAccess = defineFixture({ + width: CARD_WIDTH + 40, + setup, + render: () => ( + + ) +}) + +/** No plan and no GitHub access: the subtitle names both parts of the one browser visit. */ +export const modalPlanAndGitHub = defineFixture({ + width: CARD_WIDTH + 40, + setup, + render: () => ( + + ) +}) + +/** A setup session after Checkout: Team plan done with no raw "subscription" under it. */ +export const sessionPlanDone = defineFixture({ + width: CARD_WIDTH + 40, + setup, + render: () => ( + + ) +}) + +/** A setup session mid-Checkout, with an owner's GitHub approval pending: codes read as words. */ +export const sessionCheckoutAndRequested = defineFixture({ + width: CARD_WIDTH + 40, + setup, + render: () => ( + + ) +}) diff --git a/src/renderer/src/components/new-workspace/run-on/OrcaCloudSetupPanel.test.tsx b/src/renderer/src/components/new-workspace/run-on/OrcaCloudSetupPanel.test.tsx new file mode 100644 index 00000000000..c36929e963a --- /dev/null +++ b/src/renderer/src/components/new-workspace/run-on/OrcaCloudSetupPanel.test.tsx @@ -0,0 +1,30 @@ +import { describe, expect, it } from 'vitest' +import { translate } from '@/i18n/i18n' +import { sessionDetailCopy } from './OrcaCloudSetupPanel' + +describe('sessionDetailCopy', () => { + // np4-e2e: the plan row read the session's raw "subscription". + it('never shows a setup session code on the row', () => { + expect( + sessionDetailCopy({ id: 'plan', state: 'done', detail: 'subscription' }, translate) + ).toBe(null) + expect(sessionDetailCopy({ id: 'plan', state: 'done', detail: 'trial' }, translate)).toBe( + 'Your trial covers it.' + ) + expect(sessionDetailCopy({ id: 'plan', state: 'active', detail: 'checkout' }, translate)).toBe( + 'Finish checkout in your browser.' + ) + expect( + sessionDetailCopy({ id: 'github', state: 'pending', detail: 'requested' }, translate) + ).toBe('Waiting for an owner on GitHub to approve Orca Cloud.') + }) + + it('leaves the composer’s own details alone', () => { + expect(sessionDetailCopy({ id: 'team', state: 'done', detail: 'acme' }, translate)).toBe( + undefined + ) + expect(sessionDetailCopy({ id: 'github', state: 'done', detail: 'acme/web' }, translate)).toBe( + undefined + ) + }) +}) diff --git a/src/renderer/src/components/new-workspace/run-on/OrcaCloudSetupPanel.tsx b/src/renderer/src/components/new-workspace/run-on/OrcaCloudSetupPanel.tsx index 26beb724acf..9018d1cc49c 100644 --- a/src/renderer/src/components/new-workspace/run-on/OrcaCloudSetupPanel.tsx +++ b/src/renderer/src/components/new-workspace/run-on/OrcaCloudSetupPanel.tsx @@ -8,6 +8,7 @@ import { Skeleton } from '@/components/ui/skeleton' import { cn } from '@/lib/utils' import { useTranslate, type Translate } from '@/i18n/use-translate' import { + cloudSetupNeedsGitHub, cloudSetupNeedsPlan, type CloudSetupStep, type CloudSetupStepId @@ -159,6 +160,34 @@ function planDetail(step: CloudSetupStep, t: Translate): string | null { } } +/** + * A setup session's rows name how a step is covered with a code ('subscription', 'trial', + * 'checkout', 'requested'); say it in words, or nothing. Undefined: not a session code. + */ +export function sessionDetailCopy(step: CloudSetupStep, t: Translate): string | null | undefined { + if (step.id === 'plan') { + switch (step.detail) { + case 'subscription': + // "Team plan · Done" already says it. + return null + case 'trial': + return t('components.newWorkspace.cloudSetup.planCoveredByTrial', 'Your trial covers it.') + case 'checkout': + return t( + 'components.newWorkspace.cloudSetup.planCheckoutOpen', + 'Finish checkout in your browser.' + ) + } + } + if (step.id === 'github' && step.detail === 'requested') { + return t( + 'components.newWorkspace.cloudSetup.githubRequestedSession', + 'Waiting for an owner on GitHub to approve Orca Cloud.' + ) + } + return undefined +} + function stateLabel(step: CloudSetupStep, t: Translate): string { switch (step.state) { case 'done': @@ -246,15 +275,20 @@ export function OrcaCloudSetupPanel({ 'components.newWorkspace.cloudSetup.subtitleOwnerFixes', 'An owner or admin needs to fix this. Your prompt stays here.' ) - : cloudSetupNeedsPlan(steps) + : cloudSetupNeedsPlan(steps) && cloudSetupNeedsGitHub(steps) ? t( - 'components.newWorkspace.cloudSetup.subtitleChoosePlan', - 'One visit to your browser to choose a plan. Your prompt stays here and starts when you’re done.' + 'components.newWorkspace.cloudSetup.subtitleChoosePlanAndGitHub', + 'One visit to your browser to choose a plan and give Orca Cloud access on GitHub. Your prompt stays here and starts when you’re done.' ) - : t( - 'components.newWorkspace.cloudSetup.subtitleNoCard', - 'One visit to your browser, no card. Your prompt stays here and starts when you’re done.' - )))} + : cloudSetupNeedsPlan(steps) + ? t( + 'components.newWorkspace.cloudSetup.subtitleChoosePlan', + 'One visit to your browser to choose a plan. Your prompt stays here and starts when you’re done.' + ) + : t( + 'components.newWorkspace.cloudSetup.subtitleNoCard', + 'One visit to your browser, no card. Your prompt stays here and starts when you’re done.' + )))}

{/* One polite announcement per row change ("Team plan, done"). */}
    @@ -263,6 +297,8 @@ export function OrcaCloudSetupPanel({ const title = step.label ?? copy.title const state = step.status ?? copy.status ?? stateLabel(step, t) const note = step.note ?? copy.note + const sessionDetail = sessionDetailCopy(step, t) + const detail = sessionDetail === undefined ? (step.detail ?? copy.detail) : sessionDetail return (
  • {title} {step.state === 'loading' ? ( - ) : (step.detail ?? copy.detail) ? ( - - {step.detail ?? copy.detail} - + ) : detail ? ( + {detail} ) : null} {note ? ( {note} diff --git a/src/renderer/src/components/new-workspace/run-on/cloud-start-model.test.ts b/src/renderer/src/components/new-workspace/run-on/cloud-start-model.test.ts index fb27f03f3be..d5d4fe9bada 100644 --- a/src/renderer/src/components/new-workspace/run-on/cloud-start-model.test.ts +++ b/src/renderer/src/components/new-workspace/run-on/cloud-start-model.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from 'vitest' import { + cloudSetupNeedsGitHub, deriveCloudSetupSteps, getCloudPrimaryAction, getOrcaCloudSegmentState, @@ -273,3 +274,15 @@ describe('withReachableGitHub', () => { expect(withReachableGitHub(steps, false)).toBe(steps) }) }) + +describe('cloudSetupNeedsGitHub', () => { + it('counts GitHub access the browser visit gives, not an approval, a missing remote or a check', () => { + expect(cloudSetupNeedsGitHub([{ id: 'github', state: 'needed', need: 'github' }])).toBe(true) + expect(cloudSetupNeedsGitHub([{ id: 'github', state: 'active' }])).toBe(true) + expect(cloudSetupNeedsGitHub([{ id: 'github', state: 'done' }])).toBe(false) + expect(cloudSetupNeedsGitHub([{ id: 'github', state: 'loading' }])).toBe(false) + expect( + cloudSetupNeedsGitHub([{ id: 'github', state: 'pending', need: 'github', blocksStart: true }]) + ).toBe(false) + }) +}) diff --git a/src/renderer/src/components/new-workspace/run-on/cloud-start-model.ts b/src/renderer/src/components/new-workspace/run-on/cloud-start-model.ts index a257c9ebebd..4ea27621248 100644 --- a/src/renderer/src/components/new-workspace/run-on/cloud-start-model.ts +++ b/src/renderer/src/components/new-workspace/run-on/cloud-start-model.ts @@ -191,6 +191,16 @@ export function cloudSetupNeedsPlan(steps: readonly CloudSetupStep[]): boolean { ) } +/** + * The same browser trip also gives Orca Cloud access to the repository on GitHub. An owner's + * approval (D2) or a project not on GitHub (D3) isn't part of the trip; still checking isn't either. + */ +export function cloudSetupNeedsGitHub(steps: readonly CloudSetupStep[]): boolean { + return getOpenSetupSteps(steps).some( + (step) => step.id === 'github' && !step.blocksStart && step.state !== 'loading' + ) +} + export type CloudPrimaryAction = | 'start' | 'setUpAndStart' @@ -273,7 +283,7 @@ export function withReachableGitHub( if (!reachable || !steps.some((step) => step.id === 'github' && step.state !== 'done')) { return steps } - return steps.map( - (step): CloudSetupStep => (step.id === 'github' ? { id: 'github', state: 'done' } : step) + return steps.map((step): CloudSetupStep => + step.id === 'github' ? { id: 'github', state: 'done' } : step ) } diff --git a/src/renderer/src/components/new-workspace/run-on/cloud-start-preview-fixture.tsx b/src/renderer/src/components/new-workspace/run-on/cloud-start-preview-fixture.tsx index 4c696b407ce..15445595c82 100644 --- a/src/renderer/src/components/new-workspace/run-on/cloud-start-preview-fixture.tsx +++ b/src/renderer/src/components/new-workspace/run-on/cloud-start-preview-fixture.tsx @@ -80,7 +80,9 @@ export function ComposerPreview({ prompt = 'Fix the flaky login test in e2e/auth.spec.ts and open a PR.', cloudRepos, pickedCloudRepo = null, - folderProject = false + folderProject = false, + showCreateMultiple = false, + width }: { availability: OrcaCloudAvailability access: OrcaCloudRunTargetAccess @@ -95,6 +97,10 @@ export function ComposerPreview({ pickedCloudRepo?: string | null /** The project is a plain folder (D3 for folders). */ folderProject?: boolean + /** The modal's "Create more" switch, which shares the footer row with the actions. */ + showCreateMultiple?: boolean + /** Pins the card's width, e.g. the modal's content width. */ + width?: number }): React.JSX.Element { const [picked, setPicked] = useState(pickedCloudRepo) const [host, setHost] = useState('local') @@ -135,7 +141,10 @@ export function ComposerPreview({ : {}) } return ( -
    +

    Create workspace

    {prompt}

    ) diff --git a/src/renderer/src/components/new-workspace/run-on/use-cloud-start-steps.ts b/src/renderer/src/components/new-workspace/run-on/use-cloud-start-steps.ts index d023a9876b6..23aadd91bce 100644 --- a/src/renderer/src/components/new-workspace/run-on/use-cloud-start-steps.ts +++ b/src/renderer/src/components/new-workspace/run-on/use-cloud-start-steps.ts @@ -8,7 +8,11 @@ import { useOrcaCloudRepoAccess } from '@/lib/orca-cloud/use-orca-cloud-repo-acc import { useCloudSetupSession } from '@/lib/orca-cloud/cloud-setup-session-seam' import type { OrcaCloudAvailability } from '../../../../../shared/orca-yaml-hook-types' import type { OrcaCloudRunTargetAccess } from '../orca-cloud-run-target-access' -import { deriveCloudSetupSteps, withReachableGitHub, type CloudSetupStep } from './cloud-start-model' +import { + deriveCloudSetupSteps, + withReachableGitHub, + type CloudSetupStep +} from './cloud-start-model' import { cloudStartAgentStep } from './cloud-start-agent-step' import { orcaCloudAgentSetupRow, diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index 99611446974..aba2658d8ea 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -23161,7 +23161,11 @@ "teamCreateFailed": "Couldn’t create the team. Nothing was created, and you weren’t charged.", "wrongAccount": "Signed in as {{email}}, who isn’t on {{team}}. Switch accounts or ask an owner of {{team}} for an invite.", "wrongAccountGeneric": "Signed in with an account that isn’t on this team. Switch accounts or ask an owner for an invite." - } + }, + "planCoveredByTrial": "Your trial covers it.", + "planCheckoutOpen": "Finish checkout in your browser.", + "githubRequestedSession": "Waiting for an owner on GitHub to approve Orca Cloud.", + "subtitleChoosePlanAndGitHub": "One visit to your browser to choose a plan and give Orca Cloud access on GitHub. Your prompt stays here and starts when you’re done." }, "runOn": { "thisComputer": "This computer",