From c60a7ae44756a42ea2b427f7671ec4da852da40b Mon Sep 17 00:00:00 2001 From: gift256 Date: Fri, 1 Mar 2024 11:02:23 +0300 Subject: [PATCH 1/2] fix material_used and category issues --- .../zubhub/src/views/create_project/script.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/zubhub_frontend/zubhub/src/views/create_project/script.js b/zubhub_frontend/zubhub/src/views/create_project/script.js index c2b367a2c..25e3f9a35 100644 --- a/zubhub_frontend/zubhub/src/views/create_project/script.js +++ b/zubhub_frontend/zubhub/src/views/create_project/script.js @@ -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); From 2d0c4d6924553aedc2974bd2fd58be6bda24cc33 Mon Sep 17 00:00:00 2001 From: Steve Yonkeu Date: Fri, 1 Mar 2024 13:42:16 +0100 Subject: [PATCH 2/2] fix: fix youtube link not showing --- .../src/components/form/videoInput/VideoInput.jsx | 10 ++++++++-- 1 file changed, 8 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 08e2f0e25..12987d301 100644 --- a/zubhub_frontend/zubhub/src/components/form/videoInput/VideoInput.jsx +++ b/zubhub_frontend/zubhub/src/components/form/videoInput/VideoInput.jsx @@ -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'; @@ -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; @@ -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) => (