Files
supabase/apps/studio/components/interfaces/Integrations/CronJobs/SqlFunctionSection.tsx
Gildas Garcia c6fc456910 chore: cleanup duplicate exports studio (#47387)
## Problem

Knip reports many duplicate exports (both named and default). Besides,
we're moving away from default exports and even have an eslint rule to
enforce it on new code.

## Solution

- Cleanup those exports
- Update imports when necessary

No functional changes. If it builds, it's fine
2026-06-29 15:46:16 +02:00

57 lines
1.8 KiB
TypeScript

import { UseFormReturn } from 'react-hook-form'
import { FormField, SheetSection } from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { CreateCronJobForm } from './CreateCronJobSheet/CreateCronJobSheet.constants'
import FunctionSelector from '@/components/ui/FunctionSelector'
import { SchemaSelector } from '@/components/ui/SchemaSelector'
interface SqlFunctionSectionProps {
form: UseFormReturn<CreateCronJobForm>
}
export const SqlFunctionSection = ({ form }: SqlFunctionSectionProps) => {
const schema = form.watch('values.schema')
return (
<SheetSection className="flex flex-col gap-3 2xl:flex-row 2xl:[&>div]:w-full">
<FormField
control={form.control}
name="values.schema"
render={({ field }) => (
<FormItemLayout label="Schema" className="gap-1">
<SchemaSelector
size="small"
className="w-56 2xl:w-full"
selectedSchemaName={field.value}
stopScrollPropagation
onSelectSchema={(name) => {
field.onChange(name)
// deselect the selected function when the schema is changed
form.resetField('values.functionName')
}}
/>
</FormItemLayout>
)}
/>
<FormField
control={form.control}
name="values.functionName"
render={({ field }) => (
<FormItemLayout label="Function name" className="gap-1">
<FunctionSelector
size="small"
className="w-56 2xl:w-full"
schema={schema}
value={field.value}
stopScrollPropagation
onChange={(name) => field.onChange(name)}
/>
</FormItemLayout>
)}
/>
</SheetSection>
)
}