Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/wncc/SoC-Portal
Browse files Browse the repository at this point in the history
  • Loading branch information
Prater-12 committed Oct 15, 2023
2 parents 2c3c0fd + 3317e3a commit 8243970
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 55 deletions.
2 changes: 2 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ This project aims at creating a functional, user-friendly portal for WnCC's annu

You can find more such improvements in issues on which you can contribute.



<p align="center">Created with :heart: by <a href="https://itc.gymkhana.iitb.ac.in/wncc/">WnCC</a></p>
14 changes: 12 additions & 2 deletions frontend/src/components/MyComponent.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import React from "react";
import './comments.css';

export default function MyComponent(props){
export default function MyComponent({text}){
if (text.length === 0)
{
return(
<div className="searchbar">
<p>
No Profiles Found
</p>
</div>
)
}
return(
<div className="searchbar">
<p>
{props.text}
{text[0].roll_number}
</p>
</div>
)
Expand Down
132 changes: 79 additions & 53 deletions frontend/src/pages/ProjectFrom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,104 +9,130 @@ import MyComponent2 from "../components/MyComponent2";
export default function ProjectForm(){

const [projectlist , setProjectlist] = useState({
project_name : '',
project_type : '',
title: '',
abc: '',
categary: '',
mentee_min: '',
mentee_max: '',
description: '',
timeline: '',
banner_image: '',

})

const [roll_number,setRoll_number] = useState()

const detailsChange = (e) => {
const {id,value} = e.target
setProjectlist({
...projectlist,
[id] : value,
// console.log(projectlist)
})
console.log('id:', id);
console.log('value:', value);
}

const handleRollNumberChange = (e) => {
setRoll_number(e.target.value);
const detailsSubmit = (e) => {
console.log(projectlist)
axios.post('/api/dashboard/mentor/submit/',projectlist)
.then(res =>{
console.log(res)
}).catch(err =>
console.log(err))
}

// const [toggle,setToggle] = useState(false)
// const [anyone,setAnyone] = useState(false)

const handleSubmit = (e) => {
// console.log(roll_number)
e.preventDefault();
console.log(roll_number)
axios.get('/api/accounts/'+'?search='+roll_number)
const handleRollNumberChange = (e) => {
var roll = e.target.value ? e.target.value : null;
if(roll === null) return;
axios.get('/api/accounts/'+'?search='+roll)
.then( function(roll_number){
console.log(roll_number.data)
})

if(roll_number.data.length === 0){
alert("No such user exists")
e.target.style.backgroundColor = 'red';


}
else{
e.target.style.backgroundColor = 'green';
}

})
.catch( err =>{
alert(err);
})

}

const handleRollSubmit = (e) => {
e.preventDefault();

}
return (
<>
<h1>Project Form</h1>
<form>
<label>Project Title</label>
<input type='text' />
<input type='text' id='title' onChange={detailsChange}/>
<br></br>
<label>
<input id='roll_number' type='search' onChange={handleRollNumberChange}/>
<button onClick={handleSubmit}>
Search
</button>
{/* {toggle && <MyComponent text="roll_number"/>} */}
{/* {anyone && <MyComponent2 />} */}
Co Mentors
<input type='text' placeholder="Co-Mentor-1 RollNumber" onBlur={handleRollNumberChange}/>
<input type='text' placeholder="Co-Mentor-2 RollNumber" onBlur={handleRollNumberChange}/>

</label>

<br></br>
<label>
Title your project idea
<input type='text' />
<input type='text' id='abc' requried onChange={detailsChange}/>
</label>
<br></br>
<div>
<h3>Project Cateogary</h3>
<label>
<input type='radio' name="item" />
App Development
</label>
<br></br>
<label>
<input type='radio' name="item" />
Web Development
</label>
<br></br>
<label>
<input type='radio' name="item"/>
Game Development
</label>
<br></br>
<label>
<input type='radio' name="item"/>
Blockchain Development
</label>
<br></br>
<label>
<input type='radio' name="item"/>
Machine Learning
</label>
<select id='categary' onChange={detailsChange}>
<option value="WEB3">WEB3</option>
<option value="AIML">AIML</option>
<option value="DEV">DEV</option>
<option value="CP">CP</option>
<option value="MISC">MISC</option>
</select>
<br></br>
<br></br>
</div>
<label>
<input type='text'/>
<input type='text' id='description' onChange={detailsChange}/>
Description of the project
</label>
<br></br>
<label>
<input type='number'/>
number of mentees you need
<input type='number' id='mentee_min' onChange={detailsChange}/>
minimum number of mentees
</label>
<br></br>
<label>
<input type='number' id='mentee_max' onChange={detailsChange}/>
maximum number of mentees
</label>
<br></br>
<label>
Prereqisite of the mentees(if any)
<input type ='text'/>
<input type ='text' id='abstract' onChange={detailsChange}/>
</label>
<br></br>
<label>
timeline(if any)
<input type ='text' id='timeline' onChange={detailsChange}/>
</label>
<br></br>
<label>
upload the banner of the project (as pdf)
<input type='pdffile'/>
<input type='file'id='banner_image' onChange={detailsChange}/>
</label>
</form>
<button onClick={detailsSubmit}>
Submit Project
</button>
</>
)
}
}

0 comments on commit 8243970

Please sign in to comment.