♻️ (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,9 +1,9 @@
import { BlockIndices, ChoiceInputBlock } from '@typebot.io/schemas'
import React from 'react'
import { ItemNodesList } from '@/features/graph/components/Nodes/ItemNode'
import { Stack, Tag, Text, Wrap } from '@chakra-ui/react'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { SetVariableLabel } from '@/components/SetVariableLabel'
import { ItemNodesList } from '@/features/graph/components/nodes/item/ItemNodesList'
type Props = {
block: ChoiceInputBlock

View File

@@ -7,7 +7,7 @@ import {
Flex,
} from '@chakra-ui/react'
import { PlusIcon } from '@/components/icons'
import { useTypebot } from '@/features/editor'
import { useTypebot } from '@/features/editor/providers/TypebotProvider'
import { ButtonItem, ItemIndices, ItemType } from '@typebot.io/schemas'
import React, { useRef, useState } from 'react'
import { isNotDefined } from '@typebot.io/lib'

View File

@@ -1,3 +0,0 @@
export * from './ButtonsItemNode'
export * from './ButtonsIcon'
export * from './ButtonsBlockSettings'

View File

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

View File

@@ -5,15 +5,12 @@ import { FormLabel, Stack } from '@chakra-ui/react'
import { DateInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type DateInputSettingsBodyProps = {
type Props = {
options: DateInputOptions
onOptionsChange: (options: DateInputOptions) => void
}
export const DateInputSettingsBody = ({
options,
onOptionsChange,
}: DateInputSettingsBodyProps) => {
export const DateInputSettings = ({ options, onOptionsChange }: Props) => {
const handleFromChange = (from: string) =>
onOptionsChange({ ...options, labels: { ...options?.labels, from } })
const handleToChange = (to: string) =>

View File

@@ -1,6 +1,6 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { WithVariableContent } from '@/features/graph/components/nodes/block/WithVariableContent'
type Props = {
variableId?: string

View File

@@ -1,3 +0,0 @@
export { DateInputSettingsBody } from './components/DateInputSettingsBody'
export { DateNodeContent } from './components/DateNodeContent'
export { DateInputIcon } from './components/DateInputIcon'

View File

@@ -1,7 +1,7 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { EmailInputBlock } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { WithVariableContent } from '@/features/graph/components/nodes/block/WithVariableContent'
type Props = {
variableId?: string

View File

@@ -4,15 +4,12 @@ import { FormLabel, Stack } from '@chakra-ui/react'
import { EmailInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type EmailInputSettingsBodyProps = {
type Props = {
options: EmailInputOptions
onOptionsChange: (options: EmailInputOptions) => void
}
export const EmailInputSettingsBody = ({
options,
onOptionsChange,
}: EmailInputSettingsBodyProps) => {
export const EmailInputSettings = ({ options, onOptionsChange }: Props) => {
const handlePlaceholderChange = (placeholder: string) =>
onOptionsChange({ ...options, labels: { ...options.labels, placeholder } })
const handleButtonLabelChange = (button: string) =>

View File

@@ -1,3 +0,0 @@
export { EmailInputSettingsBody } from './components/EmailInputSettingsBody'
export { EmailInputNodeContent } from './components/EmailInputNodeContent'
export { EmailInputIcon } from './components/EmailInputIcon'

View File

@@ -1,4 +1,4 @@
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { WithVariableContent } from '@/features/graph/components/nodes/block/WithVariableContent'
import { Text } from '@chakra-ui/react'
import { FileInputOptions } from '@typebot.io/schemas'

View File

@@ -1,3 +0,0 @@
export { FileInputSettings } from './components/FileInputSettings'
export { FileInputContent } from './components/FileInputContent'
export { FileInputIcon } from './components/FileInputIcon'

View File

@@ -1,29 +1,23 @@
import { TextInput, NumberInput } from '@/components/inputs'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
import { removeUndefinedFields } from '@/utils/helpers'
import { FormLabel, Stack } from '@chakra-ui/react'
import { NumberInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type NumberInputSettingsBodyProps = {
type Props = {
options: NumberInputOptions
onOptionsChange: (options: NumberInputOptions) => void
}
export const NumberInputSettingsBody = ({
options,
onOptionsChange,
}: NumberInputSettingsBodyProps) => {
export const NumberInputSettings = ({ options, onOptionsChange }: Props) => {
const handlePlaceholderChange = (placeholder: string) =>
onOptionsChange({ ...options, labels: { ...options.labels, placeholder } })
const handleButtonLabelChange = (button: string) =>
onOptionsChange({ ...options, labels: { ...options.labels, button } })
const handleMinChange = (min?: number) =>
onOptionsChange(removeUndefinedFields({ ...options, min }))
const handleMaxChange = (max?: number) =>
onOptionsChange(removeUndefinedFields({ ...options, max }))
const handleBlockChange = (block?: number) =>
onOptionsChange(removeUndefinedFields({ ...options, block }))
const handleMinChange = (min?: number) => onOptionsChange({ ...options, min })
const handleMaxChange = (max?: number) => onOptionsChange({ ...options, max })
const handleStepChange = (step?: number) =>
onOptionsChange({ ...options, step })
const handleVariableChange = (variable?: Variable) => {
onOptionsChange({ ...options, variableId: variable?.id })
}
@@ -55,7 +49,7 @@ export const NumberInputSettingsBody = ({
<NumberInput
label="Step:"
defaultValue={options.step}
onValueChange={handleBlockChange}
onValueChange={handleStepChange}
withVariableButton={false}
/>
<Stack>

View File

@@ -1,7 +1,7 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { NumberInputBlock } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { WithVariableContent } from '@/features/graph/components/nodes/block/WithVariableContent'
type Props = {
variableId?: string

View File

@@ -1,3 +0,0 @@
export { NumberInputSettingsBody } from './components/NumberInputSettingsBody'
export { NumberNodeContent } from './components/NumberNodeContent'
export { NumberInputIcon } from './components/NumberInputIcon'

View File

@@ -13,9 +13,9 @@ import {
import { DropdownList } from '@/components/DropdownList'
import { PaymentInputOptions, PaymentProvider } from '@typebot.io/schemas'
import React, { ChangeEvent } from 'react'
import { currencies } from './currencies'
import { currencies } from '../currencies'
import { StripeConfigModal } from './StripeConfigModal'
import { CredentialsDropdown } from '@/features/credentials'
import { CredentialsDropdown } from '@/features/credentials/components/CredentialsDropdown'
import { TextInput } from '@/components/inputs'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'

View File

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

View File

@@ -13,9 +13,8 @@ import {
Text,
HStack,
} from '@chakra-ui/react'
import { useUser } from '@/features/account'
import React, { useState } from 'react'
import { useWorkspace } from '@/features/workspace'
import { useWorkspace } from '@/features/workspace/WorkspaceProvider'
import { useToast } from '@/hooks/useToast'
import { TextInput } from '@/components/inputs'
import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'
@@ -23,6 +22,7 @@ import { TextLink } from '@/components/TextLink'
import { StripeCredentials } from '@typebot.io/schemas'
import { trpc } from '@/lib/trpc'
import { isNotEmpty } from '@typebot.io/lib'
import { useUser } from '@/features/account/hooks/useUser'
type Props = {
isOpen: boolean

View File

@@ -1,3 +0,0 @@
export { PaymentSettings } from './components/PaymentSettings'
export { PaymentInputContent } from './components/PaymentInputContent'
export { PaymentInputIcon } from './components/PaymentInputIcon'

View File

@@ -5,15 +5,12 @@ import { PhoneNumberInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
import { CountryCodeSelect } from './CountryCodeSelect'
type PhoneNumberSettingsBodyProps = {
type Props = {
options: PhoneNumberInputOptions
onOptionsChange: (options: PhoneNumberInputOptions) => void
}
export const PhoneNumberSettingsBody = ({
options,
onOptionsChange,
}: PhoneNumberSettingsBodyProps) => {
export const PhoneInputSettings = ({ options, onOptionsChange }: Props) => {
const handlePlaceholderChange = (placeholder: string) =>
onOptionsChange({ ...options, labels: { ...options.labels, placeholder } })
const handleButtonLabelChange = (button: string) =>

View File

@@ -1,7 +1,7 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { PhoneNumberInputOptions } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { WithVariableContent } from '@/features/graph/components/nodes/block/WithVariableContent'
type Props = {
variableId?: string

View File

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

View File

@@ -1,3 +0,0 @@
export { PhoneNumberSettingsBody } from './components/PhoneNumberSettingsBody'
export { PhoneNodeContent } from './components/PhoneNodeContent'
export { PhoneInputIcon } from './components/PhoneInputIcon'

View File

@@ -1,4 +1,4 @@
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { WithVariableContent } from '@/features/graph/components/nodes/block/WithVariableContent'
import { Text } from '@chakra-ui/react'
import { RatingInputBlock } from '@typebot.io/schemas'

View File

@@ -6,15 +6,12 @@ import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { TextInput } from '@/components/inputs'
import { VariableSearchInput } from '@/components/inputs/VariableSearchInput'
type RatingInputSettingsProps = {
type Props = {
options: RatingInputOptions
onOptionsChange: (options: RatingInputOptions) => void
}
export const RatingInputSettings = ({
options,
onOptionsChange,
}: RatingInputSettingsProps) => {
export const RatingInputSettings = ({ options, onOptionsChange }: Props) => {
const handleLengthChange = (length: number) =>
onOptionsChange({ ...options, length })

View File

@@ -1,3 +0,0 @@
export { RatingInputSettings } from './components/RatingInputSettings'
export { RatingInputContent } from './components/RatingInputContent'
export { RatingInputIcon } from './components/RatingInputIcon'

View File

@@ -1,7 +1,7 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { TextInputOptions } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { WithVariableContent } from '@/features/graph/components/nodes/block/WithVariableContent'
type Props = {
placeholder: TextInputOptions['labels']['placeholder']

View File

@@ -5,15 +5,12 @@ import { FormLabel, Stack } from '@chakra-ui/react'
import { TextInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type TextInputSettingsBodyProps = {
type Props = {
options: TextInputOptions
onOptionsChange: (options: TextInputOptions) => void
}
export const TextInputSettingsBody = ({
options,
onOptionsChange,
}: TextInputSettingsBodyProps) => {
export const TextInputSettings = ({ options, onOptionsChange }: Props) => {
const handlePlaceholderChange = (placeholder: string) =>
onOptionsChange({ ...options, labels: { ...options.labels, placeholder } })
const handleButtonLabelChange = (button: string) =>

View File

@@ -1,3 +0,0 @@
export { TextInputSettingsBody } from './components/TextInputSettingsBody'
export { TextInputNodeContent } from './components/TextInputNodeContent'
export { TextInputIcon } from './components/TextInputIcon'

View File

@@ -4,15 +4,12 @@ import { FormLabel, Stack } from '@chakra-ui/react'
import { UrlInputOptions, Variable } from '@typebot.io/schemas'
import React from 'react'
type UrlInputSettingsBodyProps = {
type Props = {
options: UrlInputOptions
onOptionsChange: (options: UrlInputOptions) => void
}
export const UrlInputSettingsBody = ({
options,
onOptionsChange,
}: UrlInputSettingsBodyProps) => {
export const UrlInputSettings = ({ options, onOptionsChange }: Props) => {
const handlePlaceholderChange = (placeholder: string) =>
onOptionsChange({ ...options, labels: { ...options.labels, placeholder } })
const handleButtonLabelChange = (button: string) =>

View File

@@ -1,7 +1,7 @@
import React from 'react'
import { Text } from '@chakra-ui/react'
import { UrlInputOptions } from '@typebot.io/schemas'
import { WithVariableContent } from '@/features/graph/components/Nodes/BlockNode/BlockNodeContent/WithVariableContent'
import { WithVariableContent } from '@/features/graph/components/nodes/block/WithVariableContent'
type Props = {
variableId?: string

View File

@@ -1,3 +0,0 @@
export { UrlInputSettingsBody } from './components/UrlInputSettingsBody'
export { UrlNodeContent } from './components/UrlNodeContent'
export { UrlInputIcon } from './components/UrlInputIcon'