mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Context This is largely just a mechanical change here: Opting to use lucide icons with the `Icon` suffix across all icon imports within `studio` - so that it’s clearer which components are icons + reduces the possibility of name collision with our own components - e.g <User /> vs <UserIcon /> Also added a eslint rule for this: <img width="1069" height="167" alt="image" src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc" /> And updated `AGENTS.md` as such: ``` Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced). ```
123 lines
4.0 KiB
TypeScript
123 lines
4.0 KiB
TypeScript
import { ArrowRightIcon } from 'lucide-react'
|
||
import { useState, type ComponentType } from 'react'
|
||
import { Badge, Button, cn } from 'ui'
|
||
|
||
import {
|
||
ChatWireframe,
|
||
NotebooksWireframe,
|
||
RunSqlWireframe,
|
||
WelcomeWireframe,
|
||
} from './ExplorerOnboardingWireframes'
|
||
import { useExplorerPreferences } from '@/components/interfaces/Account/Preferences/useExplorerPreferences'
|
||
|
||
const ONBOARDING_STEPS: Array<{
|
||
Wireframe: ComponentType
|
||
title: string
|
||
description: string
|
||
isPreview?: boolean
|
||
}> = [
|
||
{
|
||
Wireframe: WelcomeWireframe,
|
||
title: 'Welcome to Explorer',
|
||
description:
|
||
'Interact with your database and logs in one place. Run SQL, save your work to notebooks, and chat with Assistant.',
|
||
isPreview: true,
|
||
},
|
||
{
|
||
Wireframe: RunSqlWireframe,
|
||
title: 'Run SQL',
|
||
description:
|
||
'Run any SQL on your database, just like in the SQL Editor. You can also query your logs and chart the results.',
|
||
},
|
||
{
|
||
Wireframe: NotebooksWireframe,
|
||
title: 'Notebooks',
|
||
description:
|
||
'Snippets have evolved into notebooks. Combine multiple queries with markdown notes for you, your team, or Assistant to run later.',
|
||
},
|
||
{
|
||
Wireframe: ChatWireframe,
|
||
title: 'Chat with your project',
|
||
description:
|
||
'Ask Assistant to write queries, explain results, or build notebooks for you. Your organization’s AI settings control what it can access.',
|
||
},
|
||
]
|
||
|
||
export const ExplorerOnboarding = () => {
|
||
const { completeOnboarding, isReady } = useExplorerPreferences()
|
||
const [stepIndex, setStepIndex] = useState(0)
|
||
|
||
const step = ONBOARDING_STEPS[stepIndex]
|
||
const isFirstStep = stepIndex === 0
|
||
const isLastStep = stepIndex === ONBOARDING_STEPS.length - 1
|
||
const { Wireframe } = step
|
||
|
||
return (
|
||
<div className="flex h-full min-h-0 flex-col items-center overflow-y-auto bg-surface-100 px-6">
|
||
<div className="my-auto w-full max-w-xl shrink-0 space-y-8 py-12">
|
||
<div aria-live="polite" className="space-y-6">
|
||
<Wireframe />
|
||
<div className="min-h-24 space-y-2">
|
||
<div className="flex items-center gap-2">
|
||
<h1 className="heading-section">{step.title}</h1>
|
||
{step.isPreview && <Badge variant="default">Preview</Badge>}
|
||
</div>
|
||
<p className="text-base leading-relaxed text-foreground-light">{step.description}</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div className="flex items-center justify-between gap-4">
|
||
<div className="flex items-center gap-1.5">
|
||
<span className="sr-only">
|
||
Step {stepIndex + 1} of {ONBOARDING_STEPS.length}
|
||
</span>
|
||
{ONBOARDING_STEPS.map(({ title }, index) => (
|
||
<span
|
||
key={title}
|
||
aria-hidden="true"
|
||
className={cn(
|
||
'h-1.5 rounded-full transition-all',
|
||
index === stepIndex ? 'w-4 bg-foreground' : 'w-1.5 bg-border-stronger'
|
||
)}
|
||
/>
|
||
))}
|
||
</div>
|
||
|
||
<div className="flex items-center gap-2">
|
||
{!isLastStep && (
|
||
<Button type="button" variant="text" onClick={completeOnboarding} disabled={!isReady}>
|
||
Skip
|
||
</Button>
|
||
)}
|
||
{!isFirstStep && (
|
||
<Button type="button" variant="default" onClick={() => setStepIndex(stepIndex - 1)}>
|
||
Back
|
||
</Button>
|
||
)}
|
||
{isLastStep ? (
|
||
<Button
|
||
type="button"
|
||
variant="primary"
|
||
iconRight={<ArrowRightIcon />}
|
||
onClick={completeOnboarding}
|
||
disabled={!isReady}
|
||
>
|
||
Continue to Explorer
|
||
</Button>
|
||
) : (
|
||
<Button
|
||
type="button"
|
||
variant="primary"
|
||
iconRight={<ArrowRightIcon />}
|
||
onClick={() => setStepIndex(stepIndex + 1)}
|
||
>
|
||
Next
|
||
</Button>
|
||
)}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
)
|
||
}
|