generated from HackYourFuture-CPH/boilerplate-for-fp
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into checkinresponses-backend/eva
- Loading branch information
Showing
21 changed files
with
1,216 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
packages/client/src/components/CheckinQuestionsPage/AddCheckinQuestionModal.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import React, { useState } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Button, TextField, Modal, Box, Typography } from '@mui/material'; | ||
|
||
const style = { | ||
position: 'absolute', | ||
top: '50%', | ||
left: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
width: 400, | ||
bgcolor: 'background.paper', | ||
boxShadow: 24, | ||
p: 4, | ||
}; | ||
|
||
const AddCheckinQuestionModal = ({ | ||
showAddModal, | ||
setShowAddModal, | ||
newQuestionText, | ||
setNewQuestionText, | ||
handleAdd, | ||
}) => { | ||
const [error, setError] = useState(false); | ||
|
||
const onSave = () => { | ||
if (newQuestionText.trim() === '') { | ||
setError(true); | ||
return; | ||
} | ||
handleAdd(); | ||
setNewQuestionText(''); | ||
}; | ||
|
||
return ( | ||
<Modal | ||
open={showAddModal} | ||
onClose={() => setShowAddModal(false)} | ||
aria-labelledby="modal-modal-title" | ||
aria-describedby="modal-modal-description" | ||
> | ||
<Box sx={style} className="modal-container"> | ||
<Typography | ||
variant="h6" | ||
style={{ textAlign: 'center', marginBottom: '10px' }} | ||
> | ||
Add Checkin Question | ||
</Typography> | ||
<TextField | ||
id="outlined-multiline-static" | ||
label="Write your question here..." | ||
multiline | ||
rows={4} | ||
value={newQuestionText} | ||
onChange={(e) => { | ||
setNewQuestionText(e.target.value); | ||
setError(false); | ||
}} | ||
fullWidth | ||
variant="outlined" | ||
error={error} | ||
helperText={error ? 'Question cannot be empty' : ''} | ||
sx={{ mb: 2 }} | ||
/> | ||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: '10px' }}> | ||
<Button variant="contained" onClick={onSave}> | ||
Add Question | ||
</Button> | ||
<Button variant="outlined" onClick={() => setShowAddModal(false)}> | ||
Cancel | ||
</Button> | ||
</Box> | ||
</Box> | ||
</Modal> | ||
); | ||
}; | ||
|
||
AddCheckinQuestionModal.propTypes = { | ||
showAddModal: PropTypes.bool.isRequired, | ||
setShowAddModal: PropTypes.func.isRequired, | ||
newQuestionText: PropTypes.string.isRequired, | ||
setNewQuestionText: PropTypes.func.isRequired, | ||
handleAdd: PropTypes.func.isRequired, | ||
}; | ||
|
||
export { AddCheckinQuestionModal }; |
64 changes: 64 additions & 0 deletions
64
packages/client/src/components/CheckinQuestionsPage/EditCheckinQuestionModal.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Button, TextField, Modal, Box, Typography } from '@mui/material'; | ||
|
||
const EditCheckinQuestionModal = ({ | ||
showEditModal, | ||
questionId, | ||
questionText, | ||
setQuestionText, | ||
handleSaveEdit, | ||
handleClose, | ||
}) => { | ||
if (!showEditModal) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Modal | ||
open={showEditModal} | ||
onClose={handleClose} | ||
aria-labelledby="modal-modal-title" | ||
aria-describedby="modal-modal-description" | ||
> | ||
<Box className="modal-container"> | ||
<Typography variant="h6" className="modal-title"> | ||
Edit Checkin Question | ||
</Typography> | ||
<TextField | ||
className="modal-textfield" | ||
id="outlined-multiline-static" | ||
label="Write your question here..." | ||
multiline | ||
rows={4} | ||
value={questionText} | ||
onChange={(e) => setQuestionText(e.target.value)} | ||
fullWidth | ||
variant="outlined" | ||
/> | ||
<Box className="button-container-edit-question"> | ||
<Button | ||
variant="contained" | ||
onClick={() => handleSaveEdit(questionId)} | ||
> | ||
Save | ||
</Button> | ||
<Button variant="outlined" onClick={handleClose}> | ||
Cancel | ||
</Button> | ||
</Box> | ||
</Box> | ||
</Modal> | ||
); | ||
}; | ||
|
||
EditCheckinQuestionModal.propTypes = { | ||
showEditModal: PropTypes.bool.isRequired, | ||
questionId: PropTypes.number.isRequired, | ||
questionText: PropTypes.string.isRequired, | ||
setQuestionText: PropTypes.func.isRequired, | ||
handleSaveEdit: PropTypes.func.isRequired, | ||
handleClose: PropTypes.func.isRequired, | ||
}; | ||
|
||
export { EditCheckinQuestionModal }; |
53 changes: 53 additions & 0 deletions
53
packages/client/src/components/CheckinQuestionsPage/QuestionList.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { Typography, IconButton } from '@mui/material'; | ||
import EditIcon from '@mui/icons-material/Edit'; | ||
import DeleteIcon from '@mui/icons-material/Delete'; | ||
import '../../containers/QuestionPage/CheckinQuestions.css'; | ||
|
||
const QuestionList = ({ | ||
checkinQuestions, | ||
editQuestionId, | ||
handleEditQuestion, | ||
handleDeleteQuestion, | ||
}) => { | ||
return ( | ||
<ul className="question-list"> | ||
{checkinQuestions.map((question) => ( | ||
<li key={question.question_id} className="question-item"> | ||
<div className="question-content"> | ||
<Typography>{question.question_text}</Typography> | ||
{editQuestionId !== question.question_id && ( | ||
<div className="question-actions"> | ||
<IconButton | ||
onClick={() => | ||
handleEditQuestion( | ||
question.question_id, | ||
question.question_text, | ||
) | ||
} | ||
> | ||
<EditIcon /> | ||
</IconButton> | ||
<IconButton | ||
onClick={() => handleDeleteQuestion(question.question_id)} | ||
> | ||
<DeleteIcon /> | ||
</IconButton> | ||
</div> | ||
)} | ||
</div> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
}; | ||
|
||
QuestionList.propTypes = { | ||
checkinQuestions: PropTypes.arrayOf(PropTypes.object).isRequired, | ||
editQuestionId: PropTypes.number, | ||
handleEditQuestion: PropTypes.func.isRequired, | ||
handleDeleteQuestion: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default QuestionList; |
68 changes: 68 additions & 0 deletions
68
packages/client/src/components/Dashboard/EditingMember.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from 'react'; | ||
import { Typography, Button, TextField } from '@mui/material'; | ||
import PropTypes from 'prop-types'; | ||
|
||
const EditingMember = ({ | ||
editMemberId, | ||
editMemberFirstName, | ||
editMemberLastName, | ||
setEditMemberFirstName, | ||
setEditMemberLastName, | ||
handleEditSave, | ||
setEditMemberId, | ||
}) => { | ||
return ( | ||
<div className="edit-member-container"> | ||
<Typography variant="body1" className="edit-member-heading"> | ||
Edit Member | ||
</Typography> | ||
<div className="edit-member-details"> | ||
<div className="input-container"> | ||
<TextField | ||
className="edit-member-input" | ||
size="small" | ||
id="outlined-basic" | ||
label="First Name" | ||
variant="outlined" | ||
type="text" | ||
value={editMemberFirstName} | ||
onChange={(e) => setEditMemberFirstName(e.target.value)} | ||
placeholder="First Name" | ||
/> | ||
<TextField | ||
className="edit-member-input" | ||
size="small" | ||
id="outlined-basic" | ||
label="Last Name" | ||
variant="outlined" | ||
type="text" | ||
value={editMemberLastName} | ||
onChange={(e) => setEditMemberLastName(e.target.value)} | ||
placeholder="Last Name" | ||
/> | ||
</div> | ||
<div className="button-container"> | ||
<Button variant="contained" onClick={handleEditSave}> | ||
Save | ||
</Button> | ||
<Button variant="outlined" onClick={() => setEditMemberId(null)}> | ||
Cancel | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
// Define prop types for the EditingMember component | ||
EditingMember.propTypes = { | ||
editMemberId: PropTypes.number.isRequired, | ||
editMemberFirstName: PropTypes.string.isRequired, | ||
editMemberLastName: PropTypes.string.isRequired, | ||
setEditMemberFirstName: PropTypes.func.isRequired, | ||
setEditMemberLastName: PropTypes.func.isRequired, | ||
handleEditSave: PropTypes.func.isRequired, | ||
setEditMemberId: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default EditingMember; |
48 changes: 48 additions & 0 deletions
48
packages/client/src/components/Dashboard/NavigationBar.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.menu-icon { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 18.204px; | ||
flex: 1 0 0; | ||
color: var(--fade-color); | ||
} | ||
|
||
.left-nav-bar-container { | ||
display: flex; | ||
padding: 40px 0px; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 80px; | ||
flex-shrink: 0; | ||
border-radius: 0px 40px 40px 0px; | ||
background: var(--primary-color); | ||
} | ||
|
||
.logo { | ||
height: 4rem; | ||
background: none; | ||
} | ||
|
||
.left-nav-bar { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: flex-start; | ||
flex-shrink: 0; | ||
flex-grow: 1; | ||
} | ||
|
||
.left-nav-bar-top { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
} | ||
|
||
.left-nav-bar-top .menu-icon:nth-child(1) { | ||
color: white; | ||
} | ||
|
||
.left-nav-bar-bottom { | ||
display: flex; | ||
align-items: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/client/src/components/Dashboard/TeamMemberListItem.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { IconButton } from '@mui/material'; | ||
import EditIcon from '@mui/icons-material/Edit'; | ||
import DeleteIcon from '@mui/icons-material/Delete'; | ||
import Dashboard from '../../containers/Dashboard/Dashboard'; | ||
|
||
const TeamMemberListItem = ({ | ||
member, | ||
handleEditMember, | ||
handleDeleteMember, | ||
}) => { | ||
return ( | ||
<li key={member.member_id}> | ||
<div className="member-info-container"> | ||
<div className="member-info"> | ||
{member.first_name} {member.last_name} | ||
</div> | ||
<div> | ||
<IconButton onClick={() => handleEditMember(member.member_id)}> | ||
<EditIcon /> | ||
</IconButton> | ||
<IconButton onClick={() => handleDeleteMember(member.member_id)}> | ||
<DeleteIcon /> | ||
</IconButton> | ||
</div> | ||
</div> | ||
</li> | ||
); | ||
}; | ||
|
||
TeamMemberListItem.propTypes = { | ||
member: PropTypes.shape({ | ||
member_id: PropTypes.number.isRequired, | ||
first_name: PropTypes.string.isRequired, | ||
last_name: PropTypes.string.isRequired, | ||
}).isRequired, | ||
handleEditMember: PropTypes.func.isRequired, | ||
handleDeleteMember: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default TeamMemberListItem; |
Oops, something went wrong.