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