From 757e925a023694f6072a06dd3b2ccb6d1b5f4f2c Mon Sep 17 00:00:00 2001 From: Raymans Peng Date: Fri, 20 Aug 2021 15:49:37 +0800 Subject: [PATCH] Downgrade local-storage avoiding known issue (https://github.com/rehooks/local-storage/issues/77), comment out x-user-key for templateInterviews, implements select template behavior and support copy interview by id, --- package-lock.json | 6 +- package.json | 2 +- src/components/GetStarted/CreateAssessment.js | 24 ++++++-- src/components/Interviews/InterviewForm.js | 59 +++++++++++-------- src/hooks/useGetStarted.js | 31 ++-------- src/intl/zh-tw.json | 4 +- src/utils/request.js | 11 ++-- 7 files changed, 73 insertions(+), 64 deletions(-) diff --git a/package-lock.json b/package-lock.json index a405fac..74b796f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2761,9 +2761,9 @@ } }, "@rehooks/local-storage": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@rehooks/local-storage/-/local-storage-2.4.1.tgz", - "integrity": "sha512-btOCPMDDG5PtNw+qNMTG9HGsgQTUYa3bvZ/ELDSeZ4YA9IGJA97oP6Tcb9EOrN7OqC8zpsiO7qxvpYP01PE+XQ==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@rehooks/local-storage/-/local-storage-2.4.0.tgz", + "integrity": "sha512-LoXDbEHsuIckVgBsFAv8SuU/M7memjyfWut9Zf36TQXqqCHBRFv8bweg9PymQCa1aWIMjNrZQflFdo55FDlXYg==" }, "@sideway/address": { "version": "4.1.2", diff --git a/package.json b/package.json index f7cc7c1..95a2213 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@fortawesome/react-fontawesome": "0.1.8", "@mdx-js/mdx": "^1.5.9", "@mdx-js/react": "^1.5.9", - "@rehooks/local-storage": "^2.4.0", + "@rehooks/local-storage": "2.4.0", "@svgr/webpack": "^5.1.0", "antd": "^4.16.6", "aos": "^3.0.0-beta.6", diff --git a/src/components/GetStarted/CreateAssessment.js b/src/components/GetStarted/CreateAssessment.js index bd14752..4112207 100644 --- a/src/components/GetStarted/CreateAssessment.js +++ b/src/components/GetStarted/CreateAssessment.js @@ -14,6 +14,8 @@ const CreateAssessment = ({ const intl = useIntl(); const { getInterviews } = useApi(); const [templateInterviews, setTemplateInterviews] = useState([]); + const [templateId, setTemplateId] = useState(''); + const [templateSelected, setTemplateSelected] = useState(false); const [loading, setLoading] = useState(true); const [okButtonDisabled, setOkButtonDisabled] = useState(true); const handlePublished = (interview) => { @@ -29,8 +31,13 @@ const CreateAssessment = ({ }); }, []); - const onTemplateSelect = (template) => { + const onTemplateSelect = (templateId) => { setOkButtonDisabled(false); + setTemplateId(templateId); + }; + + const handleSelectTemplate = () => { + setTemplateSelected(true); }; return ( <> @@ -49,11 +56,14 @@ const CreateAssessment = ({ maskClosable={false} cancelButtonHidden={true} okButtonDisabled={okButtonDisabled} + onOK={handleSelectTemplate} > + defaultMessage={'Please select a template to let us populate Assessment content quickly for you'} + values={{ br:
}} + />