Merge pull request #418 from nwparker/cloud/w2-ja30-cloud-home

feat(cloud): JA-30 cloud Home without clutter (filters from 5, first-run invitation, no wordmark over the list)
This commit is contained in:
Neil
2026-11-11 03:25:23 -08:00
committed by GitHub
9 changed files with 239 additions and 65 deletions
+27 -34
View File
@@ -5,7 +5,7 @@ import {
} from './cloud-workspaces/CloudWorkspacesHome'
import { useCloudWorkspaceHighlight } from './cloud-workspaces/cloud-workspace-links'
import { useEffect, useEffectEvent, useMemo, useRef, useState } from 'react'
import { AlertTriangle, ExternalLink, FolderPlus, GitBranchPlus, Star, X } from 'lucide-react'
import { AlertTriangle, ExternalLink, Star, X } from 'lucide-react'
import { cn } from '../lib/utils'
import { useAppStore } from '../store'
import { isGitRepoKind } from '../../../shared/repo-kind'
@@ -23,7 +23,7 @@ import { useLandingPreflightRuntime } from './landing-preflight-runtime'
import { useLandingOrcaStarState, type LandingStarState } from './landing-github-star-state'
import { openAppHttpLink } from '@/lib/browser/navigation/app-http-link-open'
import {
LANDING_ACTION_BUTTON_CLASS,
LandingActions,
LandingBrand,
LandingShortcutList,
type LandingShortcutItem
@@ -260,50 +260,43 @@ export default function Landing(): React.JSX.Element {
return (
<div className="scrollbar-sleek absolute inset-0 flex flex-col items-center overflow-y-auto bg-background">
{/* Centered when alone; with cloud workspaces below, a smaller brand block sits near the
top and the shortcut list steps aside so the list is the focus. */}
{/* Centered when alone. With the cloud list below, the list is the page (JA-30): no wordmark
or "select a workspace" line, just the primary actions as a top row aligned with it. */}
<div
className={cn(
'flex w-full flex-col items-center',
cloudListPresent ? 'pt-[12vh]' : 'my-auto'
)}
className={cn('flex w-full flex-col items-center', cloudListPresent ? 'pt-8' : 'my-auto')}
>
<div className="w-full max-w-lg px-6">
<div className={cn('w-full px-6', cloudListPresent ? '@container max-w-3xl' : 'max-w-lg')}>
<div
className={cn(
'flex flex-col items-center',
cloudListPresent ? 'gap-3 py-4' : 'gap-4 py-8'
'flex flex-col',
cloudListPresent ? 'items-start gap-3 pb-4' : 'items-center gap-4 py-8'
)}
>
<LandingBrand compact={cloudListPresent} />
{!cloudListPresent && <LandingBrand compact={false} />}
{preflightIssues.length > 0 && (
<PreflightBanner issues={preflightIssues} repos={repos} />
)}
<p className="text-sm text-muted-foreground text-center">
{hasProjects
? t(
'auto.components.Landing.9c00bd4adf',
'Select a workspace from the sidebar to begin.'
)
: t('auto.components.Landing.cd21242762', 'Add a project to get started.')}
</p>
{/* With the cloud list showing, only the no-project hint stays: the list is what to pick. */}
{(!cloudListPresent || !hasProjects) && (
<p className="text-sm text-muted-foreground text-center">
{hasProjects
? t(
'auto.components.Landing.9c00bd4adf',
'Select a workspace from the sidebar to begin.'
)
: t('auto.components.Landing.cd21242762', 'Add a project to get started.')}
</p>
)}
<div className="flex items-center justify-center gap-2.5 flex-wrap">
<button className={LANDING_ACTION_BUTTON_CLASS} onClick={() => openModal('add-repo')}>
<FolderPlus className="size-3.5" />
{t('auto.components.Landing.f9eaa9e12d', 'Add project')}
</button>
<button
className={LANDING_ACTION_BUTTON_CLASS}
onClick={() => openModal('new-workspace-composer', { telemetrySource: 'unknown' })}
>
<GitBranchPlus className="size-3.5" />
{createActionLabel}
</button>
</div>
<LandingActions
overCloudList={cloudListPresent}
addProjectLabel={t('auto.components.Landing.f9eaa9e12d', 'Add project')}
createLabel={createActionLabel}
onAddProject={() => openModal('add-repo')}
onCreate={() => openModal('new-workspace-composer', { telemetrySource: 'unknown' })}
/>
{hasProjects ? <LandingCloudCard cloudWorkspacesPresent={cloudListPresent} /> : null}
@@ -309,3 +309,38 @@ export const routineRunsShown = defineFixture({
await waitFor(() => document.querySelector('[aria-label="Routine run"]') !== null)
}
})
/** JA-30: a few workspaces (under 5) and no filter on: title and count only, no filter row. */
export const fewWorkspaces = defineFixture({
width: WIDTH,
store: { orcaProfileAuthStatus: AUTH_STATUS },
setup: () => {
const rows = teamWorkspaces().slice(0, 3)
stubCloudWorkspacesApi(() => Promise.resolve({ ok: true, value: rows }))
},
render: () => <CloudWorkspacesHome />,
interact: () => waitFor(() => document.querySelector('[data-cloud-workspace-row]') !== null)
})
/** JA-30: Mine on a team where others have workspaces: "You don't have any…", same button. */
export const emptyMine = defineFixture({
width: WIDTH,
store: { orcaProfileAuthStatus: AUTH_STATUS },
setup: () => {
const rows = teamWorkspaces()
stubCloudWorkspacesApi(() => Promise.resolve({ ok: true, value: rows }))
Object.assign(window.api.cloudWorkspaces, {
list: (query: { scope?: string }) =>
Promise.resolve({ ok: true as const, value: query.scope === 'mine' ? [] : rows })
})
},
render: () => <CloudWorkspacesHome />,
interact: async () => {
await waitFor(() => document.querySelector('[data-cloud-workspace-row]') !== null)
const mine = [...document.querySelectorAll<HTMLElement>('[role="radio"], button')].find(
(el) => el.textContent?.trim() === 'Mine'
)
mine?.click()
await waitFor(() => (document.querySelector('section')?.textContent ?? '').includes('yet.'))
}
})
@@ -17,7 +17,7 @@ import { CloudWorkspaceRow } from './CloudWorkspaceRow'
import { CloudWorkspaceGroupView, rowDragProps } from './CloudWorkspaceGroup'
import { useCloudWorkspaceArrangement } from './use-cloud-workspace-arrangement'
import { NEW_SECTION } from './CloudWorkspaceRowMenu'
import { ANY, CloudWorkspacesToolbar } from './CloudWorkspacesToolbar'
import { ANY, CloudWorkspacesToolbar, shouldShowCloudHomeFilters } from './CloudWorkspacesToolbar'
import { EmptyState, ErrorState, NewSectionDialog, SkeletonRows } from './CloudWorkspacesStates'
import { useCloudHomeFilters } from './use-cloud-home-filters'
import { CloudWorkspaceConfirmDialog, type PendingConfirm } from './CloudWorkspaceConfirmDialog'
@@ -259,8 +259,8 @@ export function CloudWorkspacesHome({
selfId={selfId}
metaStale={stale}
meta={
state.status === 'ready'
? // Why: no hours here. A sum over the listed workspaces isn't the team's month, and it
state.status === 'ready' && visible.length > 0
? // Why: no hours here. Empty: the empty card says so; no "0 workspaces" (JA-30). A sum over the listed workspaces isn't the team's month, and it
// disagreed with Plan & billing and the account menu (JA-07).
t('auto.components.cloudWorkspaces.listMetaCount', '{{count}} workspaces', {
count: visible.length,
@@ -271,6 +271,7 @@ export function CloudWorkspacesHome({
reading={reading}
onRefresh={refresh}
routineRuns={routineRuns}
showFilters={shouldShowCloudHomeFilters(all.length, filters, Boolean(orgId))}
/>
<div
@@ -297,6 +298,7 @@ export function CloudWorkspacesHome({
scope={scope}
archived={filters.archived}
filtered={by !== ANY || repo !== ANY}
hasOrg={Boolean(orgId)}
/>
)}
{state.status === 'ready' &&
@@ -1,7 +1,11 @@
// @vitest-environment happy-dom
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
import { afterEach, expect, it, vi } from 'vitest'
import { ErrorState } from './CloudWorkspacesStates'
import { EmptyState, ErrorState } from './CloudWorkspacesStates'
import {
INITIAL_CLOUD_WORKSPACE_FILTERS as DEFAULTS,
shouldShowCloudHomeFilters
} from './CloudWorkspacesToolbar'
afterEach(cleanup)
@@ -38,3 +42,43 @@ it('at the running-sandbox limit offers Show cloud workspaces instead of a retry
expect(screen.queryByRole('button', { name: 'Try again' })).toBeNull()
expect(screen.getByRole('button', { name: 'Show cloud workspaces' })).toBeTruthy()
})
it('an empty list invites the first cloud workspace, with one button (JA-30)', () => {
render(<EmptyState scope="team" archived={false} filtered={false} />)
expect(screen.getByText('Start your first cloud workspace')).toBeTruthy()
expect(
screen.getByText(
'It runs in a sandbox, so your agents keep working even when this computer is off.'
)
).toBeTruthy()
expect(screen.getAllByRole('button').map((b) => b.textContent)).toEqual(['New cloud workspace'])
})
it('an empty Mine list on a team says yours is empty, with the same button', () => {
render(<EmptyState scope="mine" archived={false} filtered={false} hasOrg />)
expect(screen.getByText('You don’t have any cloud workspaces yet.')).toBeTruthy()
expect(screen.queryByText('Start your first cloud workspace')).toBeNull()
expect(screen.getByRole('button', { name: 'New cloud workspace' })).toBeTruthy()
cleanup()
// No team: Mine is the only list, so it is the first-run invitation.
render(<EmptyState scope="mine" archived={false} filtered={false} hasOrg={false} />)
expect(screen.getByText('Start your first cloud workspace')).toBeTruthy()
})
it('filtered and archived empty lists keep their own copy and offer no create button', () => {
render(<EmptyState scope="team" archived={false} filtered />)
expect(screen.getByText('Nothing matches these filters')).toBeTruthy()
expect(screen.queryByRole('button')).toBeNull()
})
it('shows the filters from 5 workspaces, or whenever a filter is on so it can be undone', () => {
expect(shouldShowCloudHomeFilters(0, DEFAULTS, true)).toBe(false)
expect(shouldShowCloudHomeFilters(4, DEFAULTS, true)).toBe(false)
expect(shouldShowCloudHomeFilters(5, DEFAULTS, true)).toBe(true)
expect(shouldShowCloudHomeFilters(0, { ...DEFAULTS, archived: true }, true)).toBe(true)
expect(shouldShowCloudHomeFilters(1, { ...DEFAULTS, scope: 'mine' }, true)).toBe(true)
expect(shouldShowCloudHomeFilters(1, { ...DEFAULTS, repo: 'https://x/y' }, true)).toBe(true)
expect(shouldShowCloudHomeFilters(1, { ...DEFAULTS, running: true }, true)).toBe(true)
// Without a team there is no Team/Mine choice: Mine is not a filter there.
expect(shouldShowCloudHomeFilters(1, { ...DEFAULTS, scope: 'mine' }, false)).toBe(false)
})
@@ -143,13 +143,21 @@ export function SkeletonRows(): React.JSX.Element {
export function EmptyState({
scope,
archived,
filtered
filtered,
hasOrg = true
}: {
scope: 'team' | 'mine'
archived: boolean
filtered: boolean
/** On a team: an empty Mine list says it's yours that's empty, not that nobody has started one. */
hasOrg?: boolean
}): React.JSX.Element {
const t = useTranslate()
// Nothing to filter or share yet: say how to start one (JA-30), in the glossary's own words.
const startBody = t(
'components.cloudWorkspaces.emptyStartBody',
'It runs in a sandbox, so your agents keep working even when this computer is off.'
)
const [title, body] = filtered
? [
t('auto.components.cloudWorkspaces.emptyFilteredTitle', 'Nothing matches these filters'),
@@ -163,20 +171,17 @@ export function EmptyState({
'Archived cloud workspaces show up here.'
)
]
: scope === 'team'
: scope === 'mine' && hasOrg
? [
t('auto.components.cloudWorkspaces.emptyTeamTitle', 'No team workspaces yet'),
t(
'auto.components.cloudWorkspaces.emptyTeamBody',
'Share a cloud workspace from its menu and everyone on your team can open it here.'
)
'components.cloudWorkspaces.emptyMineYoursTitle',
'You don’t have any cloud workspaces yet.'
),
startBody
]
: [
t('auto.components.cloudWorkspaces.emptyMineTitle', 'No cloud workspaces yet'),
t(
'components.cloudWorkspaces.emptyMineStartBody',
'Start one and it keeps running while your laptop sleeps.'
)
t('components.cloudWorkspaces.emptyFirstTitle', 'Start your first cloud workspace'),
startBody
]
// Spec E3: an empty Mine or Team list offers a real button, not just copy.
const offerCreate = !filtered && !archived
@@ -47,6 +47,28 @@ export const INITIAL_CLOUD_WORKSPACE_FILTERS: CloudWorkspacesFilters = {
routines: false
}
/** Below this many workspaces there is little to filter: the filters and refresh stay out of the way. */
export const CLOUD_HOME_FILTERS_MIN = 5
/**
* Whether Home shows its filter row (and refresh): only with enough workspaces to filter (JA-30),
* but always while any filter is off its default, so a filter that hides rows can still be undone.
*/
export function shouldShowCloudHomeFilters(
count: number,
filters: CloudWorkspacesFilters,
hasOrg: boolean
): boolean {
const active =
(hasOrg && filters.scope !== INITIAL_CLOUD_WORKSPACE_FILTERS.scope) ||
filters.by !== ANY ||
filters.repo !== ANY ||
filters.archived ||
filters.running === true ||
filters.routines === true
return active || count >= CLOUD_HOME_FILTERS_MIN
}
/** Row 1: title, count and cost, refresh. Row 2: whose, by whom, which repo, running, routine runs, archived. */
export function CloudWorkspacesToolbar({
filters,
@@ -60,7 +82,8 @@ export function CloudWorkspacesToolbar({
metaStale,
reading,
onRefresh,
routineRuns
routineRuns,
showFilters = true
}: {
filters: CloudWorkspacesFilters
onFiltersChange: (next: Partial<CloudWorkspacesFilters>) => void
@@ -76,6 +99,8 @@ export function CloudWorkspacesToolbar({
onRefresh: () => void
/** What the Routine runs switch hides; the switch exists only when the team has routines. */
routineRuns?: CloudWorkspaceRoutineRuns
/** False with only a few workspaces and no filter on: title and count only (JA-30). */
showFilters?: boolean
}): React.JSX.Element {
const t = useTranslate()
// Routines start cloud workspaces on their own, so they sit next to the list they fill.
@@ -105,18 +130,20 @@ export function CloudWorkspacesToolbar({
{t('auto.components.cloudWorkspaces.routines', 'Routines')}
</Button>
) : null}
<Button
size="icon-xs"
variant="ghost"
onClick={onRefresh}
aria-busy={reading}
aria-label={t('auto.components.cloudWorkspaces.refresh', 'Refresh cloud workspaces')}
>
<RefreshCw className={cn(reading && 'motion-safe:animate-spin')} />
</Button>
{showFilters ? (
<Button
size="icon-xs"
variant="ghost"
onClick={onRefresh}
aria-busy={reading}
aria-label={t('auto.components.cloudWorkspaces.refresh', 'Refresh cloud workspaces')}
>
<RefreshCw className={cn(reading && 'motion-safe:animate-spin')} />
</Button>
) : null}
</span>
</div>
<div className="flex flex-wrap items-center gap-2">
<div className={cn('flex flex-wrap items-center gap-2', !showFilters && 'hidden')}>
{hasOrg && (
<div className="flex h-7 shrink-0 items-center">
<SettingsSegmentedControl
@@ -0,0 +1,27 @@
import { defineFixture } from '../component-fixtures/component-fixture'
import { LandingActions } from './landing-layout'
const noop = (): void => {}
function row(width: number): React.JSX.Element {
return (
<div className="bg-background p-4">
<div className="@container w-full px-6" style={{ width }}>
<LandingActions
overCloudList
addProjectLabel="Add project"
createLabel="Create workspace"
onAddProject={noop}
onCreate={noop}
/>
<div className="mt-4 h-24 rounded-xl border border-border bg-card" />
</div>
</div>
)
}
/** JA-30: over the cloud list in a wide centre column, the full-size top row. */
export const actionsOverCloudListWide = defineFixture({ width: 800, render: () => row(768) })
/** JA-30: a narrow centre column (both side panels open): small buttons, still one row. */
export const actionsOverCloudListNarrow = defineFixture({ width: 580, render: () => row(540) })
@@ -1,3 +1,4 @@
import { FolderPlus, GitBranchPlus } from 'lucide-react'
import { cn } from '@/lib/utils'
import { ShortcutKeyCombo } from './ShortcutKeyCombo'
import type { ShortcutKeyComboDetails } from '@/hooks/useShortcutLabel'
@@ -63,3 +64,44 @@ export function LandingShortcutList({
</div>
)
}
/**
* Home's two primary actions. Over the cloud list they sit as a top row aligned with it; in a
* narrow centre column (both side panels open) they shrink and stay on one row instead of
* stacking large buttons (JA-30). Needs an `@container` ancestor for the narrow case.
*/
export function LandingActions({
overCloudList,
addProjectLabel,
createLabel,
onAddProject,
onCreate
}: {
overCloudList: boolean
addProjectLabel: string
createLabel: string
onAddProject: () => void
onCreate: () => void
}): React.JSX.Element {
const buttonClass = cn(
LANDING_ACTION_BUTTON_CLASS,
overCloudList && '@max-[600px]:px-2.5 @max-[600px]:py-1 @max-[600px]:text-xs'
)
return (
<div
className={cn(
'flex items-center gap-2.5 flex-wrap',
overCloudList ? 'justify-start' : 'justify-center'
)}
>
<button className={buttonClass} onClick={onAddProject}>
<FolderPlus className="size-3.5" />
{addProjectLabel}
</button>
<button className={buttonClass} onClick={onCreate}>
<GitBranchPlus className="size-3.5" />
{createLabel}
</button>
</div>
)
}
+4 -5
View File
@@ -20979,9 +20979,6 @@
"emptyArchivedTitle": "No archived workspaces",
"emptyFilteredBody": "Try another owner or repository.",
"emptyFilteredTitle": "Nothing matches these filters",
"emptyMineTitle": "No cloud workspaces yet",
"emptyTeamBody": "Share a cloud workspace from its menu and everyone on your team can open it here.",
"emptyTeamTitle": "No team workspaces yet",
"environmentName": "{{value0}} (cloud)",
"errorConcurrencyLimit": "You're at your team's limit of running sandboxes. Put one to sleep or delete it, then try again.",
"errorMemberConcurrencyLimit": "You're at your limit of running sandboxes. Put one to sleep or delete it, then try again.",
@@ -23709,8 +23706,10 @@
}
},
"cloudWorkspaces": {
"emptyMineStartBody": "Start one and it keeps running while your laptop sleeps.",
"newCloudWorkspace": "New cloud workspace"
"newCloudWorkspace": "New cloud workspace",
"emptyStartBody": "It runs in a sandbox, so your agents keep working even when this computer is off.",
"emptyMineYoursTitle": "You don’t have any cloud workspaces yet.",
"emptyFirstTitle": "Start your first cloud workspace"
},
"worktreeCreation": {
"pendingNativeChat": {