diff --git a/apps/builder/components/account/EditorSection.tsx b/apps/builder/components/account/EditorSection.tsx
new file mode 100644
index 000000000..451a40be9
--- /dev/null
+++ b/apps/builder/components/account/EditorSection.tsx
@@ -0,0 +1,78 @@
+import {
+ Stack,
+ Heading,
+ HStack,
+ Text,
+ Radio,
+ RadioGroup,
+ VStack,
+} from '@chakra-ui/react'
+import { MouseIcon, LaptopIcon } from 'assets/icons'
+import { useUser } from 'contexts/UserContext'
+import { GraphNavigation } from 'db'
+import React, { useEffect, useState } from 'react'
+
+export const EditorSection = () =>
+
+export const EditorSettings = () => {
+ const { user, saveUser } = useUser()
+ const [value, setValue] = useState(
+ user?.graphNavigation ?? GraphNavigation.TRACKPAD
+ )
+
+ useEffect(() => {
+ if (user?.graphNavigation === value) return
+ saveUser({ graphNavigation: value as GraphNavigation }).then()
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [value])
+
+ const options = [
+ {
+ value: GraphNavigation.MOUSE,
+ label: 'Mouse',
+ description:
+ 'Move by dragging the board and zoom in/out using the scroll wheel',
+ icon: ,
+ },
+ {
+ value: GraphNavigation.TRACKPAD,
+ label: 'Trackpad',
+ description: 'Move the board using 2 fingers and zoom in/out by pinching',
+ icon: ,
+ },
+ ]
+
+ return (
+
+ Navigation
+
+
+ {options.map((option) => (
+
+
+ {option.icon}
+
+ {option.label}
+ {option.description}
+
+
+
+
+
+ ))}
+
+
+
+ )
+}
diff --git a/apps/builder/components/editor/BoardMenuButton.tsx b/apps/builder/components/editor/BoardMenuButton.tsx
index f1d4b03f6..ac45d6b8e 100644
--- a/apps/builder/components/editor/BoardMenuButton.tsx
+++ b/apps/builder/components/editor/BoardMenuButton.tsx
@@ -10,15 +10,30 @@ import {
import assert from 'assert'
import { DownloadIcon, MoreVerticalIcon, SettingsIcon } from 'assets/icons'
import { useTypebot } from 'contexts/TypebotContext'
-import React, { useState } from 'react'
+import { useUser } from 'contexts/UserContext'
+import { useRouter } from 'next/router'
+import React, { useEffect, useState } from 'react'
import { parseDefaultPublicId } from 'services/typebots'
+import { isNotDefined } from 'utils'
import { EditorSettingsModal } from './EditorSettingsModal'
export const BoardMenuButton = (props: MenuButtonProps) => {
+ const { query } = useRouter()
const { typebot } = useTypebot()
+ const { user } = useUser()
const [isDownloading, setIsDownloading] = useState(false)
const { isOpen, onOpen, onClose } = useDisclosure()
+ useEffect(() => {
+ if (
+ user &&
+ isNotDefined(user.graphNavigation) &&
+ isNotDefined(query.isFirstBot)
+ )
+ onOpen()
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [])
+
const downloadFlow = () => {
assert(typebot)
setIsDownloading(true)
diff --git a/apps/builder/components/editor/EditorSettingsModal.tsx b/apps/builder/components/editor/EditorSettingsModal.tsx
index 38bdca684..56d3ce446 100644
--- a/apps/builder/components/editor/EditorSettingsModal.tsx
+++ b/apps/builder/components/editor/EditorSettingsModal.tsx
@@ -1,21 +1,12 @@
import {
- Heading,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalOverlay,
- Stack,
- Text,
- Radio,
- VStack,
- RadioGroup,
- HStack,
} from '@chakra-ui/react'
-import { LaptopIcon, MouseIcon } from 'assets/icons'
-import { useUser } from 'contexts/UserContext'
-import { GraphNavigation } from 'db'
-import React, { useEffect, useState } from 'react'
+import { EditorSettings } from 'components/account/EditorSection'
+import React from 'react'
type Props = {
isOpen: boolean
@@ -35,63 +26,3 @@ export const EditorSettingsModal = ({ isOpen, onClose }: Props) => {
)
}
-
-const EditorSettings = () => {
- const { user, saveUser } = useUser()
- const [value, setValue] = useState(
- user?.graphNavigation ?? GraphNavigation.TRACKPAD
- )
-
- useEffect(() => {
- if (user?.graphNavigation === value) return
- saveUser({ graphNavigation: value as GraphNavigation }).then()
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [value])
-
- const options = [
- {
- value: GraphNavigation.MOUSE,
- label: 'Mouse',
- description:
- 'Move by dragging the board and zoom in/out using the scroll wheel',
- icon: ,
- },
- {
- value: GraphNavigation.TRACKPAD,
- label: 'Trackpad',
- description: 'Move the board using 2 fingers and zoom in/out by pinching',
- icon: ,
- },
- ]
-
- return (
-
- Navigation
-
-
- {options.map((option) => (
-
- {option.icon}
-
- {option.label}
- {option.description}
-
-
-
-
- ))}
-
-
-
- )
-}
diff --git a/apps/builder/components/templates/CreateNewTypebotButtons.tsx b/apps/builder/components/templates/CreateNewTypebotButtons.tsx
index 537b10ce4..62d20534d 100644
--- a/apps/builder/components/templates/CreateNewTypebotButtons.tsx
+++ b/apps/builder/components/templates/CreateNewTypebotButtons.tsx
@@ -55,7 +55,12 @@ export const CreateNewTypebotButtons = () => {
if (data)
router.push({
pathname: `/typebots/${data.id}/edit`,
- query: { isFirstBot: router.query.isFirstBot },
+ query:
+ router.query.isFirstBot === 'true'
+ ? {
+ isFirstBot: 'true',
+ }
+ : {},
})
setIsLoading(false)
}
diff --git a/apps/builder/layouts/account/AccountContent.tsx b/apps/builder/layouts/account/AccountContent.tsx
index a1dd9aab1..9fb6b6f80 100644
--- a/apps/builder/layouts/account/AccountContent.tsx
+++ b/apps/builder/layouts/account/AccountContent.tsx
@@ -4,10 +4,11 @@ import { NextChakraLink } from 'components/nextChakra/NextChakraLink'
import React from 'react'
import { PersonalInfoForm } from 'components/account/PersonalInfoForm'
import { BillingSection } from 'components/account/BillingSection'
+import { EditorSection } from 'components/account/EditorSection'
export const AccountContent = () => {
return (
-
+
)