Skip to content

Commit 165b25b

Browse files
committed
remove description from add file/contribution
1 parent cc8d412 commit 165b25b

File tree

1 file changed

+7
-28
lines changed

1 file changed

+7
-28
lines changed

client/src/screens/contributions/index.jsx

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,18 @@ const Contributions = () => {
2525
setContributionId(uuidv4());
2626
}, []);
2727

28-
const [description, setDescription] = useState(null);
2928
const [submitEnabled, setSubmitEnabled] = useState(false);
3029

31-
useEffect(() => {
32-
if (!description) {
33-
setSubmitEnabled(false);
34-
return;
35-
}
36-
setSubmitEnabled(true);
37-
}, [description]);
38-
3930
// const [contributionId, setContributionId] = useState("");
4031

4132
let pond = useRef();
4233

34+
const handleUpdateFiles = (fileItems) => {
35+
if(fileItems.length > 0) setSubmitEnabled(true);
36+
else setSubmitEnabled(false);
37+
}
38+
4339
async function handleSubmit() {
44-
if (!description) {
45-
toast.error("Please fill the complete form.");
46-
return;
47-
}
4840
const collection = document.getElementsByClassName("contri");
4941
const contributionSection = collection[0];
5042
// console.log(toggle);
@@ -56,7 +48,7 @@ const Contributions = () => {
5648
let resp = await CreateNewContribution({
5749
parentFolder: currentFolder._id,
5850
courseCode: currentFolder.course,
59-
description,
51+
description: "default",
6052
approved: false,
6153
contributionId,
6254
uploadedBy,
@@ -100,24 +92,11 @@ const Contributions = () => {
10092
<div className="disclaimer">
10193
Selected Files will get uploaded to the current folder
10294
</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>
11795
<div className="file_pond">
11896
<FilePond
11997
name="file"
12098
allowMultiple={true}
99+
onupdatefiles={handleUpdateFiles}
121100
maxFiles={40}
122101
server={{
123102
url: "http://localhost:8080/api/contribution/upload",

0 commit comments

Comments
 (0)