mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 19:34:29 +00:00
fix(cloud): JA-30 Home actions shrink to one row in a narrow centre column
design-squad: at 900 wide with both side panels open, Add project / Create workspace stacked as two large buttons over the cloud list. The row is now LandingActions (landing-layout.tsx); over the cloud list its column is an @container and below 600px both buttons take small sizing on one row (wrapping only if they still can't fit). Fixtures: landing-layout actionsOverCloudList Wide/Narrow.
This commit is contained in:
@@ -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
|
||||
@@ -265,7 +265,7 @@ export default function Landing(): React.JSX.Element {
|
||||
<div
|
||||
className={cn('flex w-full flex-col items-center', cloudListPresent ? 'pt-8' : 'my-auto')}
|
||||
>
|
||||
<div className={cn('w-full px-6', cloudListPresent ? 'max-w-3xl' : 'max-w-lg')}>
|
||||
<div className={cn('w-full px-6', cloudListPresent ? '@container max-w-3xl' : 'max-w-lg')}>
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col',
|
||||
@@ -290,25 +290,13 @@ export default function Landing(): React.JSX.Element {
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={cn(
|
||||
'flex items-center gap-2.5 flex-wrap',
|
||||
cloudListPresent ? 'justify-start' : 'justify-center'
|
||||
)}
|
||||
>
|
||||
<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}
|
||||
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user