From 078509c44b60b81e759142369fb41e4e4c6ef4e1 Mon Sep 17 00:00:00 2001 From: paritshivani Date: Tue, 29 Oct 2024 14:48:15 +0530 Subject: [PATCH] youtube --- .../src/pages/learnathon/lernCreatorForm.js | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/packages/nulp_elite/src/pages/learnathon/lernCreatorForm.js b/packages/nulp_elite/src/pages/learnathon/lernCreatorForm.js index 42c65870..f20e6e80 100644 --- a/packages/nulp_elite/src/pages/learnathon/lernCreatorForm.js +++ b/packages/nulp_elite/src/pages/learnathon/lernCreatorForm.js @@ -30,6 +30,7 @@ import InputLabel from "@mui/material/InputLabel"; import stateguideline from "../../assets/state-guidelines.pdf"; import statetnc from "../../assets/state-tnc.pdf"; import Alert from "@mui/material/Alert"; +const routeConfig = require("../../configs/routeConfig.json"); import { Observable } from "rxjs"; @@ -130,6 +131,8 @@ const LernCreatorForm = () => { const [city, setCity] = useState(""); const [searchTerm, setSearchTerm] = useState(""); const [uploadType, setUploadType] = useState("file"); + const [previewPlayerPage, setPreviewPlayerPage] = useState(); + const [iconPreviewPage, setIconPreviewPage] = useState(); const handleUploadTypeChange = (event) => { console.log(event.target.value); @@ -203,6 +206,8 @@ const LernCreatorForm = () => { } const result = await response.json(); + setPreviewPlayerPage(result.result.data[0].content_id); + setIconPreviewPage(result.result.data[0].icon); // fetchIconData(result.result.data[0].icon); fetchContentData(result.result.data[0].content_id); setIsEdit(true); @@ -456,10 +461,7 @@ const LernCreatorForm = () => { console.log("error---", error); } finally { } - setFormData({ - ...formData, - icon: uploadResult.result.artifactUrl, - }); + setErrors({ ...errors, icon: "" }); } catch (error) { console.log("error---", error); @@ -1372,14 +1374,13 @@ const LernCreatorForm = () => { fullWidth onChange={(event) => handleFileChange(event, "file")} inputProps={{ - accept: - "video/mp4,application/pdf,text/html,video/youtube", + accept: "video/mp4,application/pdf,text/html", }} sx={{ border: "1px dashed" }} /> ) : ( - + { )} - + + {" "} + {isEdit && formData.content_id && ( + { + window.open( + `${routeConfig.ROUTES.PLAYER_PAGE.PLAYER}?id=${previewPlayerPage}`, + "_blank" + ); + }} + > + Preview + + )} + Supported formats: MP4, PDF, HTML5, YouTube links