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