-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d17897
commit df2474e
Showing
14 changed files
with
432 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
apps/builder/components/board/graph/BlockNode/StepNode/ContentPopover/VideoUploadContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Stack, Text } from '@chakra-ui/react' | ||
import { InputWithVariableButton } from 'components/shared/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 ( | ||
<Stack p="2"> | ||
<InputWithVariableButton | ||
placeholder="Paste the video link..." | ||
initialValue={content?.url ?? ''} | ||
onChange={handleUrlChange} | ||
delay={100} | ||
/> | ||
<Text fontSize="sm" color="gray.400" textAlign="center"> | ||
Works with Youtube, Vimeo and others | ||
</Text> | ||
</Stack> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { ImageUploadContent as ImagePopoverContent } from './ImageUploadContent' | ||
export { ImageUploadContent } from './ImageUploadContent' |
Oops, something went wrong.