Skip to content

Commit

Permalink
🐛 (share) Fix duplicate folderId issue
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Nov 28, 2023
1 parent cf8df68 commit 8ce4e48
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
8 changes: 5 additions & 3 deletions apps/builder/src/components/inputs/RadioButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
Box,
Flex,
HStack,
Stack,
useColorModeValue,
useRadio,
useRadioGroup,
Expand All @@ -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({
Expand All @@ -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 (
Expand All @@ -39,7 +41,7 @@ export const RadioButtons = <T extends string>({
</RadioCard>
)
})}
</HStack>
</Stack>
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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({
Expand Down
2 changes: 2 additions & 0 deletions apps/builder/src/features/typebot/api/importTypebot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const omittedProps = {
resultsTablePreferencesSchema: true,
selectedThemeTemplateId: true,
publicId: true,
folderId: true,
} as const

const importingTypebotSchema = z.preprocess(
Expand Down Expand Up @@ -62,6 +63,7 @@ const migrateImportingTypebot = (
isArchived: false,
whatsAppCredentialsId: null,
publicId: null,
folderId: null,
} satisfies Typebot
return migrateTypebot(fullTypebot)
}
Expand Down
1 change: 1 addition & 0 deletions apps/builder/src/pages/typebots/[typebotId]/duplicate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: (
Expand Down
14 changes: 2 additions & 12 deletions apps/docs/openapi/builder/_spec_.json
Original file line number Diff line number Diff line change
Expand Up @@ -45489,10 +45489,6 @@
"type": "string",
"nullable": true
},
"folderId": {
"type": "string",
"nullable": true
},
"resultsTablePreferences": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -45536,8 +45532,7 @@
"variables",
"theme",
"settings",
"icon",
"folderId"
"icon"
],
"additionalProperties": false
},
Expand Down Expand Up @@ -49194,10 +49189,6 @@
"type": "string",
"nullable": true
},
"folderId": {
"type": "string",
"nullable": true
},
"resultsTablePreferences": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -49242,8 +49233,7 @@
"variables",
"theme",
"settings",
"icon",
"folderId"
"icon"
],
"additionalProperties": false
}
Expand Down

2 comments on commit 8ce4e48

@vercel
Copy link

@vercel vercel bot commented on 8ce4e48 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-typebot-io.vercel.app
builder-v2-git-main-typebot-io.vercel.app
app.typebot.io

@vercel
Copy link

@vercel vercel bot commented on 8ce4e48 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-typebot-io.vercel.app
docs.typebot.io
docs-git-main-typebot-io.vercel.app

Please sign in to comment.