diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..598e167 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,42 @@ +# Change Log + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +## [Unreleased] + +### Added + +- `SPA` env variable to have static page with loading spinner before redirect + +### Changed + +- `export` uses now spa mode for initial loading screen + +### Fixed + +- [OMF#93](https://github.com/ohmyform/ohmyform/issues/93) dropdown options are not saved + +## [0.9.2] - 2020-06-04 + +### Fixed + +- type error + +## [0.9.1] - 2020-06-02 + +### Added +- radio fields +- dropdown fields +- min and max for date fields +- logout on home screen +- translation system + +### Fixed + +- initial Page is now correct also in SPA mode +- initial value for form adding +- anonymous submission of forms + diff --git a/next.config.js b/next.config.js index 8f08565..f592096 100644 --- a/next.config.js +++ b/next.config.js @@ -7,6 +7,7 @@ module.exports = withImages({ poweredByHeader: false, publicRuntimeConfig: { endpoint: process.env.API_HOST || '/graphql', + spa: !!process.env.SPA || false, }, env: { version, diff --git a/package.json b/package.json index 4c92a0c..100e596 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "start:dev": "next dev -p 4000", "build": "next build", - "export": "next build && next export", + "export": "cross-env SPA=1 next build && next export", "start": "next start -p $PORT", "server": "node server.js" }, @@ -17,6 +17,7 @@ "antd": "^4.2.2", "apollo-boost": "^0.4.9", "axios": "^0.19.2", + "cross-env": "^7.0.2", "dayjs": "^1.8.27", "graphql": "^15.0.0", "i18next": "^19.4.5", diff --git a/pages/index.tsx b/pages/index.tsx index 95905b3..5fc703b 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,10 +1,13 @@ import {Layout} from 'antd' import {AuthFooter} from 'components/auth/footer' import {NextPage} from 'next' +import getConfig from 'next/config' import {useRouter} from 'next/router' import React, {useEffect} from 'react' import {LoadingPage} from '../components/loading.page' +const { publicRuntimeConfig } = getConfig() + const Index: NextPage = () => { const router = useRouter() @@ -27,9 +30,9 @@ const Index: NextPage = () => { } }) - if (process.browser && router.pathname !== window.location.pathname) { + if (publicRuntimeConfig.spa || (process.browser && router.pathname !== window.location.pathname)) { return ( - + ) } diff --git a/yarn.lock b/yarn.lock index 289379e..7817595 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2406,6 +2406,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +cross-env@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9" + integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw== + dependencies: + cross-spawn "^7.0.1" + cross-fetch@3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.4.tgz#7bef7020207e684a7638ef5f2f698e24d9eb283c" @@ -2414,6 +2421,15 @@ cross-fetch@3.0.4: node-fetch "2.6.0" whatwg-fetch "3.0.0" +cross-spawn@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -3699,6 +3715,11 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" @@ -4562,6 +4583,11 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -5884,6 +5910,18 @@ shallowequal@^1.0.2, shallowequal@^1.1.0: resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + shell-quote@1.7.2: version "1.7.2" resolved "https://registry.yarnpkg.com/shell-quote/-/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2" @@ -6683,6 +6721,13 @@ whatwg-url@^7.0.0: tr46 "^1.0.1" webidl-conversions "^4.0.2" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + worker-farm@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8"