mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 20:05:06 +03:00
## Problem The `_Shadcn_` suffix isn't needed anymore on `Select` components ## Solution Remove it. No other changes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Updated internal component architecture to standardize and simplify the codebase. These changes improve code maintainability and consistency across the application without affecting existing functionality or user experience. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45988) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
74 lines
2.3 KiB
TypeScript
74 lines
2.3 KiB
TypeScript
import { useForm } from 'react-hook-form'
|
|
import {
|
|
FormControl,
|
|
FormField,
|
|
Select,
|
|
SelectContent,
|
|
SelectGroup,
|
|
SelectItem,
|
|
SelectTrigger,
|
|
SelectValue,
|
|
Switch,
|
|
} from 'ui'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
|
|
import { SSOConfigFormSchema } from './SSOConfig'
|
|
|
|
export const JoinOrganizationOnSignup = ({
|
|
form,
|
|
}: {
|
|
form: ReturnType<typeof useForm<SSOConfigFormSchema>>
|
|
}) => {
|
|
const joinOrgOnSignup = form.watch('joinOrgOnSignup')
|
|
|
|
return (
|
|
<div className="space-y-4">
|
|
<FormField
|
|
control={form.control}
|
|
name="joinOrgOnSignup"
|
|
render={({ field }) => (
|
|
<FormItemLayout
|
|
layout="flex-row-reverse"
|
|
label="Automatically add users to organization on sign up"
|
|
description="If disabled, users will need to be invited to the organization after signing up"
|
|
>
|
|
<FormControl className="flex items-center gap-2">
|
|
<Switch checked={field.value} onCheckedChange={field.onChange} />
|
|
</FormControl>
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
{joinOrgOnSignup && (
|
|
<FormField
|
|
control={form.control}
|
|
name="roleOnJoin"
|
|
render={({ field }) => (
|
|
<FormItemLayout
|
|
label="Default role on join"
|
|
description="Select a role for the user when they join the organization"
|
|
layout="flex-row-reverse"
|
|
className="justify-between"
|
|
>
|
|
<FormControl>
|
|
<Select value={field.value} onValueChange={(val) => field.onChange(val)}>
|
|
<SelectTrigger className="w-52">
|
|
<SelectValue placeholder="Select a role" />
|
|
</SelectTrigger>
|
|
<SelectContent>
|
|
<SelectGroup>
|
|
<SelectItem value="Owner">Owner</SelectItem>
|
|
<SelectItem value="Administrator">Administrator</SelectItem>
|
|
<SelectItem value="Developer">Developer</SelectItem>
|
|
<SelectItem value="Read-only">Read-only</SelectItem>
|
|
</SelectGroup>
|
|
</SelectContent>
|
|
</Select>
|
|
</FormControl>
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|