@@ -25,26 +25,18 @@ const Contributions = () => {
25
25
setContributionId ( uuidv4 ( ) ) ;
26
26
} , [ ] ) ;
27
27
28
- const [ description , setDescription ] = useState ( null ) ;
29
28
const [ submitEnabled , setSubmitEnabled ] = useState ( false ) ;
30
29
31
- useEffect ( ( ) => {
32
- if ( ! description ) {
33
- setSubmitEnabled ( false ) ;
34
- return ;
35
- }
36
- setSubmitEnabled ( true ) ;
37
- } , [ description ] ) ;
38
-
39
30
// const [contributionId, setContributionId] = useState("");
40
31
41
32
let pond = useRef ( ) ;
42
33
34
+ const handleUpdateFiles = ( fileItems ) => {
35
+ if ( fileItems . length > 0 ) setSubmitEnabled ( true ) ;
36
+ else setSubmitEnabled ( false ) ;
37
+ }
38
+
43
39
async function handleSubmit ( ) {
44
- if ( ! description ) {
45
- toast . error ( "Please fill the complete form." ) ;
46
- return ;
47
- }
48
40
const collection = document . getElementsByClassName ( "contri" ) ;
49
41
const contributionSection = collection [ 0 ] ;
50
42
// console.log(toggle);
@@ -56,7 +48,7 @@ const Contributions = () => {
56
48
let resp = await CreateNewContribution ( {
57
49
parentFolder : currentFolder . _id ,
58
50
courseCode : currentFolder . course ,
59
- description,
51
+ description : "default" ,
60
52
approved : false ,
61
53
contributionId,
62
54
uploadedBy,
@@ -100,24 +92,11 @@ const Contributions = () => {
100
92
< div className = "disclaimer" >
101
93
Selected Files will get uploaded to the current folder
102
94
</ div >
103
- < form >
104
- < div className = "description" >
105
- < label htmlFor = "description" className = "label_description" >
106
- DESCRIPTION :
107
- </ label >
108
- < textarea
109
- name = "description"
110
- className = "input_description"
111
- placeholder = "Give a brief description"
112
- value = { description ? description : "" }
113
- onChange = { ( e ) => setDescription ( e . target . value ) }
114
- > </ textarea >
115
- </ div >
116
- </ form >
117
95
< div className = "file_pond" >
118
96
< FilePond
119
97
name = "file"
120
98
allowMultiple = { true }
99
+ onupdatefiles = { handleUpdateFiles }
121
100
maxFiles = { 40 }
122
101
server = { {
123
102
url : "http://localhost:8080/api/contribution/upload" ,
0 commit comments