Files
supabase/apps/studio/components/ui/AIAssistantPanel/AIOnboarding.tsx
Joshen Lim 09a1f431bc Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## 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).
```
2026-10-14 12:56:55 +02:00

82 lines
2.5 KiB
TypeScript

import { MessageSquarePlusIcon } from 'lucide-react'
import type { ReactNode } from 'react'
import { CHAT_TEMPLATES, codeSnippetPrompts } from './AIAssistant.prompts'
import { ActionCard } from '@/components/layouts/Tabs/ActionCard'
import type { SqlSnippet } from '@/state/ai-assistant-state'
interface AIOnboardingProps {
children: ReactNode
sqlSnippets?: SqlSnippet[]
suggestions?: {
title?: string
prompts?: { label: string; description: string }[]
}
onValueChange: (value: string) => void
onFocusInput?: () => void
}
export const AIOnboarding = ({
children,
sqlSnippets,
suggestions,
onValueChange,
onFocusInput,
}: AIOnboardingProps) => {
const suggestionPrompts = suggestions?.prompts ?? []
const hasSuggestions = suggestionPrompts.length > 0
let templates = CHAT_TEMPLATES
if (hasSuggestions) {
templates = suggestionPrompts.map((suggestion) => ({
title: suggestion.label,
icon: MessageSquarePlusIcon,
initialMessage: suggestion.description,
}))
} else if (sqlSnippets && sqlSnippets.length > 0) {
templates = codeSnippetPrompts.map((prompt) => ({
title: prompt.title,
icon: prompt.icon,
initialMessage: prompt.prompt,
}))
}
return (
<div className="@container flex min-h-0 flex-1 flex-col overflow-y-auto px-6 py-8">
<div className="m-auto w-full max-w-2xl">
<div className="mb-6 text-center">
<h2 className="heading-section">Chat with your project</h2>
</div>
{children}
<section className="mt-8 flex flex-col gap-y-3">
{hasSuggestions && suggestions?.title && (
<h3 className="text-sm font-medium text-foreground">{suggestions.title}</h3>
)}
<div className="grid grid-cols-1 gap-3 @2xl:grid-cols-3">
{templates.map((template) => (
<button
key={template.title}
type="button"
tabIndex={0}
className="rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
onClick={() => {
onValueChange(template.initialMessage)
onFocusInput?.()
}}
>
<ActionCard
icon={<template.icon className="h-4 w-4 text-foreground" strokeWidth={1.5} />}
title={template.title}
bgColor="bg-brand-400"
/>
</button>
))}
</div>
</section>
</div>
</div>
)
}