🐛 (share) Fix duplicate folderId issue
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import {
|
||||
Box,
|
||||
Flex,
|
||||
HStack,
|
||||
Stack,
|
||||
useColorModeValue,
|
||||
useRadio,
|
||||
useRadioGroup,
|
||||
@ -13,12 +13,14 @@ type Props<T extends string> = {
|
||||
options: (T | { value: T; label: ReactNode })[]
|
||||
value?: T
|
||||
defaultValue?: T
|
||||
direction?: 'row' | 'column'
|
||||
onSelect: (newValue: T) => void
|
||||
}
|
||||
export const RadioButtons = <T extends string>({
|
||||
options,
|
||||
value,
|
||||
defaultValue,
|
||||
direction = 'row',
|
||||
onSelect,
|
||||
}: Props<T>) => {
|
||||
const { getRootProps, getRadioProps } = useRadioGroup({
|
||||
@ -30,7 +32,7 @@ export const RadioButtons = <T extends string>({
|
||||
const group = getRootProps()
|
||||
|
||||
return (
|
||||
<HStack {...group}>
|
||||
<Stack {...group} direction={direction}>
|
||||
{options.map((item) => {
|
||||
const radio = getRadioProps({ value: parseValue(item) })
|
||||
return (
|
||||
@ -39,7 +41,7 @@ export const RadioButtons = <T extends string>({
|
||||
</RadioCard>
|
||||
)
|
||||
})}
|
||||
</HStack>
|
||||
</Stack>
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Stack, Input, InputGroup, InputRightElement } from '@chakra-ui/react'
|
||||
import React, { useMemo } from 'react'
|
||||
import React from 'react'
|
||||
import { SwitchWithRelatedSettings } from '@/components/SwitchWithRelatedSettings'
|
||||
import { CopyButton } from '@/components/CopyButton'
|
||||
import { CollaborationList } from '@/features/collaboration/components/CollaborationList'
|
||||
@ -8,7 +8,7 @@ import { useTypebot } from '@/features/editor/providers/TypebotProvider'
|
||||
export const SharePopoverContent = () => {
|
||||
const { typebot, updateTypebot } = useTypebot()
|
||||
|
||||
const currentUrl = useMemo(() => window.location.href.split('?')[0], [])
|
||||
const currentUrl = `${window.location.origin}/typebots/${typebot?.id}/edit`
|
||||
|
||||
const updateIsPublicShareEnabled = async (isEnabled: boolean) => {
|
||||
await updateTypebot({
|
||||
|
@ -28,6 +28,7 @@ const omittedProps = {
|
||||
resultsTablePreferencesSchema: true,
|
||||
selectedThemeTemplateId: true,
|
||||
publicId: true,
|
||||
folderId: true,
|
||||
} as const
|
||||
|
||||
const importingTypebotSchema = z.preprocess(
|
||||
@ -62,6 +63,7 @@ const migrateImportingTypebot = (
|
||||
isArchived: false,
|
||||
whatsAppCredentialsId: null,
|
||||
publicId: null,
|
||||
folderId: null,
|
||||
} satisfies Typebot
|
||||
return migrateTypebot(fullTypebot)
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ const Page = () => {
|
||||
Choose a workspace to duplicate <strong>{typebot?.name}</strong> in:
|
||||
</Text>
|
||||
<RadioButtons
|
||||
direction="column"
|
||||
options={workspaces?.map((workspace) => ({
|
||||
value: workspace.id,
|
||||
label: (
|
||||
|
Reference in New Issue
Block a user