feat: enhance loading state and organization selection UI on welcome page
This commit is contained in:
@@ -368,50 +368,73 @@ function WelcomeContent() {
|
|||||||
className={cardClass}
|
className={cardClass}
|
||||||
>
|
>
|
||||||
{orgsLoading ? (
|
{orgsLoading ? (
|
||||||
<div className="text-center py-8">
|
<div className="text-center py-12">
|
||||||
<p className="text-neutral-600 dark:text-neutral-400">Loading your workspaces...</p>
|
<div className="mx-auto h-8 w-8 border-2 border-brand-orange border-t-transparent rounded-full animate-spin mb-4" />
|
||||||
|
<p className="text-neutral-600 dark:text-neutral-400">Loading your organizations...</p>
|
||||||
</div>
|
</div>
|
||||||
) : organizations && organizations.length > 0 ? (
|
) : organizations && organizations.length > 0 ? (
|
||||||
<>
|
<>
|
||||||
<div className="text-center mb-6">
|
<div className="text-center mb-8">
|
||||||
<div className="mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-brand-orange/10 text-brand-orange mb-4">
|
<div className="mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-orange/20 to-brand-orange/5 text-brand-orange mb-5 shadow-sm">
|
||||||
<BarChartIcon className="h-7 w-7" />
|
<BarChartIcon className="h-8 w-8" />
|
||||||
</div>
|
</div>
|
||||||
<h2 className="text-xl font-bold text-neutral-900 dark:text-white">
|
<h2 className="text-2xl font-bold tracking-tight text-neutral-900 dark:text-white">
|
||||||
Choose your workspace
|
Choose your organization
|
||||||
</h2>
|
</h2>
|
||||||
<p className="mt-1 text-sm text-neutral-600 dark:text-neutral-400">
|
<p className="mt-2 text-sm text-neutral-500 dark:text-neutral-400 max-w-sm mx-auto">
|
||||||
Continue with an existing workspace or create a new one.
|
Continue with an existing one or create a new organization.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-2 mb-6">
|
<div className="space-y-2.5 mb-6">
|
||||||
{organizations.map((org) => (
|
{organizations.map((org, index) => {
|
||||||
<button
|
const isCurrent = user?.org_id === org.organization_id
|
||||||
|
const initial = (org.organization_name || 'O').charAt(0).toUpperCase()
|
||||||
|
return (
|
||||||
|
<motion.button
|
||||||
key={org.organization_id}
|
key={org.organization_id}
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => handleSelectWorkspace(org)}
|
onClick={() => handleSelectWorkspace(org)}
|
||||||
disabled={!!switchingOrgId}
|
disabled={!!switchingOrgId}
|
||||||
className="w-full flex items-center justify-between gap-3 rounded-xl border border-neutral-200 dark:border-neutral-700 bg-neutral-50 dark:bg-neutral-800/50 hover:bg-neutral-100 dark:hover:bg-neutral-800 hover:border-brand-orange/50 px-4 py-3 text-left transition-colors disabled:opacity-60"
|
initial={{ opacity: 0, y: 8 }}
|
||||||
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
transition={{ delay: index * 0.04, duration: 0.2 }}
|
||||||
|
className={`w-full flex items-center gap-3 rounded-xl border px-4 py-3.5 text-left transition-all duration-200 disabled:opacity-60 ${
|
||||||
|
isCurrent
|
||||||
|
? 'border-brand-orange/60 bg-brand-orange/5 dark:bg-brand-orange/10 shadow-sm'
|
||||||
|
: 'border-neutral-200 dark:border-neutral-700 bg-neutral-50/80 dark:bg-neutral-800/50 hover:bg-neutral-100 dark:hover:bg-neutral-800 hover:border-neutral-300 dark:hover:border-neutral-600 hover:shadow-sm'
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
<span className="font-medium text-neutral-900 dark:text-white">
|
<div
|
||||||
{org.organization_name || 'Workspace'}
|
className={`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold ${
|
||||||
</span>
|
isCurrent
|
||||||
{user?.org_id === org.organization_id && (
|
? 'bg-brand-orange/20 text-brand-orange dark:bg-brand-orange/30'
|
||||||
<span className="text-xs text-neutral-500 dark:text-neutral-400">Current</span>
|
: 'bg-neutral-200/80 dark:bg-neutral-700 text-neutral-600 dark:text-neutral-300'
|
||||||
)}
|
}`}
|
||||||
<ArrowRightIcon className="h-4 w-4 text-neutral-400 flex-shrink-0" />
|
>
|
||||||
</button>
|
{initial}
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
|
<span className="flex-1 font-medium text-neutral-900 dark:text-white truncate">
|
||||||
|
{org.organization_name || 'Organization'}
|
||||||
|
</span>
|
||||||
|
{isCurrent && (
|
||||||
|
<span className="text-xs font-medium text-brand-orange shrink-0">Current</span>
|
||||||
|
)}
|
||||||
|
<ArrowRightIcon className={`h-4 w-4 shrink-0 ${isCurrent ? 'text-brand-orange' : 'text-neutral-400'}`} />
|
||||||
|
</motion.button>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<div className="pt-2 border-t border-neutral-100 dark:border-neutral-800">
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
className="w-full"
|
className="w-full border border-dashed border-neutral-300 dark:border-neutral-600 hover:border-brand-orange/50 hover:bg-brand-orange/5 dark:hover:bg-brand-orange/10"
|
||||||
onClick={handleCreateNewWorkspace}
|
onClick={handleCreateNewWorkspace}
|
||||||
>
|
>
|
||||||
<PlusIcon className="h-4 w-4 mr-2" />
|
<PlusIcon className="h-4 w-4 mr-2" />
|
||||||
Create a new workspace
|
Create a new organization
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user