-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
finish-monitor-log-submissions #129
base: dev
Are you sure you want to change the base?
Changes from 2 commits
d3a7d55
f6a4b62
82a66d4
ae495ae
21973f0
226a69f
2cba26a
39a4350
9a95f58
c180dcc
48eb991
cee24a3
fcab42c
e2d7560
52b7970
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { | ||
Modal, | ||
ModalOverlay, | ||
ModalContent, | ||
ModalHeader, | ||
ModalBody, | ||
ModalFooter, | ||
useDisclosure, | ||
Button, | ||
} from '@chakra-ui/react'; | ||
import PropTypes from 'prop-types'; | ||
import { FiCheck } from 'react-icons/fi'; | ||
import { React, useState, useEffect } from 'react'; | ||
|
||
const SubmitSurvey = ({ setModalStep, onClose, submit }) => { | ||
console.log('entered'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return ( | ||
<> | ||
<ModalHeader>Are you sure you want to submit your survey log?</ModalHeader> | ||
<ModalFooter> | ||
<Button onClick={() => onClose()}>No</Button> | ||
<Button | ||
onClick={() => { | ||
submit(); | ||
setModalStep('submitted'); | ||
}} | ||
> | ||
Yes, Submit My Log | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
); | ||
}; | ||
|
||
const Submitted = ({ onClose }) => { | ||
return ( | ||
<> | ||
<ModalBody>Congratulations! You’ve submitted your monitor log for review.</ModalBody> | ||
<ModalFooter> | ||
<Button onClick={onClose}>Close</Button> | ||
</ModalFooter> | ||
</> | ||
); | ||
}; | ||
|
||
function ReturnPopup({ submitForm }) { | ||
const [modalStep, setModalStep] = useState('submitSurvey'); | ||
const { isOpen, onOpen, onClose } = useDisclosure(); | ||
|
||
useEffect(() => { | ||
setModalStep('reminderSelect'); | ||
}); | ||
|
||
const modalContent = { | ||
submitSurvey: ( | ||
<SubmitSurvey setModalStep={setModalStep} onClose={onClose} submit={submitForm} /> | ||
), | ||
submitted: <Submitted onSubmit={submitForm} onClose={onClose} />, | ||
}; | ||
|
||
console.log('Entered Popup'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return ( | ||
<> | ||
<Button colorScheme="green" type="submit" onClick={onOpen}> | ||
{/* {prefilledData !== undefined ? 'Save' : 'Add'} to Tracker */} | ||
Submit Log <FiCheck style={{ marginLeft: '4px' }} /> | ||
</Button> | ||
|
||
<Modal isOpen={isOpen} onClose={onClose} isCentered> | ||
<ModalOverlay /> | ||
<ModalContent>{modalContent[modalStep]}</ModalContent> | ||
</Modal> | ||
</> | ||
); | ||
} | ||
|
||
SubmitSurvey.propTypes = { | ||
setModalStep: PropTypes.func.isRequired, | ||
onClose: PropTypes.func.isRequired, | ||
submit: PropTypes.func.isRequired, | ||
}; | ||
|
||
Submitted.propTypes = { | ||
onClose: PropTypes.func.isRequired, | ||
}; | ||
|
||
ReturnPopup.propTypes = { | ||
submitForm: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default ReturnPopup; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,7 @@ | |
convert-source-map "^1.7.0" | ||
debug "^4.1.0" | ||
gensync "^1.0.0-beta.2" | ||
json5 "^2.1.2" | ||
json5 "^2.2.1" | ||
semver "^6.3.0" | ||
|
||
"@babel/generator@^7.12.1", "@babel/generator@^7.12.11", "@babel/generator@^7.12.5", "@babel/generator@^7.17.12": | ||
|
@@ -131,15 +131,6 @@ | |
"@jridgewell/gen-mapping" "^0.3.0" | ||
jsesc "^2.5.1" | ||
|
||
"@babel/generator@^7.17.3": | ||
version "7.17.10" | ||
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.10.tgz#c281fa35b0c349bbe9d02916f4ae08fc85ed7189" | ||
integrity sha512-46MJZZo9y3o4kmhBVc7zW7i8dtR1oIK/sdO5NcfcZRhTGYi+KKJRtHNgsU6c4VUcJmUNV/LQdebD/9Dlv4K+Tg== | ||
dependencies: | ||
"@babel/types" "^7.17.10" | ||
"@jridgewell/gen-mapping" "^0.1.0" | ||
jsesc "^2.5.1" | ||
|
||
"@babel/helper-annotate-as-pure@^7.16.7": | ||
version "7.16.7" | ||
resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" | ||
|
@@ -172,8 +163,8 @@ | |
dependencies: | ||
"@babel/helper-annotate-as-pure" "^7.16.7" | ||
"@babel/helper-environment-visitor" "^7.16.7" | ||
"@babel/helper-function-name" "^7.16.7" | ||
"@babel/helper-member-expression-to-functions" "^7.16.7" | ||
"@babel/helper-function-name" "^7.17.9" | ||
"@babel/helper-member-expression-to-functions" "^7.17.7" | ||
"@babel/helper-optimise-call-expression" "^7.16.7" | ||
"@babel/helper-replace-supers" "^7.16.7" | ||
"@babel/helper-split-export-declaration" "^7.16.7" | ||
|
@@ -228,7 +219,7 @@ | |
dependencies: | ||
"@babel/types" "^7.16.7" | ||
|
||
"@babel/helper-function-name@^7.16.7": | ||
"@babel/helper-function-name@^7.16.7", "@babel/helper-function-name@^7.17.9": | ||
version "7.17.9" | ||
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz#136fcd54bc1da82fcb47565cf16fd8e444b1ff12" | ||
integrity sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg== | ||
|
@@ -243,7 +234,7 @@ | |
dependencies: | ||
"@babel/types" "^7.16.7" | ||
|
||
"@babel/helper-member-expression-to-functions@^7.16.7", "@babel/helper-member-expression-to-functions@^7.17.7": | ||
"@babel/helper-member-expression-to-functions@^7.16.7": | ||
version "7.17.7" | ||
resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.17.7.tgz#a34013b57d8542a8c4ff8ba3f747c02452a4d8c4" | ||
integrity sha512-thxXgnQ8qQ11W2wVUObIqDL4p148VMxkt5T/qpN5k2fboRyzFGFmKsTGViquyM5QHKUy48OZoca8kw4ajaDPyw== | ||
|
@@ -1183,7 +1174,7 @@ | |
"@babel/code-frame" "^7.16.7" | ||
"@babel/generator" "^7.17.12" | ||
"@babel/helper-environment-visitor" "^7.16.7" | ||
"@babel/helper-function-name" "^7.16.7" | ||
"@babel/helper-function-name" "^7.17.9" | ||
"@babel/helper-hoist-variables" "^7.16.7" | ||
"@babel/helper-split-export-declaration" "^7.16.7" | ||
"@babel/parser" "^7.17.12" | ||
|
@@ -1199,14 +1190,6 @@ | |
"@babel/helper-validator-identifier" "^7.16.7" | ||
to-fast-properties "^2.0.0" | ||
|
||
"@babel/types@^7.17.10": | ||
version "7.17.10" | ||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.17.10.tgz#d35d7b4467e439fcf06d195f8100e0fea7fc82c4" | ||
integrity sha512-9O26jG0mBYfGkUYCYZRnBwbVLd1UZOICEr2Em6InB6jVfsAv1GKgwXHmrSg+WFWDmeKTA6vyTZiN8tCSM5Oo3A== | ||
dependencies: | ||
"@babel/helper-validator-identifier" "^7.16.7" | ||
to-fast-properties "^2.0.0" | ||
|
||
"@base2/[email protected]": | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/@base2/pretty-print-object/-/pretty-print-object-1.0.1.tgz#371ba8be66d556812dc7fb169ebc3c08378f69d4" | ||
|
@@ -1976,7 +1959,7 @@ | |
"@emotion/utils" "0.11.3" | ||
csstype "^2.5.7" | ||
|
||
"@emotion/serialize@^1.0.2": | ||
"@emotion/serialize@^1.0.2", "@emotion/serialize@^1.0.3": | ||
version "1.0.3" | ||
resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-1.0.3.tgz#99e2060c26c6292469fb30db41f4690e1c8fea63" | ||
integrity sha512-2mSSvgLfyV3q+iVh3YWgNlUc2a9ZlDU7DjuP5MjK3AXRR0dYigCrP99aeFtaB2L/hjfEZdSThn5dsZ0ufqbvsA== | ||
|
@@ -2722,11 +2705,6 @@ | |
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea" | ||
integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ== | ||
|
||
"@jridgewell/set-array@^1.0.0": | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.1.tgz#36a6acc93987adcf0ba50c66908bd0b70de8afea" | ||
integrity sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ== | ||
|
||
"@jridgewell/sourcemap-codec@^1.4.10": | ||
version "1.4.13" | ||
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz#b6461fb0c2964356c469e115f504c95ad97ab88c" | ||
|
@@ -10959,7 +10937,7 @@ json5@^1.0.1: | |
dependencies: | ||
minimist "^1.2.0" | ||
|
||
json5@^2.1.2, json5@^2.1.3, json5@^2.2.1: | ||
json5@^2.1.2, json5@^2.1.3: | ||
version "2.2.1" | ||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" | ||
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== | ||
|
@@ -16204,11 +16182,6 @@ tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4 | |
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" | ||
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== | ||
|
||
tslib@^2.4.0: | ||
version "2.4.0" | ||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" | ||
integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== | ||
|
||
tsutils@^3.17.1, tsutils@^3.21.0: | ||
version "3.21.0" | ||
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" | ||
|
@@ -16563,14 +16536,6 @@ [email protected]: | |
"@use-it/event-listener" "^0.1.2" | ||
use-persisted-state "^0.3.0" | ||
|
||
[email protected]: | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/use-dark-mode/-/use-dark-mode-2.3.1.tgz#d506349c7b7e09e9977cb8a6ab4470896aa3779a" | ||
integrity sha512-hmcdJR96tTustRQdaQwe6jMrZHnmPqXBxgy4jaQ4gsfhwajsCpjECuq9prgDe9XxMx/f9r96o2/md6O4Lwhwjg== | ||
dependencies: | ||
"@use-it/event-listener" "^0.1.2" | ||
use-persisted-state "^0.3.0" | ||
|
||
use-force-update@^1.0.7: | ||
version "1.0.8" | ||
resolved "https://registry.yarnpkg.com/use-force-update/-/use-force-update-1.0.8.tgz#14483faa4571673f070080f8233057b43b266ace" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'useEffect' is defined but never used.