From 75c20d9b7823c3fef363e6f9a0f709ceaf16de9d Mon Sep 17 00:00:00 2001 From: Steve Yonkeu Date: Fri, 1 Mar 2024 07:53:31 +0100 Subject: [PATCH] feat: adds video link to input --- .../zubhub/src/components/form/videoInput/VideoInput.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zubhub_frontend/zubhub/src/components/form/videoInput/VideoInput.jsx b/zubhub_frontend/zubhub/src/components/form/videoInput/VideoInput.jsx index 9e4857bd6..355f48245 100644 --- a/zubhub_frontend/zubhub/src/components/form/videoInput/VideoInput.jsx +++ b/zubhub_frontend/zubhub/src/components/form/videoInput/VideoInput.jsx @@ -2,7 +2,7 @@ import { Box, CardMedia, FormControl, TextField, Typography, makeStyles } from ' import { ClearRounded, CloudUploadOutlined } from '@material-ui/icons'; import clsx from 'clsx'; import _ from 'lodash'; -import React, { useRef } from 'react'; +import React, { useRef, useEffect } from 'react'; import styles from '../../../assets/js/styles'; import { isGdriveORVimeoORYoutube } from '../../../views/project_details/projectDetailsScripts'; import { refactorVideoUrl } from '../../input/inputScripts'; @@ -14,7 +14,7 @@ function VideoInput({ name, label, required, value = [], handleChange, linkValue const classes = makeStyles(videoInputStyles)(); const input = useRef(null); const videoRef = useRef(null); - const clickCount = 0; + var clickCount = 0; const handleFileChange = files => { const maxAssets = 1; @@ -75,6 +75,11 @@ function VideoInput({ name, label, required, value = [], handleChange, linkValue handleChange('', 'link'); }; + useEffect(() => { + if (linkValue) { + handleChange(linkValue, 'link'); + } + }, [linkValue, handleChange]); const uploadedVideo = () => { if (typeof value !== 'string' && value?.length > 0) { return value?.map((asset, index) => (