🚸 (typebotLink) Exclude current bot name from select list
This commit is contained in:
@ -22,6 +22,7 @@ export const TypebotLinkForm = ({ options, onOptionsChange }: Props) => {
|
||||
<Stack>
|
||||
{typebot && (
|
||||
<TypebotsDropdown
|
||||
idsToExclude={[typebot.id]}
|
||||
typebotId={options.typebotId}
|
||||
onSelectTypebotId={handleTypebotIdChange}
|
||||
currentWorkspaceId={typebot.workspaceId as string}
|
||||
|
@ -10,12 +10,14 @@ import { SearchableDropdown } from '@/components/SearchableDropdown'
|
||||
import { EmojiOrImageIcon } from '@/components/EmojiOrImageIcon'
|
||||
|
||||
type Props = {
|
||||
idsToExclude: string[]
|
||||
typebotId?: string | 'current'
|
||||
currentWorkspaceId: string
|
||||
onSelectTypebotId: (typebotId: string | 'current') => void
|
||||
}
|
||||
|
||||
export const TypebotsDropdown = ({
|
||||
idsToExclude,
|
||||
typebotId,
|
||||
onSelectTypebotId,
|
||||
currentWorkspaceId,
|
||||
@ -51,7 +53,9 @@ export const TypebotsDropdown = ({
|
||||
label: 'Current typebot',
|
||||
value: 'Current typebot',
|
||||
},
|
||||
...(typebots ?? []).map((typebot) => ({
|
||||
...(typebots ?? [])
|
||||
.filter((typebot) => !idsToExclude.includes(typebot.id))
|
||||
.map((typebot) => ({
|
||||
value: typebot.name,
|
||||
label: (
|
||||
<HStack as="span" spacing="2">
|
||||
|
Reference in New Issue
Block a user