mirror of
https://github.com/supabase/supabase.git
synced 2026-05-23 19:13:13 +08:00
* Refactor and remove the CreateFunctionStore. * Fix a duplicate key in the functions table. * More fixes for the create-function form. * Add excluded schemas to schema selector. * Cleanup the createFunction code after the merge. * Remove unneeded wrapper fragments. * Minor fixes for the FormItemLayout stories. * Refactor the CreateFunction panel using the new FormItemLayout. * Revert the migration to use FormItemLayout. Will revisit later. * Add a CSS class for popover content width to match its trigger width. Use it on the schema selector. * Replace all listboxes with selects. * Fix the comments. * Switch to FormItemLayout wherever possible. * Move the createFunction file to its own folder. * Refactor the panel to use shadcn components: Sheet, SheetContent and SheetHeader. * Add showClose prop to the Sheet component. * Add function editor and a feature to maximize/minimize the code editor. * Some fixes * Add sameWidthAsTrigger to the popover component. * Fix the icon size. --------- Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import { X } from 'lucide-react'
|
|
|
|
import { SheetClose, SheetHeader, SheetTitle, cn } from 'ui'
|
|
|
|
export const CreateFunctionHeader = ({
|
|
selectedFunction,
|
|
assistantVisible,
|
|
setAssistantVisible,
|
|
}: {
|
|
selectedFunction?: string
|
|
assistantVisible: boolean
|
|
setAssistantVisible: (v: boolean) => void
|
|
}) => {
|
|
return (
|
|
<SheetHeader
|
|
className={cn(
|
|
selectedFunction !== undefined ? 'pt-3 pb-0' : 'py-3',
|
|
'flex flex-row justify-between items-center border-b-0'
|
|
)}
|
|
>
|
|
<div className="flex flex-row gap-3 items-center max-w-[75%]">
|
|
<SheetClose
|
|
className={cn(
|
|
'text-muted hover:text ring-offset-background transition-opacity hover:opacity-100',
|
|
'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
'disabled:pointer-events-none data-[state=open]:bg-secondary',
|
|
'transition'
|
|
)}
|
|
>
|
|
<X className="h-3 w-3" />
|
|
<span className="sr-only">Close</span>
|
|
</SheetClose>
|
|
<SheetTitle className="truncate">
|
|
{selectedFunction !== undefined
|
|
? `Edit '${selectedFunction}' function`
|
|
: 'Add a new function'}
|
|
</SheetTitle>
|
|
</div>
|
|
{/* <Tooltip_Shadcn_>
|
|
<TooltipTrigger_Shadcn_ asChild>
|
|
<button
|
|
aria-expanded={assistantVisible}
|
|
aria-controls="ai-chat-assistant"
|
|
className={cn(
|
|
!assistantVisible ? 'text-foreground-lighter' : 'text-light',
|
|
'hover:text-foreground',
|
|
'transition'
|
|
)}
|
|
onClick={() => setAssistantVisible(!assistantVisible)}
|
|
>
|
|
{!assistantVisible ? (
|
|
<PanelLeftClose size={19} strokeWidth={1} />
|
|
) : (
|
|
<PanelRightClose size={19} strokeWidth={1} />
|
|
)}
|
|
</button>
|
|
</TooltipTrigger_Shadcn_>
|
|
<TooltipContent_Shadcn_ side="left">
|
|
{assistantVisible ? 'Hide' : 'Show'} tools
|
|
</TooltipContent_Shadcn_>
|
|
</Tooltip_Shadcn_> */}
|
|
</SheetHeader>
|
|
)
|
|
}
|