Skip to content

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

Pull master and resolve conflicts

Joshen Lim597e66d8e346
diff --cc studio/components/ui/MultiSelect/index.tsx
index 5ab7659d276,3e808572b85..c94cd640d65
--- a/studio/components/ui/MultiSelect/index.tsx
+++ b/studio/components/ui/MultiSelect/index.tsx
@@@ -1,6 -1,6 +1,6 @@@
import { useRef, useEffect, useState, FormEvent, KeyboardEvent, ReactNode } from 'react'
import { orderBy, filter, without } from 'lodash'
- import { Popover, IconCheck, IconAlertCircle, IconSearch, IconPlus } from '@supabase/ui'
-import { Popover, IconCheck, IconAlertCircle, IconSearch } from 'ui'
++import { Popover, IconCheck, IconAlertCircle, IconSearch, IconPlus } from 'ui'
import { BadgeDisabled, BadgeSelected } from './Badges'
@@@ -116,9 -101,8 +116,9 @@@ export default function MultiSelect(
<div
className={[
'form-control form-control--multi-select',
- 'bg-scaleA-200 border-scale-700 border',
+ 'border border-scale-700 bg-scaleA-200',
'multi-select relative block w-full w-full space-x-1 overflow-auto rounded',
+ `${error !== undefined ? 'border-red-800 bg-red-100' : ''}`,
].join(' ')}
ref={ref}
>
@@@ -228,24 -205,23 +228,24 @@@
].join(' ')}
>
{selectedOptions.length === 0 && placeholder && (
- <div className="text-scale-1000 px-2 text-sm">{placeholder}</div>
+ <div className="px-2 text-sm text-scale-1000">{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) {
+ {selectedOptions.map((value, idx) => {
+ const id = `${value}-${idx}`
+ const option = formattedOptions.find((x) => x.value === value)
+ const isDisabled = option?.disabled ?? false
+ if (!option) {
+ return <></>
+ } else if (isDisabled) {
+ return <BadgeDisabled key={id} name={value} />
+ } else {
return (
<BadgeSelected
- key={option.id}
- name={option.name}
- handleRemove={() => handleChange(option)}
+ key={id}
+ name={value}
+ handleRemove={() =>
+ allowDuplicateSelection ? handleRemove(idx) : handleChange(option)
+ }
/>
)
}
@@@ -255,9 -231,8 +255,9 @@@
</div>
{descriptionText && (
- <span className="form-text text-muted text-sm mt-2">{descriptionText}</span>
+ <span className="form-text text-muted mt-2 text-sm">{descriptionText}</span>
)}
+ {error && <span className="text-red-900 text-sm mt-2">{error}</span>}
</div>
)
}