♻️ (builder) Remove barrel export and flatten folder arch

This commit is contained in:
Baptiste Arnaud
2023-03-15 11:51:30 +01:00
parent cbc8194f19
commit 44d7a0bcb8
498 changed files with 1542 additions and 1786 deletions

View File

@@ -1,2 +0,0 @@
export * from './AudioBubbleNode'
export * from './AudioBubbleIcon'

View File

@@ -1 +0,0 @@
export * from './components'

View File

@@ -1,3 +0,0 @@
export { EmbedBubbleContent } from './components/EmbedBubbleContent'
export { EmbedUploadContent } from './components/EmbedUploadContent'
export { EmbedBubbleIcon } from './components/EmbedBubbleIcon'

View File

@@ -1,2 +0,0 @@
export { ImageBubbleContent } from './components/ImageBubbleContent'
export { ImageBubbleIcon } from './components/ImageBubbleIcon'

View File

@@ -1,9 +1,9 @@
import { Flex } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { TextBubbleBlock } from '@typebot.io/schemas'
import React from 'react'
import { parseVariableHighlight } from '@/utils/helpers'
import { isEmpty } from '@typebot.io/lib'
import { parseVariableHtmlTags } from '@/features/variables/helpers/parseVariableHtmlTags'
type Props = {
block: TextBubbleBlock
@@ -11,7 +11,6 @@ type Props = {
export const TextBubbleContent = ({ block }: Props) => {
const { typebot } = useTypebot()
if (!typebot) return <></>
return (
<Flex
w="90%"
@@ -22,7 +21,7 @@ export const TextBubbleContent = ({ block }: Props) => {
dangerouslySetInnerHTML={{
__html: isEmpty(block.content.plainText)
? `<p>Click to edit...</p>`
: parseVariableHighlight(block.content.html, typebot),
: parseVariableHtmlTags(block.content.html, typebot?.variables ?? []),
}}
/>
)

View File

@@ -8,7 +8,6 @@ import React, { useEffect, useRef, useState } from 'react'
import { Plate, PlateProvider, usePlateEditorRef } from '@udecode/plate-core'
import { editorStyle, platePlugins } from '@/lib/plate'
import { BaseEditor, BaseSelection, Transforms } from 'slate'
import { ToolBar } from './ToolBar'
import {
defaultTextBubbleContent,
TextBubbleContent,
@@ -16,11 +15,12 @@ import {
} from '@typebot.io/schemas'
import { ReactEditor } from 'slate-react'
import { serializeHtml } from '@udecode/plate-serializer-html'
import { parseHtmlStringToPlainText } from '../../utils'
import { parseHtmlStringToPlainText } from '../utils'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { colors } from '@/lib/theme'
import { useOutsideClick } from '@/hooks/useOutsideClick'
import { selectEditor, TElement } from '@udecode/plate-common'
import { TextEditorToolBar } from './TextEditorToolBar'
type TextBubbleEditorContentProps = {
id: string
@@ -130,7 +130,9 @@ const TextBubbleEditorContent = ({
},
}}
>
<ToolBar onVariablesButtonClick={() => setIsVariableDropdownOpen(true)} />
<TextEditorToolBar
onVariablesButtonClick={() => setIsVariableDropdownOpen(true)}
/>
<Plate
id={id}
editableProps={{

View File

@@ -1 +0,0 @@
export { TextBubbleEditor } from './TextBubbleEditor'

View File

@@ -24,7 +24,10 @@ type Props = {
onVariablesButtonClick: () => void
} & StackProps
export const ToolBar = ({ onVariablesButtonClick, ...props }: Props) => {
export const TextEditorToolBar = ({
onVariablesButtonClick,
...props
}: Props) => {
const editor = usePlateEditorRef()
const handleVariablesButtonMouseDown = (e: React.MouseEvent) => {
e.stopPropagation()

View File

@@ -1,3 +0,0 @@
export { TextBubbleEditor } from './components/TextBubbleEditor'
export { TextBubbleContent } from './components/TextBubbleContent'
export { TextBubbleIcon } from './components/TextBubbleIcon'

View File

@@ -1,3 +0,0 @@
export { VideoUploadContent } from './components/VideoUploadContent'
export { VideoBubbleContent } from './components/VideoBubbleContent'
export { VideoBubbleIcon } from './components/VideoBubbleIcon'