Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Remove unnecessary fragment

Joshen Limafe6ef3a3210
diff --git a/studio/components/ui/MultiSelect/index.tsx b/studio/components/ui/MultiSelect/index.tsx
index e18d039e7e1..a943c8cae73 100644
--- a/studio/components/ui/MultiSelect/index.tsx
+++ b/studio/components/ui/MultiSelect/index.tsx
@@ -88,145 +88,143 @@ export default function MultiSelect({
}
return (
- <>
- <div className="form-group">
- {label && <label>{label}</label>}
- <div
- className={[
- 'form-control form-control--multi-select',
- 'bg-scaleA-200 border-scale-700 border',
- 'multi-select relative block w-full w-full space-x-1 overflow-auto rounded',
- ].join(' ')}
- ref={ref}
- >
- <Popover
- sideOffset={4}
- side="bottom"
- align="start"
- style={{ width }}
- header={
- <div className="flex items-center space-x-2 py-1">
- <IconSearch size={14} />
- <input
- autoFocus
- className="placeholder-scale-1000 w-72 bg-transparent text-sm outline-none"
- value={searchString}
- placeholder={searchPlaceholder}
- onKeyPress={onKeyPress}
- onChange={(e: FormEvent<HTMLInputElement>) =>
- setSearchString(e.currentTarget.value)
- }
- />
- </div>
- }
- overlay={
- <div className="max-h-[225px] space-y-1 overflow-y-auto p-1">
- {filteredOptions.length >= 1 ? (
- filteredOptions.map((option) => {
- const active =
- selectedOptions &&
- selectedOptions.find((selected) => {
- return selected === option.value
- })
- ? true
- : false
-
- return (
- <div
- key={`multiselect-option-${option.value}`}
- onClick={() => handleChange(option)}
- className={[
- 'text-typography-body-light dark:text-typography-body-dark',
- 'flex cursor-pointer items-center justify-between transition',
- 'space-x-1 rounded bg-transparent p-2 px-4 text-sm hover:bg-gray-600',
- `${active ? ' dark:bg-green-600 dark:bg-opacity-25' : ''}`,
- ].join(' ')}
- >
- <span>{option.name}</span>
- {active && (
- <IconCheck
- size={16}
- strokeWidth={3}
- className={`cursor-pointer transition ${
- active ? ' dark:text-green-500' : ''
- }`}
- />
- )}
- </div>
- )
- })
- ) : options.length === 0 ? (
- <div
- className={[
- 'dark:border-dark flex h-full w-full flex-col',
- 'items-center justify-center border border-dashed p-3',
- ].join(' ')}
- >
- {emptyMessage ? (
- emptyMessage
- ) : (
- <div className="flex w-full items-center space-x-2">
- <IconAlertCircle strokeWidth={1.5} size={18} className="text-scale-1000" />
- <p className="text-scale-1000 text-sm">No options available</p>
- </div>
- )}
- </div>
- ) : (
- <div
- className={[
- 'dark:border-dark flex h-full w-full flex-col',
- 'items-center justify-center border border-dashed p-3',
- ].join(' ')}
- >
- {emptyMessage ? (
- emptyMessage
- ) : (
- <div className="flex w-full items-center space-x-2">
- <p className="text-scale-1000 text-sm">No options found</p>
- </div>
- )}
- </div>
- )}
- </div>
- }
- onOpenChange={() => setSearchString('')}
- >
- <div
- className={[
- 'flex w-full flex-wrap items-start items-center gap-1.5 p-1.5',
- `${selectedOptions.length === 0 ? 'h-9' : ''}`,
- ].join(' ')}
- >
- {selectedOptions.length === 0 && placeholder && (
- <div className="text-scale-1000 px-2 text-sm">{placeholder}</div>
- )}
- {formattedOptions.map((option) => {
- const active =
- selectedOptions &&
- selectedOptions.find((selected) => {
- return selected === option.value
- })
-
- if (option.disabled) {
- return <BadgeDisabled key={option.id} name={option.name} />
- } else if (active) {
- return (
- <BadgeSelected
- key={option.id}
- name={option.name}
- id={option.name}
- value={option.value}
- handleRemove={() => handleChange(option)}
- />
- )
+ <div className="form-group">
+ {label && <label>{label}</label>}
+ <div
+ className={[
+ 'form-control form-control--multi-select',
+ 'bg-scaleA-200 border-scale-700 border',
+ 'multi-select relative block w-full w-full space-x-1 overflow-auto rounded',
+ ].join(' ')}
+ ref={ref}
+ >
+ <Popover
+ sideOffset={4}
+ side="bottom"
+ align="start"
+ style={{ width }}
+ header={
+ <div className="flex items-center space-x-2 py-1">
+ <IconSearch size={14} />
+ <input
+ autoFocus
+ className="placeholder-scale-1000 w-72 bg-transparent text-sm outline-none"
+ value={searchString}
+ placeholder={searchPlaceholder}
+ onKeyPress={onKeyPress}
+ onChange={(e: FormEvent<HTMLInputElement>) =>
+ setSearchString(e.currentTarget.value)
}
- })}
+ />
</div>
- </Popover>
- </div>
+ }
+ overlay={
+ <div className="max-h-[225px] space-y-1 overflow-y-auto p-1">
+ {filteredOptions.length >= 1 ? (
+ filteredOptions.map((option) => {
+ const active =
+ selectedOptions &&
+ selectedOptions.find((selected) => {
+ return selected === option.value
+ })
+ ? true
+ : false
- {descriptionText && <span className="form-text text-muted">{descriptionText}</span>}
+ return (
+ <div
+ key={`multiselect-option-${option.value}`}
+ onClick={() => handleChange(option)}
+ className={[
+ 'text-typography-body-light dark:text-typography-body-dark',
+ 'flex cursor-pointer items-center justify-between transition',
+ 'space-x-1 rounded bg-transparent p-2 px-4 text-sm hover:bg-gray-600',
+ `${active ? ' dark:bg-green-600 dark:bg-opacity-25' : ''}`,
+ ].join(' ')}
+ >
+ <span>{option.name}</span>
+ {active && (
+ <IconCheck
+ size={16}
+ strokeWidth={3}
+ className={`cursor-pointer transition ${
+ active ? ' dark:text-green-500' : ''
+ }`}
+ />
+ )}
+ </div>
+ )
+ })
+ ) : options.length === 0 ? (
+ <div
+ className={[
+ 'dark:border-dark flex h-full w-full flex-col',
+ 'items-center justify-center border border-dashed p-3',
+ ].join(' ')}
+ >
+ {emptyMessage ? (
+ emptyMessage
+ ) : (
+ <div className="flex w-full items-center space-x-2">
+ <IconAlertCircle strokeWidth={1.5} size={18} className="text-scale-1000" />
+ <p className="text-scale-1000 text-sm">No options available</p>
+ </div>
+ )}
+ </div>
+ ) : (
+ <div
+ className={[
+ 'dark:border-dark flex h-full w-full flex-col',
+ 'items-center justify-center border border-dashed p-3',
+ ].join(' ')}
+ >
+ {emptyMessage ? (
+ emptyMessage
+ ) : (
+ <div className="flex w-full items-center space-x-2">
+ <p className="text-scale-1000 text-sm">No options found</p>
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ }
+ onOpenChange={() => setSearchString('')}
+ >
+ <div
+ className={[
+ 'flex w-full flex-wrap items-start items-center gap-1.5 p-1.5',
+ `${selectedOptions.length === 0 ? 'h-9' : ''}`,
+ ].join(' ')}
+ >
+ {selectedOptions.length === 0 && placeholder && (
+ <div className="text-scale-1000 px-2 text-sm">{placeholder}</div>
+ )}
+ {formattedOptions.map((option) => {
+ const active =
+ selectedOptions &&
+ selectedOptions.find((selected) => {
+ return selected === option.value
+ })
+
+ if (option.disabled) {
+ return <BadgeDisabled key={option.id} name={option.name} />
+ } else if (active) {
+ return (
+ <BadgeSelected
+ key={option.id}
+ name={option.name}
+ id={option.name}
+ value={option.value}
+ handleRemove={() => handleChange(option)}
+ />
+ )
+ }
+ })}
+ </div>
+ </Popover>
</div>
- </>
+
+ {descriptionText && <span className="form-text text-muted">{descriptionText}</span>}
+ </div>
)
}