Skip to content

Commit 0192dc4

Browse files
ivasilovalaister
andauthored
feat: Add assistant query param for control the AI assistant panel (supabase#30809)
* Fix a key error in the assistant. * Sync the query params for the assistant with the app state. * Fix the button URL from the /assistant page to link correctly to the studio. * Replace nuqs with a custom function. * undo projectlayout changes --------- Co-authored-by: Alaister Young <[email protected]>
1 parent 2669e3d commit 0192dc4

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

apps/studio/components/ui/AIAssistantPanel/AIAssistant.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ import {
4040
} from 'ui'
4141
import { Admonition, AssistantChatForm, GenericSkeletonLoader } from 'ui-patterns'
4242
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
43+
import DotGrid from '../DotGrid'
4344
import AIOnboarding from './AIOnboarding'
4445
import CollapsibleCodeBlock from './CollapsibleCodeBlock'
4546
import { Message } from './Message'
46-
import DotGrid from '../DotGrid'
4747

4848
const MemoizedMessage = memo(
4949
({ message, isLoading }: { message: MessageType; isLoading: boolean }) => {
@@ -444,7 +444,7 @@ export const AIAssistant = ({
444444
Generate a ...
445445
</Button>
446446
{SQL_TEMPLATES.filter((t) => t.type === 'quickstart').map((qs) => (
447-
<TooltipProvider_Shadcn_>
447+
<TooltipProvider_Shadcn_ key={qs.title}>
448448
<Tooltip_Shadcn_>
449449
<TooltipTrigger_Shadcn_ asChild>
450450
<Button

apps/www/pages/assistant.tsx

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { Button } from 'ui'
2-
import dynamic from 'next/dynamic'
3-
import { AIDemoPanel } from '~/components/AIDemo/Panel'
4-
import { useEffect, useState } from 'react'
5-
import { SqlSnippet } from '~/components/AIDemo/SqlSnippet'
6-
import { NextSeo } from 'next-seo'
7-
import { motion } from 'framer-motion'
8-
import { useRouter } from 'next/router'
91
import { useIsLoggedIn, useIsUserLoading } from 'common'
2+
import { motion } from 'framer-motion'
3+
import { NextSeo } from 'next-seo'
4+
import dynamic from 'next/dynamic'
105
import Link from 'next/link'
6+
import { useRouter } from 'next/router'
7+
import { useEffect, useState } from 'react'
8+
import { Button } from 'ui'
119
import DotGrid from '~/components/AIDemo/DotGrid'
10+
import { AIDemoPanel } from '~/components/AIDemo/Panel'
11+
import { SqlSnippet } from '~/components/AIDemo/SqlSnippet'
1212
import { EASE_OUT } from '../lib/animations'
1313

1414
const DefaultLayout = dynamic(() => import('~/components/Layouts/Default'))
@@ -680,18 +680,13 @@ function Assistant() {
680680
more. The Assistant is here to help.
681681
</p>
682682
<div className="min-h-12 flex items-center gap-x-2">
683-
{!isUserLoading &&
684-
(isLoggedIn ? (
685-
<Button type="primary" size="medium" asChild>
686-
<Link href="/dashboard/project/_">Dashboard</Link>
687-
</Button>
688-
) : (
689-
<Button type="primary" size="medium" asChild>
690-
<Link href="https://supabase.com/dashboard/project/_">
691-
Start your project
692-
</Link>
693-
</Button>
694-
))}
683+
{!isUserLoading && (
684+
<Button type="primary" size="medium" asChild>
685+
<Link href="/dashboard/project/_?aiAssistantPanelOpen=true">
686+
{isLoggedIn ? 'Dashboard' : 'Start your project'}
687+
</Link>
688+
</Button>
689+
)}
695690
<Button type="default" size="medium" asChild>
696691
<Link
697692
target="_blank"

0 commit comments

Comments
 (0)