Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { makeStyles } from '@mui/styles';
import { ClearRounded, CloudUploadOutlined } from '@mui/icons-material';
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';
Expand All @@ -15,7 +15,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;
Expand Down Expand Up @@ -76,6 +76,12 @@ 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) => (
Expand Down
17 changes: 2 additions & 15 deletions zubhub_frontend/zubhub/src/views/create_project/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -693,21 +693,8 @@ export const validationSchema = Yup.object().shape({
// ? false
// : true;
// }),
materials_used: Yup.string()
.max(10000, 'max')
.test('empty', 'required', value => {
let is_empty = true;

value &&
value.split(',').forEach(material => {
if (material) {
is_empty = false;
}
});

return !is_empty;
}),
category: Yup.string(),
materials_used: Yup.array().required('required'),
category: Yup.array(),
// tags: Yup.mixed().test('unsupported', 'unsupported', tags => {
// if (tags) {
// tags = JSON.parse(tags);
Expand Down