feat: route-react -> curi.

This commit is contained in:
Ivan 2021-04-28 13:41:09 +08:00
parent 2e70c31849
commit 0b5fa5b643
7 changed files with 331 additions and 203 deletions

14
.vscode/launch.json vendored
View File

@ -4,6 +4,13 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against blog.localhost",
"url": "http://localhost:8090/",
"webRoot": "${workspaceFolder}"
},
{
"name": "Launch blog.localhost",
"type": "firefox",
@ -11,13 +18,6 @@
"reAttach": true,
"url": "http://blog.localhost/",
"webRoot": "${workspaceFolder}"
},
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against blog.localhost",
"url": "http://blog.localhost/",
"webRoot": "${workspaceFolder}"
}
]
}

396
package-lock.json generated
View File

@ -8,7 +8,10 @@
"version": "0.1.0",
"dependencies": {
"@apollo/client": "^3.3.15",
"@curi/react-dom": "^2.0.4",
"@curi/router": "^2.1.2",
"@date-io/date-fns": "^1.3.13",
"@hickory/browser": "^2.1.0",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/pickers": "^3.3.10",
@ -27,7 +30,6 @@
"graphql": "^15.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"typescript": "^4.2.4",
"vditor": "^3.8.4",
@ -1270,6 +1272,92 @@
"resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz",
"integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg=="
},
"node_modules/@curi/interactions": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@curi/interactions/-/interactions-2.0.3.tgz",
"integrity": "sha512-/d58jYFnWhqO4cMoFehxS/RWx3I22yCPnm6uAAE/1KEQG29k4uSkDKtxdIOMGcy6DnqFsOXXEFrh+ZLPIDQMBw==",
"dependencies": {
"@curi/types": "^2.0.2",
"@hickory/root": "^2.1.0"
}
},
"node_modules/@curi/react-dom": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@curi/react-dom/-/react-dom-2.0.4.tgz",
"integrity": "sha512-awgkkj/aQln0x4H7fB/2bZEAGRB6OjgQ4w1pQH2yz+zVK1xde2M+syL34rUCHxbAxh3dWHmsBxKnpHs0goRxwQ==",
"dependencies": {
"@curi/react-universal": "^2.0.3",
"@curi/types": "^2.0.2",
"@types/react": "^16.7.18"
},
"peerDependencies": {
"react": ">=16.8.0"
}
},
"node_modules/@curi/react-dom/node_modules/@types/react": {
"version": "16.14.5",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.5.tgz",
"integrity": "sha512-YRRv9DNZhaVTVRh9Wmmit7Y0UFhEVqXqCSw3uazRWMxa2x85hWQZ5BN24i7GXZbaclaLXEcodEeIHsjBA8eAMw==",
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
},
"node_modules/@curi/react-universal": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@curi/react-universal/-/react-universal-2.0.3.tgz",
"integrity": "sha512-uBSq5iKUCaQg9BOKgkc6jQOR+uToxn4pHHVpVVPjJUstqlu9u1Sg2BrWvCdKLTYgMlH+XwgYmcVDh8+LdBdRXQ==",
"dependencies": {
"@curi/interactions": "^2.0.3",
"@curi/types": "^2.0.2",
"@hickory/root": "^2.1.0",
"@types/react": "^16.7.18"
},
"peerDependencies": {
"react": ">=16.8.0"
}
},
"node_modules/@curi/react-universal/node_modules/@types/react": {
"version": "16.14.5",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.5.tgz",
"integrity": "sha512-YRRv9DNZhaVTVRh9Wmmit7Y0UFhEVqXqCSw3uazRWMxa2x85hWQZ5BN24i7GXZbaclaLXEcodEeIHsjBA8eAMw==",
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
},
"node_modules/@curi/router": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@curi/router/-/router-2.1.2.tgz",
"integrity": "sha512-XqESNXnlxlpiYl8VRyAsAkWjs3O4RFjH/crIodPE8gU314t/QRoD/G72GDq6xPRd90I4XekNA2y2uvMS1RAhKA==",
"dependencies": {
"@curi/interactions": "^2.0.3",
"@curi/types": "^2.0.2",
"@hickory/root": "^2.1.0",
"path-to-regexp": "^2.1.0"
}
},
"node_modules/@curi/router/node_modules/path-to-regexp": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.4.0.tgz",
"integrity": "sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w=="
},
"node_modules/@curi/types": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@curi/types/-/types-2.0.2.tgz",
"integrity": "sha512-e8VCWOCrmGvfakQTAapldCodAX2aMT9cgj41gboH064O5XJ69wQsZspqHNYxb/iKfdNhe0Wg83T5SW/3TTNcVg==",
"dependencies": {
"@hickory/root": "^2.1.0",
"path-to-regexp": "^2.1.0"
}
},
"node_modules/@curi/types/node_modules/path-to-regexp": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.4.0.tgz",
"integrity": "sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w=="
},
"node_modules/@date-io/core": {
"version": "1.3.13",
"resolved": "https://registry.npmjs.org/@date-io/core/-/core-1.3.13.tgz",
@ -2319,6 +2407,33 @@
"@hapi/hoek": "^8.3.0"
}
},
"node_modules/@hickory/browser": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@hickory/browser/-/browser-2.1.0.tgz",
"integrity": "sha512-bFTL4L/NKDBKA8PG1w3RBfsHdCZUieaFEYX42+YP+RFccEkUdCSz1EeIpL4lQuPOH4iW74p/4aijmhUGrDVjbw==",
"dependencies": {
"@hickory/dom-utils": "^2.1.0",
"@hickory/root": "^2.1.0"
}
},
"node_modules/@hickory/dom-utils": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@hickory/dom-utils/-/dom-utils-2.1.0.tgz",
"integrity": "sha512-fBzR0yWLFDLHcl6at+PaaXfC0c114DCYw+dwLzbvLLsGbEwWzQJaE4PGn1osR8teyWoqH6P2RYWVd95ua7lUuQ=="
},
"node_modules/@hickory/location-utils": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@hickory/location-utils/-/location-utils-2.1.0.tgz",
"integrity": "sha512-+PKHZ9fEbNAnnUzwk6RynvoQcW3/v8aw6jz1MHnSrdGM0lngiWrDQf1G78YFCIvcEm/FqAphmg7Nl8Cz7vaV6w=="
},
"node_modules/@hickory/root": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@hickory/root/-/root-2.1.0.tgz",
"integrity": "sha512-vRy4yadZp7mP47K8hpFpNKg3Ocxsmv+ezO9l4F7+GcscpD1JJiNLCnUNVuw+XIqUjuNvcyBoH8ToiEJCxWvvdA==",
"dependencies": {
"@hickory/location-utils": "^2.1.0"
}
},
"node_modules/@iarna/toml": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz",
@ -10559,19 +10674,6 @@
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ=="
},
"node_modules/history": {
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz",
"integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==",
"dependencies": {
"@babel/runtime": "^7.1.2",
"loose-envify": "^1.2.0",
"resolve-pathname": "^3.0.0",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0",
"value-equal": "^1.0.1"
}
},
"node_modules/hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
@ -15174,15 +15276,6 @@
"node": ">=4"
}
},
"node_modules/mini-create-react-context": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz",
"integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==",
"dependencies": {
"@babel/runtime": "^7.12.1",
"tiny-warning": "^1.0.3"
}
},
"node_modules/mini-css-extract-plugin": {
"version": "0.11.3",
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz",
@ -18324,50 +18417,6 @@
"node": ">=0.10.0"
}
},
"node_modules/react-router": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz",
"integrity": "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==",
"dependencies": {
"@babel/runtime": "^7.1.2",
"history": "^4.9.0",
"hoist-non-react-statics": "^3.1.0",
"loose-envify": "^1.3.1",
"mini-create-react-context": "^0.4.0",
"path-to-regexp": "^1.7.0",
"prop-types": "^15.6.2",
"react-is": "^16.6.0",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0"
}
},
"node_modules/react-router-dom": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz",
"integrity": "sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==",
"dependencies": {
"@babel/runtime": "^7.1.2",
"history": "^4.9.0",
"loose-envify": "^1.3.1",
"prop-types": "^15.6.2",
"react-router": "5.2.0",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0"
}
},
"node_modules/react-router/node_modules/isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"node_modules/react-router/node_modules/path-to-regexp": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"dependencies": {
"isarray": "0.0.1"
}
},
"node_modules/react-scripts": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz",
@ -19068,11 +19117,6 @@
"node": ">=4"
}
},
"node_modules/resolve-pathname": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz",
"integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
},
"node_modules/resolve-url": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
@ -21210,11 +21254,6 @@
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
},
"node_modules/tiny-invariant": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
"integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw=="
},
"node_modules/tiny-warning": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
@ -21987,11 +22026,6 @@
"spdx-expression-parse": "^3.0.0"
}
},
"node_modules/value-equal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz",
"integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
@ -25056,6 +25090,94 @@
"resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz",
"integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg=="
},
"@curi/interactions": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@curi/interactions/-/interactions-2.0.3.tgz",
"integrity": "sha512-/d58jYFnWhqO4cMoFehxS/RWx3I22yCPnm6uAAE/1KEQG29k4uSkDKtxdIOMGcy6DnqFsOXXEFrh+ZLPIDQMBw==",
"requires": {
"@curi/types": "^2.0.2",
"@hickory/root": "^2.1.0"
}
},
"@curi/react-dom": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@curi/react-dom/-/react-dom-2.0.4.tgz",
"integrity": "sha512-awgkkj/aQln0x4H7fB/2bZEAGRB6OjgQ4w1pQH2yz+zVK1xde2M+syL34rUCHxbAxh3dWHmsBxKnpHs0goRxwQ==",
"requires": {
"@curi/react-universal": "^2.0.3",
"@curi/types": "^2.0.2",
"@types/react": "^16.7.18"
},
"dependencies": {
"@types/react": {
"version": "16.14.5",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.5.tgz",
"integrity": "sha512-YRRv9DNZhaVTVRh9Wmmit7Y0UFhEVqXqCSw3uazRWMxa2x85hWQZ5BN24i7GXZbaclaLXEcodEeIHsjBA8eAMw==",
"requires": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
}
}
},
"@curi/react-universal": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/@curi/react-universal/-/react-universal-2.0.3.tgz",
"integrity": "sha512-uBSq5iKUCaQg9BOKgkc6jQOR+uToxn4pHHVpVVPjJUstqlu9u1Sg2BrWvCdKLTYgMlH+XwgYmcVDh8+LdBdRXQ==",
"requires": {
"@curi/interactions": "^2.0.3",
"@curi/types": "^2.0.2",
"@hickory/root": "^2.1.0",
"@types/react": "^16.7.18"
},
"dependencies": {
"@types/react": {
"version": "16.14.5",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.5.tgz",
"integrity": "sha512-YRRv9DNZhaVTVRh9Wmmit7Y0UFhEVqXqCSw3uazRWMxa2x85hWQZ5BN24i7GXZbaclaLXEcodEeIHsjBA8eAMw==",
"requires": {
"@types/prop-types": "*",
"@types/scheduler": "*",
"csstype": "^3.0.2"
}
}
}
},
"@curi/router": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@curi/router/-/router-2.1.2.tgz",
"integrity": "sha512-XqESNXnlxlpiYl8VRyAsAkWjs3O4RFjH/crIodPE8gU314t/QRoD/G72GDq6xPRd90I4XekNA2y2uvMS1RAhKA==",
"requires": {
"@curi/interactions": "^2.0.3",
"@curi/types": "^2.0.2",
"@hickory/root": "^2.1.0",
"path-to-regexp": "^2.1.0"
},
"dependencies": {
"path-to-regexp": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.4.0.tgz",
"integrity": "sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w=="
}
}
},
"@curi/types": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@curi/types/-/types-2.0.2.tgz",
"integrity": "sha512-e8VCWOCrmGvfakQTAapldCodAX2aMT9cgj41gboH064O5XJ69wQsZspqHNYxb/iKfdNhe0Wg83T5SW/3TTNcVg==",
"requires": {
"@hickory/root": "^2.1.0",
"path-to-regexp": "^2.1.0"
},
"dependencies": {
"path-to-regexp": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.4.0.tgz",
"integrity": "sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w=="
}
}
},
"@date-io/core": {
"version": "1.3.13",
"resolved": "https://registry.npmjs.org/@date-io/core/-/core-1.3.13.tgz",
@ -26067,6 +26189,33 @@
"@hapi/hoek": "^8.3.0"
}
},
"@hickory/browser": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@hickory/browser/-/browser-2.1.0.tgz",
"integrity": "sha512-bFTL4L/NKDBKA8PG1w3RBfsHdCZUieaFEYX42+YP+RFccEkUdCSz1EeIpL4lQuPOH4iW74p/4aijmhUGrDVjbw==",
"requires": {
"@hickory/dom-utils": "^2.1.0",
"@hickory/root": "^2.1.0"
}
},
"@hickory/dom-utils": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@hickory/dom-utils/-/dom-utils-2.1.0.tgz",
"integrity": "sha512-fBzR0yWLFDLHcl6at+PaaXfC0c114DCYw+dwLzbvLLsGbEwWzQJaE4PGn1osR8teyWoqH6P2RYWVd95ua7lUuQ=="
},
"@hickory/location-utils": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@hickory/location-utils/-/location-utils-2.1.0.tgz",
"integrity": "sha512-+PKHZ9fEbNAnnUzwk6RynvoQcW3/v8aw6jz1MHnSrdGM0lngiWrDQf1G78YFCIvcEm/FqAphmg7Nl8Cz7vaV6w=="
},
"@hickory/root": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@hickory/root/-/root-2.1.0.tgz",
"integrity": "sha512-vRy4yadZp7mP47K8hpFpNKg3Ocxsmv+ezO9l4F7+GcscpD1JJiNLCnUNVuw+XIqUjuNvcyBoH8ToiEJCxWvvdA==",
"requires": {
"@hickory/location-utils": "^2.1.0"
}
},
"@iarna/toml": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz",
@ -33039,19 +33188,6 @@
"resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz",
"integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ=="
},
"history": {
"version": "4.10.1",
"resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz",
"integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==",
"requires": {
"@babel/runtime": "^7.1.2",
"loose-envify": "^1.2.0",
"resolve-pathname": "^3.0.0",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0",
"value-equal": "^1.0.1"
}
},
"hmac-drbg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz",
@ -36774,15 +36910,6 @@
"resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
"integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg=="
},
"mini-create-react-context": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz",
"integrity": "sha512-YWCYEmd5CQeHGSAKrYvXgmzzkrvssZcuuQDDeqkT+PziKGMgE+0MCCtcKbROzocGBG1meBLl2FotlRwf4gAzbQ==",
"requires": {
"@babel/runtime": "^7.12.1",
"tiny-warning": "^1.0.3"
}
},
"mini-css-extract-plugin": {
"version": "0.11.3",
"resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.11.3.tgz",
@ -39387,52 +39514,6 @@
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.8.3.tgz",
"integrity": "sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg=="
},
"react-router": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-5.2.0.tgz",
"integrity": "sha512-smz1DUuFHRKdcJC0jobGo8cVbhO3x50tCL4icacOlcwDOEQPq4TMqwx3sY1TP+DvtTgz4nm3thuo7A+BK2U0Dw==",
"requires": {
"@babel/runtime": "^7.1.2",
"history": "^4.9.0",
"hoist-non-react-statics": "^3.1.0",
"loose-envify": "^1.3.1",
"mini-create-react-context": "^0.4.0",
"path-to-regexp": "^1.7.0",
"prop-types": "^15.6.2",
"react-is": "^16.6.0",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
},
"path-to-regexp": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"requires": {
"isarray": "0.0.1"
}
}
}
},
"react-router-dom": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.2.0.tgz",
"integrity": "sha512-gxAmfylo2QUjcwxI63RhQ5G85Qqt4voZpUXSEqCwykV0baaOTQDR1f0PmY8AELqIyVc0NEZUj0Gov5lNGcXgsA==",
"requires": {
"@babel/runtime": "^7.1.2",
"history": "^4.9.0",
"loose-envify": "^1.3.1",
"prop-types": "^15.6.2",
"react-router": "5.2.0",
"tiny-invariant": "^1.0.2",
"tiny-warning": "^1.0.0"
}
},
"react-scripts": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-scripts/-/react-scripts-4.0.3.tgz",
@ -40000,11 +40081,6 @@
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
"integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="
},
"resolve-pathname": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz",
"integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng=="
},
"resolve-url": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
@ -41843,11 +41919,6 @@
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
},
"tiny-invariant": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.1.0.tgz",
"integrity": "sha512-ytxQvrb1cPc9WBEI/HSeYYoGD0kWnGEOR8RY6KomWLBVhqz0RgTwVO9dLrGz7dC+nN9llyI7OKAgRq8Vq4ZBSw=="
},
"tiny-warning": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
@ -42492,11 +42563,6 @@
"spdx-expression-parse": "^3.0.0"
}
},
"value-equal": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz",
"integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw=="
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",

View File

@ -4,7 +4,10 @@
"private": true,
"dependencies": {
"@apollo/client": "^3.3.15",
"@curi/react-dom": "^2.0.4",
"@curi/router": "^2.1.2",
"@date-io/date-fns": "^1.3.13",
"@hickory/browser": "^2.1.0",
"@material-ui/core": "^4.11.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/pickers": "^3.3.10",
@ -23,7 +26,6 @@
"graphql": "^15.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"typescript": "^4.2.4",
"vditor": "^3.8.4",
@ -31,8 +33,7 @@
"yup": "^0.32.9"
},
"scripts": {
"prestart": "npm run graphql",
"start": "PORT=7133 react-scripts start",
"start": "PORT=7133 BROWSER=none react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",

View File

@ -1,9 +1,15 @@
import { useResponse } from '@curi/react-dom';
import './App.css';
import { DefaultLayout } from './layouts';
function App() {
const { response } = useResponse();
const { body: Body } = response;
return (
<DefaultLayout></DefaultLayout>
<DefaultLayout>
<Body response={response} />
</DefaultLayout>
);
}

View File

@ -9,17 +9,34 @@ import { ApolloProvider } from '@apollo/client';
import { MuiPickersUtilsProvider } from '@material-ui/pickers';
import DateFnsUtils from "@date-io/date-fns";
import zhLocale from "date-fns/locale/zh-CN";
import { createRouterComponent } from '@curi/react-dom';
import { createRouter, announce } from '@curi/router';
import { browser } from '@hickory/browser';
import routes from './routes';
const router = createRouter(browser, routes, {
sideEffects: [
announce(({ response }) => {
return `Navigated to ${response.location.pathname}`;
})
]
});
const Router = createRouterComponent(router);
router.once(() => {
ReactDOM.render(
<React.StrictMode>
<ApolloProvider client={client}>
<MuiPickersUtilsProvider utils={DateFnsUtils} locale={zhLocale}>
<Router>
<App />
</Router>
</MuiPickersUtilsProvider>
</ApolloProvider>
</React.StrictMode>,
document.getElementById("root")
);
})
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))

View File

@ -20,10 +20,8 @@ import ChevronRightIcon from "@material-ui/icons/ChevronRight";
import ListItem from "@material-ui/core/ListItem";
import ListItemIcon from "@material-ui/core/ListItemIcon";
import ListItemText from "@material-ui/core/ListItemText";
import { Link, Route, BrowserRouter, Switch } from 'react-router-dom';
import { AddCircle, Description, LocalOffer } from '@material-ui/icons';
import { ArticleIndex } from '../articles';
import { ArticleEditor } from '../articles/article-editor';
import { Link } from '@curi/react-dom';
const drawerWidth = 240;
const useStyles = makeStyles((theme: Theme) =>
@ -105,7 +103,6 @@ export const DefaultLayout: FC = ({children}) => {
return (
<div className={classes.root}>
<BrowserRouter>
<CssBaseline />
<AppBar
position="fixed"
@ -154,7 +151,7 @@ export const DefaultLayout: FC = ({children}) => {
</div>
<Divider />
<List>
<Link to="/articles/create">
<Link name="create-article">
<ListItem button>
<ListItemIcon>
<AddCircle />
@ -162,7 +159,7 @@ export const DefaultLayout: FC = ({children}) => {
<ListItemText primary="New Article" />
</ListItem>
</Link>
<Link to="/articles">
<Link name="articles">
<ListItem button>
<ListItemIcon>
<Description />
@ -170,7 +167,7 @@ export const DefaultLayout: FC = ({children}) => {
<ListItemText primary="Articles" />
</ListItem>
</Link>
<Link to="/tags">
<Link name="tags">
<ListItem button>
<ListItemIcon>
<LocalOffer />
@ -183,17 +180,8 @@ export const DefaultLayout: FC = ({children}) => {
</Drawer>
<main className={classes.content}>
<div className={classes.toolbar} />
<Switch>
<Route path="/articles/create">
<ArticleEditor />
</Route>
<Route path="/articles">
<ArticleIndex />
</Route>
<Route path="/tags">Tags</Route>
</Switch>
{ children }
</main>
</BrowserRouter>
</div>
);
}

50
src/routes.tsx Normal file
View File

@ -0,0 +1,50 @@
import { prepareRoutes } from '@curi/router'
export default prepareRoutes([
{
name: 'dashboard',
path: '',
respond() {
return { body: () => (<div>DashBoard</div>) }
}
},
{
name: 'create-article',
path: 'articles/create',
resolve() {
const body = import(/* webpackChunkName: "create-article" */ './articles/article-editor').then(m => m.ArticleEditor);
return body;
},
respond({ resolved }) {
return { body: resolved }
}
},
{
name: 'modify-article',
path: 'articles/:id',
resolve() {
return import(/* webpackChunkName: "modify-article" */ './articles/article-editor').then(m => m.ArticleEditor);
},
respond({ resolved }) {
const ModifyArticle = () => resolved();
return { body: <ModifyArticle /> }
}
},
{
name: 'articles',
path: 'articles',
resolve() {
return import(/* webpackChunkName: "articles" */ './articles/index').then(m => m.ArticleIndex);
},
respond({ resolved }) {
return { body: resolved }
}
},
{
name: 'tags',
path: 'tags',
respond() {
return { body: () => (<div>Tags</div>) }
}
},
])