import FormLayout, { ButtonBlack, Flex, FormField, FormLabel, FormMessage, Input, Textarea } from "@components/UI/Form/Form"; import React, { useState } from "react"; import * as Form from '@radix-ui/react-form'; import BarLoader from "react-spinners/BarLoader"; function VideoModal({ submitFileActivity, chapterId }: any) { const [video, setVideo] = React.useState(null) as any; const [isSubmitting, setIsSubmitting] = useState(false); const [name, setName] = React.useState(""); const handleVideoChange = (event: React.ChangeEvent) => { setVideo(event.target.files[0]); }; const handleNameChange = (event: React.ChangeEvent) => { setName(event.target.value); }; const handleSubmit = async (e: any) => { e.preventDefault(); setIsSubmitting(true); let status = await submitFileActivity(video, "video", { name, type: "video" }, chapterId); setIsSubmitting(false); }; /* TODO : implement some sort of progress bar for file uploads, it is not possible yet because i'm not using axios. and the actual upload isn't happening here anyway, it's in the submitFileActivity function */ return ( Video name Please provide a name for your video activity Video file Please provide a video for your activity {isSubmitting ? : "Create activity"} ); } export default VideoModal;