fix(new-workspace): clean up backgrounds, contrast, and loading UX (#816)
- fix(new-workspace): clean up backgrounds, contrast, and loading UX Address feedback on the NewWorkspacePage: drop the LightRays backdrop, repo badge-color radial gradient, and custom dark bg override so the page uses standard bg-background. Switch card surfaces from translucent bg-background/X to bg-muted/50 so cards read as distinct from the page in both themes. Give the unselected source toggles a visible bg+border. Size the task list card to its content (capped at viewport) instead of always stretching. Add a 3-row shimmer skeleton while the initial fetch is in flight (only when nothing is cached).
This commit is contained in:
@@ -29,7 +29,6 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip
|
||||
import RepoCombobox from '@/components/repo/RepoCombobox'
|
||||
import GitHubItemDrawer from '@/components/GitHubItemDrawer'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { LightRays } from '@/components/ui/light-rays'
|
||||
import { getLinkedWorkItemSuggestedName, getTaskPresetQuery } from '@/lib/new-workspace'
|
||||
import type { LinkedWorkItemSummary } from '@/lib/new-workspace'
|
||||
import { isGitRepoKind } from '../../../shared/repo-kind'
|
||||
@@ -411,29 +410,7 @@ export default function NewWorkspacePage(): React.JSX.Element {
|
||||
}, [closeNewWorkspacePage, drawerWorkItem])
|
||||
|
||||
return (
|
||||
<div className="relative flex h-full min-h-0 flex-1 overflow-hidden bg-background dark:bg-[#1a1a1a] text-foreground">
|
||||
{/* Why: 3 rays at blur=20 looks visually equivalent to 6 at 44 while
|
||||
cutting the compositor cost of the backdrop roughly 3x — the large
|
||||
blur radius + mix-blend-screen pass dominated paint time during
|
||||
page mount on integrated GPUs. */}
|
||||
<LightRays
|
||||
count={3}
|
||||
color="rgba(120, 160, 255, 0.15)"
|
||||
blur={20}
|
||||
speed={16}
|
||||
length="60vh"
|
||||
className="z-0"
|
||||
/>
|
||||
|
||||
{selectedRepo?.badgeColor && (
|
||||
<div
|
||||
className="pointer-events-none absolute inset-0 z-0 opacity-30 transition-opacity duration-700 ease-in-out"
|
||||
style={{
|
||||
background: `radial-gradient(circle at top right, ${selectedRepo.badgeColor}, transparent 75%)`
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="relative flex h-full min-h-0 flex-1 overflow-hidden bg-background text-foreground">
|
||||
<div className="relative z-10 flex min-h-0 flex-1 flex-col">
|
||||
{/* Why: left-aligned so it doesn't collide with the app sidebar on the
|
||||
right edge. The GitHub preview is a modal sheet that overlays the
|
||||
@@ -476,8 +453,8 @@ export default function NewWorkspacePage(): React.JSX.Element {
|
||||
className={cn(
|
||||
'group flex h-11 w-11 items-center justify-center rounded-xl border transition',
|
||||
active
|
||||
? 'border-border/50 bg-background/50 backdrop-blur-md supports-[backdrop-filter]:bg-background/50'
|
||||
: 'border-border/50 bg-transparent hover:bg-muted/40',
|
||||
? 'border-border bg-muted/70 shadow-sm'
|
||||
: 'border-border/70 bg-muted/30 hover:bg-muted/60 hover:border-border',
|
||||
source.disabled && 'cursor-not-allowed opacity-55'
|
||||
)}
|
||||
>
|
||||
@@ -497,13 +474,13 @@ export default function NewWorkspacePage(): React.JSX.Element {
|
||||
value={repoId}
|
||||
onValueChange={setRepoId}
|
||||
placeholder="Select a repository"
|
||||
triggerClassName="h-11 w-full rounded-[10px] border border-border/50 bg-background/50 backdrop-blur-md px-3 text-sm font-medium shadow-sm transition hover:bg-muted/50 focus:ring-2 focus:ring-ring/20 focus:outline-none supports-[backdrop-filter]:bg-background/50"
|
||||
triggerClassName="h-11 w-full rounded-[10px] border border-border/50 bg-muted/50 px-3 text-sm font-medium shadow-sm transition hover:bg-muted/50 focus:ring-2 focus:ring-ring/20 focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{taskSource === 'github' && (
|
||||
<div className="rounded-[16px] border border-border/50 bg-background/40 backdrop-blur-md p-4 shadow-sm supports-[backdrop-filter]:bg-background/40">
|
||||
<div className="rounded-[16px] border border-border/50 bg-muted/50 p-4 shadow-sm">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{TASK_QUERY_PRESETS.map((option) => {
|
||||
@@ -569,7 +546,7 @@ export default function NewWorkspacePage(): React.JSX.Element {
|
||||
onChange={handleTaskSearchChange}
|
||||
onKeyDown={handleTaskSearchKeyDown}
|
||||
placeholder="GitHub search, e.g. assignee:@me is:open"
|
||||
className="h-10 border-border/50 bg-background/50 pl-10 pr-10 backdrop-blur-md supports-[backdrop-filter]:bg-background/50"
|
||||
className="h-10 border-border/50 bg-background pl-10 pr-10"
|
||||
/>
|
||||
{taskSearchInput || appliedTaskSearch ? (
|
||||
<button
|
||||
@@ -595,7 +572,7 @@ export default function NewWorkspacePage(): React.JSX.Element {
|
||||
</div>
|
||||
|
||||
{taskSource === 'github' ? (
|
||||
<div className="mt-4 flex flex-1 flex-col min-h-0 rounded-[16px] border border-border/50 bg-background/30 backdrop-blur-md supports-[backdrop-filter]:bg-background/30 overflow-hidden shadow-sm">
|
||||
<div className="mt-4 flex min-h-0 max-h-full flex-col rounded-[16px] border border-border/50 bg-muted/50 overflow-hidden shadow-sm">
|
||||
<div className="flex-none hidden grid-cols-[96px_minmax(0,1.8fr)_minmax(140px,1fr)_150px_120px_90px] gap-4 border-b border-border/50 px-4 py-3 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground lg:grid">
|
||||
<span>ID</span>
|
||||
<span>Title / Context</span>
|
||||
@@ -606,7 +583,7 @@ export default function NewWorkspacePage(): React.JSX.Element {
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="flex-1 overflow-y-auto scrollbar-sleek"
|
||||
className="min-h-0 flex-initial overflow-y-auto scrollbar-sleek"
|
||||
style={{ scrollbarGutter: 'stable' }}
|
||||
>
|
||||
{tasksError ? (
|
||||
@@ -615,6 +592,41 @@ export default function NewWorkspacePage(): React.JSX.Element {
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{tasksLoading && filteredWorkItems.length === 0 ? (
|
||||
// Why: shimmer skeleton stands in for the first ~3 rows while
|
||||
// the initial fetch is in flight, so the card is never empty
|
||||
// or collapsed during load. Only shown when we have no cached
|
||||
// items — on revalidate we keep the stale list visible.
|
||||
<div className="divide-y divide-border/50">
|
||||
{Array.from({ length: 3 }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="grid w-full gap-4 px-4 py-4 lg:grid-cols-[96px_minmax(0,1.8fr)_minmax(140px,1fr)_150px_120px_90px]"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<div className="h-7 w-16 animate-pulse rounded-lg bg-muted/70" />
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div className="h-4 w-3/5 animate-pulse rounded bg-muted/70" />
|
||||
<div className="mt-2 h-3 w-2/5 animate-pulse rounded bg-muted/60" />
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<div className="h-3 w-24 animate-pulse rounded bg-muted/60" />
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<div className="h-5 w-14 animate-pulse rounded-full bg-muted/70" />
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<div className="h-3 w-20 animate-pulse rounded bg-muted/60" />
|
||||
</div>
|
||||
<div className="flex items-center justify-start lg:justify-end">
|
||||
<div className="h-7 w-16 animate-pulse rounded-xl bg-muted/70" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{!tasksLoading && filteredWorkItems.length === 0 ? (
|
||||
<div className="px-4 py-10 text-center">
|
||||
<p className="text-base font-medium text-foreground">No matching GitHub work</p>
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useMemo, useState, type CSSProperties } from 'react'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
type LightRaysProps = {
|
||||
ref?: React.Ref<HTMLDivElement>
|
||||
count?: number
|
||||
color?: string
|
||||
blur?: number
|
||||
speed?: number
|
||||
length?: string
|
||||
} & React.HTMLAttributes<HTMLDivElement>
|
||||
|
||||
type LightRay = {
|
||||
id: string
|
||||
left: number
|
||||
rotate: number
|
||||
width: number
|
||||
swing: number
|
||||
delay: number
|
||||
duration: number
|
||||
intensity: number
|
||||
}
|
||||
|
||||
const createRays = (count: number, cycle: number): LightRay[] => {
|
||||
if (count <= 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
return Array.from({ length: count }, (_, index) => {
|
||||
const left = 8 + Math.random() * 84
|
||||
const rotate = -28 + Math.random() * 56
|
||||
const width = 160 + Math.random() * 160
|
||||
const swing = 0.8 + Math.random() * 1.8
|
||||
const delay = Math.random() * cycle
|
||||
const duration = cycle * (0.75 + Math.random() * 0.5)
|
||||
const intensity = 0.6 + Math.random() * 0.5
|
||||
|
||||
return {
|
||||
id: `${index}-${Math.round(left * 10)}`,
|
||||
left,
|
||||
rotate,
|
||||
width,
|
||||
swing,
|
||||
delay,
|
||||
duration,
|
||||
intensity
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Why: CSS-only implementation of the magic-ui LightRays component to avoid
|
||||
* adding a framer-motion dependency. Uses CSS @keyframes for the fade+swing
|
||||
* animation cycle that the original drives with motion.animate.
|
||||
*/
|
||||
function Ray({
|
||||
left,
|
||||
rotate,
|
||||
width,
|
||||
swing,
|
||||
delay,
|
||||
duration,
|
||||
intensity
|
||||
}: LightRay): React.JSX.Element {
|
||||
const animName = `ray-fade-swing`
|
||||
|
||||
return (
|
||||
<div
|
||||
// Why: dropped mix-blend-screen — it forced an extra offscreen
|
||||
// compositing pass over each ray's bounding region every frame. The
|
||||
// additive glow look is approximated by slightly boosting the gradient
|
||||
// alpha and keeping willChange on so the layer stays on the compositor.
|
||||
className="pointer-events-none absolute -top-[12%] h-[var(--light-rays-length)] origin-top -translate-x-1/2 rounded-full bg-linear-to-b from-[color-mix(in_srgb,var(--light-rays-color)_85%,transparent)] to-transparent blur-[var(--light-rays-blur)]"
|
||||
style={
|
||||
{
|
||||
left: `${left}%`,
|
||||
width: `${width}px`,
|
||||
'--ray-intensity': intensity,
|
||||
'--ray-swing': `${swing}deg`,
|
||||
'--ray-rotate': `${rotate}deg`,
|
||||
animation: `${animName} ${duration}s ease-in-out ${delay}s infinite`,
|
||||
transform: `translateX(-50%) rotate(${rotate}deg)`,
|
||||
// Why: promote each ray to its own compositor layer so the
|
||||
// keyframe animation runs off the main thread. Without this,
|
||||
// Chromium rasterizes every swing tick on the UI thread which
|
||||
// stalls React renders while the NewWorkspace page mounts.
|
||||
willChange: 'transform, opacity'
|
||||
} as CSSProperties
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export function LightRays({
|
||||
className,
|
||||
style,
|
||||
count = 7,
|
||||
color = 'rgba(160, 210, 255, 0.2)',
|
||||
blur = 36,
|
||||
speed = 14,
|
||||
length = '70vh',
|
||||
ref,
|
||||
...props
|
||||
}: LightRaysProps): React.JSX.Element {
|
||||
// Why: users with prefers-reduced-motion should get a static backdrop
|
||||
// instead of an animated composite layer — both an accessibility and a
|
||||
// perf win on low-end GPUs.
|
||||
const prefersReducedMotion = useMemo(() => {
|
||||
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
|
||||
return false
|
||||
}
|
||||
return window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
||||
}, [])
|
||||
|
||||
const effectiveCount = prefersReducedMotion ? 0 : count
|
||||
const [rays, setRays] = useState<LightRay[]>([])
|
||||
const cycleDuration = Math.max(speed, 0.1)
|
||||
|
||||
useEffect(() => {
|
||||
setRays(createRays(effectiveCount, cycleDuration))
|
||||
}, [effectiveCount, cycleDuration])
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn(
|
||||
'pointer-events-none absolute inset-0 isolate overflow-hidden rounded-[inherit]',
|
||||
className
|
||||
)}
|
||||
style={
|
||||
{
|
||||
'--light-rays-color': color,
|
||||
'--light-rays-blur': `${blur}px`,
|
||||
'--light-rays-length': length,
|
||||
...style
|
||||
} as CSSProperties
|
||||
}
|
||||
{...props}
|
||||
>
|
||||
{/* Why: the @keyframes block lives here as a <style> tag so the component
|
||||
is self-contained and doesn't require a global CSS import. The animation
|
||||
fades each ray from transparent → peak intensity → transparent while
|
||||
applying a subtle rotation swing. */}
|
||||
<style>{`
|
||||
@keyframes ray-fade-swing {
|
||||
0%, 100% { opacity: 0; transform: translateX(-50%) rotate(calc(var(--ray-rotate, 0deg) - var(--ray-swing, 1deg))); }
|
||||
50% { opacity: var(--ray-intensity, 0.7); transform: translateX(-50%) rotate(calc(var(--ray-rotate, 0deg) + var(--ray-swing, 1deg))); }
|
||||
}
|
||||
`}</style>
|
||||
<div className="absolute inset-0 overflow-hidden">
|
||||
<div
|
||||
aria-hidden
|
||||
className="absolute inset-0 opacity-60"
|
||||
style={
|
||||
{
|
||||
background:
|
||||
'radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--light-rays-color) 45%, transparent), transparent 70%)'
|
||||
} as CSSProperties
|
||||
}
|
||||
/>
|
||||
<div
|
||||
aria-hidden
|
||||
className="absolute inset-0 opacity-60"
|
||||
style={
|
||||
{
|
||||
background:
|
||||
'radial-gradient(circle at 80% 10%, color-mix(in srgb, var(--light-rays-color) 35%, transparent), transparent 75%)'
|
||||
} as CSSProperties
|
||||
}
|
||||
/>
|
||||
{rays.map((ray) => (
|
||||
<Ray key={ray.id} {...ray} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user