Skip to content

Commit 75c20d9

Browse files
committed
feat: adds video link to input
1 parent e41dc40 commit 75c20d9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

zubhub_frontend/zubhub/src/components/form/videoInput/VideoInput.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Box, CardMedia, FormControl, TextField, Typography, makeStyles } from '
22
import { ClearRounded, CloudUploadOutlined } from '@material-ui/icons';
33
import clsx from 'clsx';
44
import _ from 'lodash';
5-
import React, { useRef } from 'react';
5+
import React, { useRef, useEffect } from 'react';
66
import styles from '../../../assets/js/styles';
77
import { isGdriveORVimeoORYoutube } from '../../../views/project_details/projectDetailsScripts';
88
import { refactorVideoUrl } from '../../input/inputScripts';
@@ -14,7 +14,7 @@ function VideoInput({ name, label, required, value = [], handleChange, linkValue
1414
const classes = makeStyles(videoInputStyles)();
1515
const input = useRef(null);
1616
const videoRef = useRef(null);
17-
const clickCount = 0;
17+
var clickCount = 0;
1818

1919
const handleFileChange = files => {
2020
const maxAssets = 1;
@@ -75,6 +75,11 @@ function VideoInput({ name, label, required, value = [], handleChange, linkValue
7575
handleChange('', 'link');
7676
};
7777

78+
useEffect(() => {
79+
if (linkValue) {
80+
handleChange(linkValue, 'link');
81+
}
82+
}, [linkValue, handleChange]);
7883
const uploadedVideo = () => {
7984
if (typeof value !== 'string' && value?.length > 0) {
8085
return value?.map((asset, index) => (

0 commit comments

Comments
 (0)