import { useState } from 'react' import { Button, Flex, HStack, Stack, Text } from '@chakra-ui/react' import { SearchContextManager } from '@giphy/react-components' import { UploadButton } from '../buttons/UploadButton' import { GiphySearch } from './GiphySearch' import { useTypebot } from 'contexts/TypebotContext' import { Input } from '../Textbox/Input' import { env, isEmpty } from 'utils' import { EmojiSearchableList } from './emoji/EmojiSearchableList' type Props = { url?: string isEmojiEnabled?: boolean isGiphyEnabled?: boolean onSubmit: (url: string) => void onClose?: () => void } export const ImageUploadContent = ({ url, onSubmit, isEmojiEnabled = false, isGiphyEnabled = true, onClose, }: Props) => { const [currentTab, setCurrentTab] = useState< 'link' | 'upload' | 'giphy' | 'emoji' >(isEmojiEnabled ? 'emoji' : 'upload') const handleSubmit = (url: string) => { onSubmit(url) onClose && onClose() } return ( {isEmojiEnabled && ( )} {isGiphyEnabled && ( )} ) } const BodyContent = ({ tab, url, onSubmit, }: { tab: 'upload' | 'link' | 'giphy' | 'emoji' url?: string onSubmit: (url: string) => void }) => { switch (tab) { case 'upload': return case 'link': return case 'giphy': return case 'emoji': return } } type ContentProps = { initialUrl?: string; onNewUrl: (url: string) => void } const UploadFileContent = ({ onNewUrl }: ContentProps) => { const { typebot } = useTypebot() return ( Choose an image ) } const EmbedLinkContent = ({ initialUrl, onNewUrl }: ContentProps) => ( ) const GiphyContent = ({ onNewUrl }: ContentProps) => { if (isEmpty(env('GIPHY_API_KEY'))) return NEXT_PUBLIC_GIPHY_API_KEY is missing in environment return ( ) }