diff --git a/package.json b/package.json index d71c4a45..c10303a9 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "axios": "^0.21.4", "crypto-js": "^4.1.1", "date-fns": "^2.30.0", + "history": "^5.3.0", "i18next": "^19.6.3", "idb": "^6.0.0", "immer": "^8.0.1", @@ -26,12 +27,13 @@ "react": "^17.0.2", "react-beautiful-dnd": "^13.1.1", "react-datepicker": "^3.5.0", + "react-dnd": "^14.0.5", "react-dnd-html5-backend": "^14.0.1", "react-dom": "^17.0.2", "react-i18next": "^11.7.0", "react-redux": "^7.1.0", "react-router-dom": "^5.2.0", - "react-scripts": "^4.0.3", + "react-scripts": "^5.0.1", "redux": "^4.2.1", "redux-thunk": "^2.4.2", "remove-markdown": "^0.5.0" @@ -82,7 +84,7 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "prettier": "^2.2.1", - "typescript": "^4.8.3", - "sass": "^1.66.1" + "sass": "^1.66.1", + "typescript": "^4.8.3" } } diff --git a/src/views/FrontPage.tsx b/src/views/FrontPage.tsx index 21ad0b45..5594ec3a 100644 --- a/src/views/FrontPage.tsx +++ b/src/views/FrontPage.tsx @@ -19,7 +19,16 @@ const FrontPage = (): JSX.Element => { const uploadRef = useRef(null); useEffect(() => { - getStoredQuestionnaire(); + if (window.location.hash) { + const questionnaireBase64 = window.location.hash.slice(1) + const parsed = JSON.parse(decodeURIComponent(atob(questionnaireBase64))) + const importedState = mapToTreeState(parsed); + dispatch(resetQuestionnaireAction(importedState)); + setIsLoading(false); + setIsFormBuilderShown(true); + } else { + getStoredQuestionnaire(); + } }, []); const getStoredQuestionnaire = async () => {