Files
supabase/apps/studio/components/interfaces/Organization/SSO/SSODomains.tsx
Joshen Lim 09a1f431bc Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## Context

This is largely just a mechanical change here:
Opting to use lucide icons with the `Icon` suffix across all icon
imports within `studio`
- so that it’s clearer which components are icons + reduces the
possibility of name collision with our own components
- e.g <User /> vs <UserIcon />

Also added a eslint rule for this:
<img width="1069" height="167" alt="image"
src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc"
/>

And updated `AGENTS.md` as such:
```
Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced).
```
2026-10-14 12:56:55 +02:00

77 lines
2.5 KiB
TypeScript

import { PlusIcon, TrashIcon } from 'lucide-react'
import { useFieldArray, useForm } from 'react-hook-form'
import { Button, FormControl, FormField, FormItem, FormMessage, Input } from 'ui'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { SSOConfigFormSchema } from './SSOConfig'
export const SSODomains = ({ form }: { form: ReturnType<typeof useForm<SSOConfigFormSchema>> }) => {
const { fields, append, remove } = useFieldArray({
control: form.control,
name: 'domains',
})
const domainsError = form.formState.errors.domains
// Handle different error structures - could be root error or direct error
const arrayLevelError =
domainsError &&
typeof domainsError === 'object' &&
'message' in domainsError &&
typeof domainsError.message === 'string'
? domainsError.message
: domainsError &&
typeof domainsError === 'object' &&
'root' in domainsError &&
domainsError.root &&
typeof domainsError.root === 'object' &&
'message' in domainsError.root
? String(domainsError.root.message)
: null
return (
<>
<FormItemLayout
label="Email Domains"
layout="flex-row-reverse"
description="Users with these email domains will be redirected to your identity provider when logging in from Supabase."
>
<div className="grid gap-2 w-full">
{fields.map((field, idx) => (
<div key={field.id} className="flex gap-2 items-start">
<FormField
name={`domains.${idx}.value`}
render={({ field }) => (
<FormItem className="flex-1">
<FormControl>
<Input {...field} autoComplete="off" placeholder="example.com" />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<Button
icon={<TrashIcon size={12} />}
className="h-[34px] w-[34px]"
onClick={() => remove(idx)}
/>
</div>
))}
<div>
<Button
icon={<PlusIcon className="w-4 h-4" />}
size="tiny"
onClick={() => append({ value: '' })}
>
Add another
</Button>
</div>
{arrayLevelError && (
<p className="text-sm font-medium text-destructive">{arrayLevelError}</p>
)}
</div>
</FormItemLayout>
</>
)
}