Files
supabase/apps/studio/components/interfaces/SqlGenerator/SqlGenerator.Alerts.tsx
T
Charis 84732ff44c feat: add new command menu to studio (#28432)
Add new command menu to studio. Ports over commands from old menu (with some minor reorganization), then adds:
- Branch switcher
- Project switcher
2024-08-08 16:42:07 -04:00

59 lines
1.7 KiB
TypeScript

import { AlertTriangle, Info } from 'lucide-react'
import { useAppStateSnapshot } from 'state/app-state'
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, Button_Shadcn_ } from 'ui'
export function IncludeSchemaAlert() {
const { setShowAiSettingsModal } = useAppStateSnapshot()
return (
<Alert_Shadcn_ variant="warning">
<AlertTriangle />
<AlertTitle_Shadcn_>
Project metadata (tables, columns, and data types) is being shared with OpenAI
</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
<Button_Shadcn_
variant="link"
className="h-fit p-0 font-normal"
onClick={() => setShowAiSettingsModal(true)}
>
Change this configuration
</Button_Shadcn_>
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)
}
export type AiMetadataSkipReason = 'forbidden' | 'no_project'
export function ExcludeSchemaAlert({
metadataSkipReason,
}: {
metadataSkipReason: AiMetadataSkipReason | undefined
}) {
const { setShowAiSettingsModal } = useAppStateSnapshot()
return (
<Alert_Shadcn_>
<Info />
<AlertTitle_Shadcn_>
Project metadata (tables, columns, and data types) is not being shared with OpenAI
</AlertTitle_Shadcn_>
<AlertDescription_Shadcn_>
{metadataSkipReason === 'no_project' ? (
'Switch to a project to change this setting'
) : (
<Button_Shadcn_
variant="link"
className="h-fit p-0 font-normal"
onClick={() => setShowAiSettingsModal(true)}
>
Change this configuration
</Button_Shadcn_>
)}
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)
}