Files
supabase/apps/studio/components/interfaces/Explorer/ExplorerHomeTab.tsx
T
Saxon Fletcher c33d255eba chore(studio): refine assistant empty states (#50191)
<img width="1062" height="712" alt="image"
src="https://github.com/user-attachments/assets/44c82e00-94b4-405a-b2ef-cbc08401c4db"
/>

<img width="1583" height="962" alt="image"
src="https://github.com/user-attachments/assets/b19b9fd8-24b1-48d6-8b31-11fba9911b9a"
/>


## What kind of change does this PR introduce?
UI refinement.

## What is the current behavior?
The assistant sidebar and Explorer chat use different empty states.

## What is the new behavior?
Share a centered empty state with chat-focused prompts, use-case icons,
and a “Use your own agent” footer. Simplify prompt cards and align
Explorer Home styling.

## Additional context
Studio typecheck, targeted ESLint, and Prettier pass. E2E selectors
updated; browser verification pending. Local build stopped after showing
no progress during compilation.

I have read CONTRIBUTING.md.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Redesigned Explorer and AI Assistant onboarding with project-focused
chat prompts.
* Added personalized chat template icons and updated suggested actions.
* Added an option to connect and use an external agent through Claude,
OpenAI, or Cursor.
  * Improved chat composer placement and empty-chat guidance.
* **Style**
* Action cards now support layouts without descriptions and adjust
alignment automatically.
* **Tests**
  * Updated end-to-end coverage for the revised assistant interface.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-10 13:39:21 +08:00

87 lines
3.4 KiB
TypeScript

import { NotebookText, SquareCode } from 'lucide-react'
import { useState } from 'react'
import { useCreateChat, useCreateNotebook, useCreateQuery } from './hooks'
import { NOTEBOOK_TEMPLATES } from './templates'
import { ActionCard } from '@/components/layouts/Tabs/ActionCard'
import { CHAT_TEMPLATES } from '@/components/ui/AIAssistantPanel/AIAssistant.prompts'
import { AssistantAgentHarnessFooter } from '@/components/ui/AIAssistantPanel/AssistantAgentHarnessFooter'
import { AssistantChatForm } from '@/components/ui/AIAssistantPanel/AssistantChatForm'
export const ExplorerHomeTab = () => {
const { createNotebook } = useCreateNotebook()
const { createQuery } = useCreateQuery()
const { createChat } = useCreateChat()
const [value, setValue] = useState<string>('')
return (
<div className="bg-surface-100 h-full flex flex-col items-center justify-center px-10">
<div className="w-full max-w-2xl">
<div className="text-center mb-6">
<h1 className="heading-section">Run SQL. Chat with your project. Create a Notebook</h1>
</div>
<AssistantChatForm
loading={false}
className="bg"
placeholder="Explore your data, check project health, create a notebook..."
value={value}
onValueChange={(e) => setValue(e.target.value)}
onSubmit={(message) => createChat({ initialMessage: message })}
/>
<AssistantAgentHarnessFooter />
<section className="mt-6">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<ActionCard
icon={<SquareCode className="h-4 w-4 text-foreground" strokeWidth={1.5} />}
title="Run SQL"
description="Write and run an ad-hoc query"
bgColor="bg-blue-500"
onClick={() => createQuery()}
/>
<ActionCard
icon={<NotebookText className="h-4 w-4 text-foreground" strokeWidth={1.5} />}
title="Create a notebook"
description="Combine notes, queries, and results"
bgColor="bg-blue-500"
onClick={() => createNotebook()}
/>
</div>
</section>
<section className="mt-8 flex flex-col gap-y-3">
<h2 className="text-sm font-medium text-foreground">Start with a template</h2>
<div className="grid grid-cols-1 gap-3 sm:grid-cols-3">
{NOTEBOOK_TEMPLATES.map((template) => (
<ActionCard
key={template.title}
icon={<NotebookText className="h-4 w-4 text-foreground" strokeWidth={1.5} />}
title={template.title}
description={template.description}
bgColor="bg-blue-500"
onClick={() =>
createNotebook({ name: template.title, cells: template.buildCells() })
}
/>
))}
{CHAT_TEMPLATES.map((template) => (
<ActionCard
key={template.title}
icon={<template.icon className="h-4 w-4 text-foreground" strokeWidth={1.5} />}
title={template.title}
bgColor="bg-blue-500"
onClick={() =>
createChat({ name: template.title, initialMessage: template.initialMessage })
}
/>
))}
</div>
</section>
</div>
</div>
)
}