Skip to content

Commit

Permalink
Merge branch 'Elia'
Browse files Browse the repository at this point in the history
  • Loading branch information
EliaFerraro committed Jan 15, 2024
2 parents 9ef12c2 + eeb9da8 commit c692598
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 107 deletions.
43 changes: 2 additions & 41 deletions frontend/src/components/ProfessorProposalsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function ProposalRow({
{format(parseISO(proposal.expiration_date), "dd/MM/yyyy")}
</Col>

<Col md={2} xxl={1} className="d-none d-md-block">
<Col md={2} xxl={1} className="mt-3 mt-md-0 d-flex justify-content-center">
<Dropdown>
<Dropdown.Toggle
variant="outline-dark"
Expand Down Expand Up @@ -326,46 +326,7 @@ function ProposalRow({
</Dropdown.Menu>
</Dropdown>
</Col>

<Col
xs={12}
className="d-flex flex-row justify-content-center mt-3 mt-md-0 d-md-none"
id="proposal-detail-actions-copy"
onClick={() => {
navigate("/proposals/" + proposal.proposal_id + "/copy");
}}
>
<span className="d-flex align-items-center">
<FaCopy className="me-1" />
Copy
</span>
</Col>
<Col
xs={12}
className="d-flex flex-row justify-content-center mt-3 mt-md-0 d-md-none"
id="proposal-detail-actions-update"
onClick={() => {
navigate("/proposals/" + proposal.proposal_id + "/update");
}}
>
<span className="d-flex align-items-center">
<FaPen className="me-1" />
Update
</span>
</Col>
<Col
xs={12}
className="d-flex flex-row justify-content-center mt-3 mt-md-0 d-md-none"
id="proposal-detail-actions-archive"
onClick={() => {
setShowArchiveModal(true);
}}
>
<span className="d-flex align-items-center">
<FaArchive className="me-1" />
Archive
</span>
</Col>

<Col
xs={12}
md={1}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ProposalsSearchArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function ProposalsSearchArea(props) {
</Alert>
}

<Form onSubmit={handleSubmit} className="mb-3" style={{ width: "50vw" }} validated={false}>
<Form onSubmit={handleSubmit} className="mb-3" validated={false}>
<Row className="align-items-end">
<Col xs={12} md={2}>
<div className='m-2'>Filter by:</div>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/pages/ApplicationDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ function ApplicationDetails() {
<ProposalInfo infoProposal={infoProposal} />

<Row className="py-1 my-2">
<Col className="text-start" >
<Col xs={4} className="text-start" >
<Button variant="outline-secondary" onClick={() => navigate("/applications")}> Return </Button>
</Col>
<Col className="text-end" >
<Col xs={8} className="text-end" >
<Button id="accept-application" className="mx-2" variant="outline-success" onClick={() => handleButton("Accepted")}>Accept</Button>
<Button id="reject-application" className="mx-2" variant="outline-danger" onClick={() => handleButton("Rejected")}>Reject</Button>
</Col>
Expand Down Expand Up @@ -449,7 +449,7 @@ ProposalInfo.propTypes = {
function RowInfo(props) {

return (
<Row className="fs-5 mx-4 py-1">
<Row className="fs-5 mx-0 mx-sm-4 py-1">
<Col md={6} xs={12}>
<strong>{props.title} </strong>:
</Col>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/ApplicationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ function ApplicationList() {
<Card key={application.application_id} className='my-3'>
<Card.Body>
<Row className="align-items-center">
<Col>
<Col xs={12} sm={6}>
<strong>
{application.name} {application.surname}
</strong>
{' '} has applied for this thesis on {formattedDate(application.application_date)}
</Col>
<Col className="text-end">
<Col xs={12} sm={6} className="text-end mt-2 mt-sm-3 mt-sm-0 d-flex justify-content-center align-items-start d-sm-block">
<Button variant="outline-secondary" className='text-end show-details-btn'
onClick={()=>navigate(`/applications/${application.application_id}`)}>
Show details
Expand Down
40 changes: 25 additions & 15 deletions frontend/src/pages/ProposalDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function ProposalDetailsPage({ mode }) {
case "read":
case "update":
case "copy":
// read, update and copy mode
// read, update and copy mode
getProposalById(proposal_id)
.then(async (res) => {
let data = await res.json();
Expand Down Expand Up @@ -365,7 +365,7 @@ function ProposalDetailsPage({ mode }) {
setUnauthorized(true);
scrollToTarget();
});
break;
break;
case "add":
setTitle("");
setSupervisor(loggedUser.name + " " + loggedUser.surname);
Expand Down Expand Up @@ -637,7 +637,7 @@ function ProposalDetailsPage({ mode }) {
</Col>
</Row>
<Row>
<Col>
<Col xs={mode === "read" ? "6" : "12"} md={"6"} className={mode === "read" ? "pe-1" : "mb-1 mb-md-0 me-0"}>
<Card className="h-100">
{mode === "read" ? (
<Card.Body>
Expand Down Expand Up @@ -674,7 +674,7 @@ function ProposalDetailsPage({ mode }) {
)}
</Card>
</Col>
<Col>
<Col xs={mode === "read" ? "6" : "12"} md={"6"} className={mode === "read" ? "ps-1" : "me-0"}>
<Card className="h-100">
<Card.Body>
<Card.Title>
Expand Down Expand Up @@ -913,7 +913,7 @@ function ProposalDetailsPage({ mode }) {
</Card.Title>
<Form.Group>
<div className="text-plus">
<Col xs={10}>
<Col>
<Form.Control
as={"input"}
name="proposal-keywords"
Expand All @@ -925,7 +925,7 @@ function ProposalDetailsPage({ mode }) {
}}
/>
</Col>
<Col>

<Button
id="add-keyword-btn"
onClick={() => {
Expand Down Expand Up @@ -960,7 +960,7 @@ function ProposalDetailsPage({ mode }) {
>
Add
</Button>
</Col>

</div>
</Form.Group>
<ListGroup id="proposal-keywords-list" className="mt-2">
Expand Down Expand Up @@ -1043,11 +1043,11 @@ function ProposalDetailsPage({ mode }) {
</Col>
</Row>

<Row>
<Col>
<Row className="d-flex justify-content-between g-3 m-2">
<Col xs={12} sm={6} md={4} lg={3} className="mb-2">
<Button
id="go-back"
className="w-50"
className="w-100 h-100"
onClick={() => {
navigate("/proposals");
}}
Expand All @@ -1057,9 +1057,10 @@ function ProposalDetailsPage({ mode }) {
</Col>

{mode === "update" && loggedUser.role === 0 && (
<Col className="d-flex justify-content-end">
<Col xs={12} sm={6} md={4} lg={3} className="mb-2">
<Button
id="add-proposal-btn"
className="w-100 h-100"
onClick={handleUpdateProposal}
>
Save
Expand All @@ -1069,9 +1070,10 @@ function ProposalDetailsPage({ mode }) {

{(mode === "add" || mode === "copy") &&
loggedUser.role === 0 && (
<Col className="d-flex justify-content-end">
<Col xs={12} sm={6} md={4} lg={3} className="mb-2">
<Button
id="add-proposal-btn"
className="w-100 h-100"
onClick={handleCreateProposal}
>
Create Proposal
Expand All @@ -1080,26 +1082,33 @@ function ProposalDetailsPage({ mode }) {
)}

{mode === "read" && loggedUser.role === 1 && (
<Col className="d-flex justify-content-end">
<Col
xs={12}
sm={6}
md={4}
lg={3}
className="d-flex justify-content-end mb-2"
>
<ApplicationButton
setErrMsg={setErrorMessage}
proposalID={proposal_id}
applicationStatusCallback={setApplyingState}
setFileSent={setFileSent}
setIsFile={setIsFile}
className="w-100 h-100"
/>
</Col>
)}

{!(mode === "update" && loggedUser.role === 0) &&
!(mode === "add" || mode === "copy") &&
!(mode === "read" && loggedUser.role === 1) && (
<Col>
<Col xs={12} sm={6} md={4} lg={3} className="mb-2">
<Dropdown className="w-100 d-flex justify-content-end">
<Dropdown.Toggle
variant="outline-dark"
id="dropdown-detail-actions"
className="w-50"
className="w-100 h-100"
>
Actions
</Dropdown.Toggle>
Expand Down Expand Up @@ -1172,6 +1181,7 @@ function ProposalDetailsPage({ mode }) {
</Col>
)}
</Row>

<Modal show={showModal} onHide={handleClose} backdrop="static">
<Modal.Header closeButton>
<Modal.Title>Are you sure?</Modal.Title>
Expand Down
85 changes: 43 additions & 42 deletions frontend/src/pages/ThesisRequestDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,53 +246,54 @@ function ThesisRequestDetailsPage() {
disabled={disabledFields}
required
>
<option value={""} disabled>Select a supervisor</option>
{
teachersList.map((teacher, index) => (
<option key={index} value={teacher.id}>{teacher.surname} {teacher.name} ({teacher.email})</option>
))
}
</Form.Select>
</Form.Group>
</Card.Body>
<option value={""} disabled>Select a supervisor</option>
{
teachersList.map((teacher, index) => (
<option key={index} value={teacher.id}>{teacher.surname} {teacher.name} ({teacher.email})</option>
))
}
</Form.Select>
</Form.Group>
</Card.Body>
}
</Card>
</Col>
<Col xs={12} md={6}>
<Card className="h-100">
<Card.Body>
<Card.Title>Co-Supervisor:</Card.Title>
<Form.Control
id="supervisor"
value={""}
disabled
required
/>
</Card.Body>
</Card>
</Col>
</Row>
<Row>
<Col>
<Button id="go-back" onClick={() => { navigate('/') }}>
Return
</Button>
</Col>
{disabledFields == false &&
<Col className={"d-flex flex-row-reverse"}>
<Button
id="add-request-btn"
onClick={handleCreateRequest}>
Create Request
</Button>
</Col>
}
</Row>
</Form>
</Col>
<Col xs={12} md={6}>
<Card className="h-100">
<Card.Body>
<Card.Title>Co-Supervisor:</Card.Title>
<Form.Control
id="supervisor"
value={""}
disabled
required
/>
</Card.Body>
</Card>
</Col>
</Row>
<Row>
<Col xs={12} sm={6} className='my-2'>
<Button id="go-back" className="w-100" onClick={() => { navigate('/') }}>
Return
</Button>
</Col>
<Col xs={12} sm={6} className="my-2">
<Button
id="add-request-btn"
className="w-100"
onClick={handleCreateRequest}>
Create Request
</Button>
</Col>
</Row>
</Form>

}
</Container>
</Container>
</Container>
</>

);
}

Expand Down
8 changes: 5 additions & 3 deletions frontend/src/style/ProposalDetails.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@

#add-proposal-btn,
#add-keyword-btn,
#add-group-btn {
#add-group-btn,
#add-request-btn {
background-color: #5bc0de;
border-color: #5bc0de;
border: 2px solid #5bc0de;
}

#add-proposal-btn:hover,
Expand Down Expand Up @@ -106,9 +107,10 @@
}

.text-plus {

display: flex;
flex-direction: row;
justify-content: center;
justify-content: space-between;
align-items: center;
margin-bottom: 6px;
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ body {

#show-proposal-detail,
#proposal-detail-actions,
#proposal-detail-actions-copy,
#proposal-detail-actions-update,
#proposal-detail-actions-archive,
#show-details-proposal {
margin-top: -2px;
cursor: pointer;
Expand Down Expand Up @@ -189,6 +192,7 @@ body {
border-color: #003576;
color: #003576;
background-color: white;

}

#dropdown-proposal-actions:hover {
Expand Down

0 comments on commit c692598

Please sign in to comment.