diff --git a/apps/builder/src/assets/styles/submissionsTable.css b/apps/builder/src/assets/styles/resultsTable.css similarity index 100% rename from apps/builder/src/assets/styles/submissionsTable.css rename to apps/builder/src/assets/styles/resultsTable.css diff --git a/apps/builder/src/components/ImageUploadContent/UploadButton.tsx b/apps/builder/src/components/ImageUploadContent/UploadButton.tsx index ccb234107..05bb3d977 100644 --- a/apps/builder/src/components/ImageUploadContent/UploadButton.tsx +++ b/apps/builder/src/components/ImageUploadContent/UploadButton.tsx @@ -1,8 +1,8 @@ import { useToast } from '@/hooks/useToast' -import { compressFile } from '@/utils/helpers' import { Button, ButtonProps, chakra } from '@chakra-ui/react' import { ChangeEvent, useState } from 'react' import { uploadFiles } from '@typebot.io/lib' +import { compressFile } from '@/helpers/compressFile' type UploadButtonProps = { fileType: 'image' | 'audio' diff --git a/apps/builder/src/components/NewVersionPopup.tsx b/apps/builder/src/components/NewVersionPopup.tsx index d1123a575..0a4580dc6 100644 --- a/apps/builder/src/components/NewVersionPopup.tsx +++ b/apps/builder/src/components/NewVersionPopup.tsx @@ -1,4 +1,4 @@ -import { useTypebot } from '@/features/editor' +import { useTypebot } from '@/features/editor/providers/TypebotProvider' import { trpc } from '@/lib/trpc' import { Button, diff --git a/apps/builder/src/components/SupportBubble.tsx b/apps/builder/src/components/SupportBubble.tsx index faa2b8f2a..5d0138be5 100644 --- a/apps/builder/src/components/SupportBubble.tsx +++ b/apps/builder/src/components/SupportBubble.tsx @@ -1,10 +1,10 @@ -import { useTypebot } from '@/features/editor' -import { useUser } from '@/features/account' -import { useWorkspace } from '@/features/workspace' +import { useTypebot } from '@/features/editor/providers/TypebotProvider' +import { useUser } from '@/features/account/hooks/useUser' +import { useWorkspace } from '@/features/workspace/WorkspaceProvider' import React from 'react' import { Bubble } from '@typebot.io/react' -import { planToReadable } from '@/features/billing' -import { isCloudProdInstance } from '@/utils/helpers' +import { isCloudProdInstance } from '@/helpers/isCloudProdInstance' +import { planToReadable } from '@/features/billing/helpers/planToReadable' export const SupportBubble = () => { const { typebot } = useTypebot() diff --git a/apps/builder/src/components/UnlockPlanAlertInfo.tsx b/apps/builder/src/components/UnlockPlanAlertInfo.tsx index b7d7f7ae7..f3240e533 100644 --- a/apps/builder/src/components/UnlockPlanAlertInfo.tsx +++ b/apps/builder/src/components/UnlockPlanAlertInfo.tsx @@ -8,7 +8,8 @@ import { useDisclosure, } from '@chakra-ui/react' import React from 'react' -import { ChangePlanModal, LimitReached } from '@/features/billing' +import { ChangePlanModal } from '@/features/billing/components/ChangePlanModal' +import { LimitReached } from '@/features/billing/types' export const UnlockPlanAlertInfo = ({ contentLabel, diff --git a/apps/builder/src/components/inputs/AutocompleteInput.tsx b/apps/builder/src/components/inputs/AutocompleteInput.tsx index f41ac3300..6c3093c09 100644 --- a/apps/builder/src/components/inputs/AutocompleteInput.tsx +++ b/apps/builder/src/components/inputs/AutocompleteInput.tsx @@ -16,10 +16,10 @@ import { useDebouncedCallback } from 'use-debounce' import { env, isDefined } from '@typebot.io/lib' import { useOutsideClick } from '@/hooks/useOutsideClick' import { useParentModal } from '@/features/graph/providers/ParentModalProvider' -import { VariablesButton } from '@/features/variables' +import { VariablesButton } from '@/features/variables/components/VariablesButton' import { Variable } from '@typebot.io/schemas' -import { injectVariableInText } from '@/features/variables/utils/injectVariableInTextInput' -import { focusInput } from '@/utils/focusInput' +import { injectVariableInText } from '@/features/variables/helpers/injectVariableInTextInput' +import { focusInput } from '@/helpers/focusInput' import { MoreInfoTooltip } from '../MoreInfoTooltip' type Props = { diff --git a/apps/builder/src/components/inputs/CodeEditor.tsx b/apps/builder/src/components/inputs/CodeEditor.tsx index 810a50226..ee13eaf4a 100644 --- a/apps/builder/src/components/inputs/CodeEditor.tsx +++ b/apps/builder/src/components/inputs/CodeEditor.tsx @@ -7,7 +7,7 @@ import { } from '@chakra-ui/react' import { useEffect, useRef, useState } from 'react' import { useDebouncedCallback } from 'use-debounce' -import { VariablesButton } from '@/features/variables' +import { VariablesButton } from '@/features/variables/components/VariablesButton' import { Variable } from '@typebot.io/schemas' import { env } from '@typebot.io/lib' import CodeMirror, { ReactCodeMirrorRef } from '@uiw/react-codemirror' diff --git a/apps/builder/src/components/inputs/NumberInput.tsx b/apps/builder/src/components/inputs/NumberInput.tsx index a34c10bdf..2b26d91a6 100644 --- a/apps/builder/src/components/inputs/NumberInput.tsx +++ b/apps/builder/src/components/inputs/NumberInput.tsx @@ -1,4 +1,4 @@ -import { VariablesButton } from '@/features/variables' +import { VariablesButton } from '@/features/variables/components/VariablesButton' import { NumberInputProps, NumberInput as ChakraNumberInput, diff --git a/apps/builder/src/components/inputs/TextInput.tsx b/apps/builder/src/components/inputs/TextInput.tsx index e0c36f341..1a49c206c 100644 --- a/apps/builder/src/components/inputs/TextInput.tsx +++ b/apps/builder/src/components/inputs/TextInput.tsx @@ -1,6 +1,6 @@ -import { VariablesButton } from '@/features/variables' -import { injectVariableInText } from '@/features/variables/utils/injectVariableInTextInput' -import { focusInput } from '@/utils/focusInput' +import { VariablesButton } from '@/features/variables/components/VariablesButton' +import { injectVariableInText } from '@/features/variables/helpers/injectVariableInTextInput' +import { focusInput } from '@/helpers/focusInput' import { FormControl, FormHelperText, diff --git a/apps/builder/src/components/inputs/Textarea.tsx b/apps/builder/src/components/inputs/Textarea.tsx index c70eef447..61bc32d56 100644 --- a/apps/builder/src/components/inputs/Textarea.tsx +++ b/apps/builder/src/components/inputs/Textarea.tsx @@ -1,6 +1,6 @@ -import { VariablesButton } from '@/features/variables' -import { injectVariableInText } from '@/features/variables/utils/injectVariableInTextInput' -import { focusInput } from '@/utils/focusInput' +import { VariablesButton } from '@/features/variables/components/VariablesButton' +import { injectVariableInText } from '@/features/variables/helpers/injectVariableInTextInput' +import { focusInput } from '@/helpers/focusInput' import { FormControl, FormLabel, diff --git a/apps/builder/src/components/inputs/VariableSearchInput.tsx b/apps/builder/src/components/inputs/VariableSearchInput.tsx index 42fc31607..d76213213 100644 --- a/apps/builder/src/components/inputs/VariableSearchInput.tsx +++ b/apps/builder/src/components/inputs/VariableSearchInput.tsx @@ -15,7 +15,7 @@ import { Text, } from '@chakra-ui/react' import { EditIcon, PlusIcon, TrashIcon } from '@/components/icons' -import { useTypebot } from '@/features/editor/providers/TypebotProvider/TypebotProvider' +import { useTypebot } from '@/features/editor/providers/TypebotProvider' import { createId } from '@paralleldrive/cuid2' import { Variable } from '@typebot.io/schemas' import React, { useState, useRef, ChangeEvent, useEffect } from 'react' diff --git a/apps/builder/src/features/auth/components/logos/AzureAdLogo.tsx b/apps/builder/src/components/logos/AzureAdLogo.tsx similarity index 100% rename from apps/builder/src/features/auth/components/logos/AzureAdLogo.tsx rename to apps/builder/src/components/logos/AzureAdLogo.tsx diff --git a/apps/builder/src/features/auth/components/logos/FacebookLogo.tsx b/apps/builder/src/components/logos/FacebookLogo.tsx similarity index 100% rename from apps/builder/src/features/auth/components/logos/FacebookLogo.tsx rename to apps/builder/src/components/logos/FacebookLogo.tsx diff --git a/apps/builder/src/features/auth/components/logos/GitlabLogo.tsx b/apps/builder/src/components/logos/GitlabLogo.tsx similarity index 100% rename from apps/builder/src/features/auth/components/logos/GitlabLogo.tsx rename to apps/builder/src/components/logos/GitlabLogo.tsx diff --git a/apps/builder/src/features/account/UserProvider.tsx b/apps/builder/src/features/account/UserProvider.tsx index 68b66f39d..9e0ff495e 100644 --- a/apps/builder/src/features/account/UserProvider.tsx +++ b/apps/builder/src/features/account/UserProvider.tsx @@ -1,12 +1,6 @@ import { useSession } from 'next-auth/react' import { useRouter } from 'next/router' -import { - createContext, - ReactNode, - useContext, - useEffect, - useState, -} from 'react' +import { createContext, ReactNode, useEffect, useState } from 'react' import { env, isDefined, isNotDefined } from '@typebot.io/lib' import { User } from '@typebot.io/prisma' import { setUser as setSentryUser } from '@sentry/nextjs' @@ -14,7 +8,7 @@ import { useToast } from '@/hooks/useToast' import { updateUserQuery } from './queries/updateUserQuery' import { useDebouncedCallback } from 'use-debounce' -const userContext = createContext<{ +export const userContext = createContext<{ user?: User isLoading: boolean currentWorkspaceId?: string @@ -110,5 +104,3 @@ const reloadSession = () => { const event = new Event('visibilitychange') document.dispatchEvent(event) } - -export const useUser = () => useContext(userContext) diff --git a/apps/builder/src/features/account/components/MyAccountForm/ApiTokensList/ApiTokensList.tsx b/apps/builder/src/features/account/components/ApiTokensList.tsx similarity index 92% rename from apps/builder/src/features/account/components/MyAccountForm/ApiTokensList/ApiTokensList.tsx rename to apps/builder/src/features/account/components/ApiTokensList.tsx index 5af0712f1..3e554b3cd 100644 --- a/apps/builder/src/features/account/components/MyAccountForm/ApiTokensList/ApiTokensList.tsx +++ b/apps/builder/src/features/account/components/ApiTokensList.tsx @@ -21,10 +21,10 @@ import { User } from '@typebot.io/prisma' import React, { useState } from 'react' import { byId, isDefined } from '@typebot.io/lib' import { CreateTokenModal } from './CreateTokenModal' -import { useApiTokens } from '../../../hooks/useApiTokens' -import { ApiTokenFromServer } from '../../../types' -import { timeSince } from '@/utils/helpers' -import { deleteApiTokenQuery } from '../../../queries/deleteApiTokenQuery' +import { useApiTokens } from '../hooks/useApiTokens' +import { ApiTokenFromServer } from '../types' +import { parseTimeSince } from '@/helpers/parseTimeSince' +import { deleteApiTokenQuery } from '../queries/deleteApiTokenQuery' type Props = { user: User } @@ -83,7 +83,7 @@ export const ApiTokensList = ({ user }: Props) => { {apiTokens?.map((token) => ( {token.name} - {timeSince(token.createdAt)} ago + {parseTimeSince(token.createdAt)} ago