import { Stack, Text } from '@chakra-ui/react' import { InputWithVariableButton } from 'components/shared/TextboxWithVariableButton/InputWithVariableButton' import { VideoBubbleContent, VideoBubbleContentType } from 'models' import urlParser from 'js-video-url-parser/lib/base' import 'js-video-url-parser/lib/provider/vimeo' import 'js-video-url-parser/lib/provider/youtube' import { isDefined } from 'utils' type Props = { content?: VideoBubbleContent onSubmit: (content: VideoBubbleContent) => void } export const VideoUploadContent = ({ content, onSubmit }: Props) => { const handleUrlChange = (url: string) => { const info = urlParser.parse(url) return isDefined(info) && info.provider && info.id ? onSubmit({ type: info.provider as VideoBubbleContentType, url, id: info.id, }) : onSubmit({ type: VideoBubbleContentType.URL, url }) } return ( Works with Youtube, Vimeo and others ) }