improve: upgrade node to 20, upgrade react-query to v4

This commit is contained in:
h z
2025-04-27 00:36:42 +01:00
parent 9ea44385ee
commit 1ce2eebbfa
22 changed files with 309 additions and 218 deletions

View File

@@ -1,4 +1,4 @@
FROM node:18-alpine AS build-stage FROM node:20-alpine AS build-stage
WORKDIR /app WORKDIR /app

272
package-lock.json generated
View File

@@ -9,19 +9,23 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@reduxjs/toolkit": "^2.7.0",
"@tanstack/react-query": "^4.36.1",
"assert": "^2.1.0", "assert": "^2.1.0",
"axios": "^1.7.9", "axios": "^1.7.9",
"bulma": "^1.0.2", "bulma": "^1.0.2",
"katex": "^0.16.11", "katex": "^0.16.11",
"oidc-client-ts": "^3.1.0", "oidc-client-ts": "^3.1.0",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"prismjs": "^1.30.0",
"process": "^0.11.10", "process": "^0.11.10",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-markdown": "^9.0.1", "react-markdown": "^9.0.1",
"react-query": "^3.39.3", "react-redux": "^9.2.0",
"react-router-dom": "^7.0.1", "react-router-dom": "^7.0.1",
"react-syntax-highlighter": "^15.6.1", "react-syntax-highlighter": "^15.6.1",
"redux": "^5.0.1",
"rehype-katex": "^7.0.1", "rehype-katex": "^7.0.1",
"rehype-raw": "^7.0.0", "rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.0", "remark-gfm": "^4.0.0",
@@ -2648,6 +2652,31 @@
"url": "https://opencollective.com/parcel" "url": "https://opencollective.com/parcel"
} }
}, },
"node_modules/@reduxjs/toolkit": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.7.0.tgz",
"integrity": "sha512-XVwolG6eTqwV0N8z/oDlN93ITCIGIop6leXlGJI/4EKy+0POYkR+ABHRSdGXY+0MQvJBP8yAzh+EYFxTuvmBiQ==",
"dependencies": {
"@standard-schema/spec": "^1.0.0",
"@standard-schema/utils": "^0.3.0",
"immer": "^10.0.3",
"redux": "^5.0.1",
"redux-thunk": "^3.1.0",
"reselect": "^5.1.0"
},
"peerDependencies": {
"react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
"react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
},
"peerDependenciesMeta": {
"react": {
"optional": true
},
"react-redux": {
"optional": true
}
}
},
"node_modules/@sinclair/typebox": { "node_modules/@sinclair/typebox": {
"version": "0.27.8", "version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
@@ -2672,6 +2701,51 @@
"@sinonjs/commons": "^3.0.0" "@sinonjs/commons": "^3.0.0"
} }
}, },
"node_modules/@standard-schema/spec": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz",
"integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA=="
},
"node_modules/@standard-schema/utils": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz",
"integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g=="
},
"node_modules/@tanstack/query-core": {
"version": "4.36.1",
"resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-4.36.1.tgz",
"integrity": "sha512-DJSilV5+ytBP1FbFcEJovv4rnnm/CokuVvrBEtW/Va9DvuJ3HksbXUJEpI0aV1KtuL4ZoO9AVE6PyNLzF7tLeA==",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
}
},
"node_modules/@tanstack/react-query": {
"version": "4.36.1",
"resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-4.36.1.tgz",
"integrity": "sha512-y7ySVHFyyQblPl3J3eQBWpXZkliroki3ARnBKsdJchlgt7yJLRDUcf4B8soufgiYt3pEQIkBWBx1N9/ZPIeUWw==",
"dependencies": {
"@tanstack/query-core": "4.36.1",
"use-sync-external-store": "^1.2.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-native": "*"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
},
"react-native": {
"optional": true
}
}
},
"node_modules/@testing-library/dom": { "node_modules/@testing-library/dom": {
"version": "10.4.0", "version": "10.4.0",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz",
@@ -2878,11 +2952,6 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"node_modules/@types/cookie": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
"integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA=="
},
"node_modules/@types/debug": { "node_modules/@types/debug": {
"version": "4.1.12", "version": "4.1.12",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
@@ -3171,6 +3240,11 @@
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz",
"integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==" "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="
}, },
"node_modules/@types/use-sync-external-store": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
"integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg=="
},
"node_modules/@types/ws": { "node_modules/@types/ws": {
"version": "8.5.13", "version": "8.5.13",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz",
@@ -3937,7 +4011,8 @@
"node_modules/balanced-match": { "node_modules/balanced-match": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
}, },
"node_modules/batch": { "node_modules/batch": {
"version": "0.6.1", "version": "0.6.1",
@@ -3945,14 +4020,6 @@
"integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==",
"dev": true "dev": true
}, },
"node_modules/big-integer": {
"version": "1.6.52",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz",
"integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/binary-extensions": { "node_modules/binary-extensions": {
"version": "2.3.0", "version": "2.3.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
@@ -4009,6 +4076,7 @@
"version": "1.1.11", "version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@@ -4026,21 +4094,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/broadcast-channel": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/broadcast-channel/-/broadcast-channel-3.7.0.tgz",
"integrity": "sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==",
"dependencies": {
"@babel/runtime": "^7.7.2",
"detect-node": "^2.1.0",
"js-sha3": "0.8.0",
"microseconds": "0.2.0",
"nano-time": "1.0.0",
"oblivious-set": "1.0.0",
"rimraf": "3.0.2",
"unload": "2.2.0"
}
},
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.24.2", "version": "4.24.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz",
@@ -4490,7 +4543,8 @@
"node_modules/concat-map": { "node_modules/concat-map": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
}, },
"node_modules/connect-history-api-fallback": { "node_modules/connect-history-api-fallback": {
"version": "2.0.0", "version": "2.0.0",
@@ -4924,7 +4978,8 @@
"node_modules/detect-node": { "node_modules/detect-node": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz",
"integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==" "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==",
"dev": true
}, },
"node_modules/devlop": { "node_modules/devlop": {
"version": "1.1.0", "version": "1.1.0",
@@ -5791,7 +5846,8 @@
"node_modules/fs.realpath": { "node_modules/fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true
}, },
"node_modules/fsevents": { "node_modules/fsevents": {
"version": "2.3.3", "version": "2.3.3",
@@ -5894,6 +5950,7 @@
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"deprecated": "Glob versions prior to v9 are no longer supported", "deprecated": "Glob versions prior to v9 are no longer supported",
"dev": true,
"dependencies": { "dependencies": {
"fs.realpath": "^1.0.0", "fs.realpath": "^1.0.0",
"inflight": "^1.0.4", "inflight": "^1.0.4",
@@ -6594,9 +6651,9 @@
"dev": true "dev": true
}, },
"node_modules/http-proxy-middleware": { "node_modules/http-proxy-middleware": {
"version": "2.0.7", "version": "2.0.9",
"resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz", "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz",
"integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==", "integrity": "sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@types/http-proxy": "^1.17.8", "@types/http-proxy": "^1.17.8",
@@ -6707,6 +6764,15 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/immer": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz",
"integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/immer"
}
},
"node_modules/immutable": { "node_modules/immutable": {
"version": "5.0.3", "version": "5.0.3",
"resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.3.tgz", "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.3.tgz",
@@ -6755,6 +6821,7 @@
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
"dev": true,
"dependencies": { "dependencies": {
"once": "^1.3.0", "once": "^1.3.0",
"wrappy": "1" "wrappy": "1"
@@ -8224,11 +8291,6 @@
"node": ">= 10.13.0" "node": ">= 10.13.0"
} }
}, },
"node_modules/js-sha3": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz",
"integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q=="
},
"node_modules/js-tokens": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -8541,15 +8603,6 @@
"url": "https://github.com/sponsors/wooorm" "url": "https://github.com/sponsors/wooorm"
} }
}, },
"node_modules/match-sorter": {
"version": "6.3.4",
"resolved": "https://registry.npmjs.org/match-sorter/-/match-sorter-6.3.4.tgz",
"integrity": "sha512-jfZW7cWS5y/1xswZo8VBOdudUiSd9nifYRWphc9M5D/ee4w4AoXLgBEdRbgVaxbMuagBPeUC5y2Hi8DO6o9aDg==",
"dependencies": {
"@babel/runtime": "^7.23.8",
"remove-accents": "0.5.0"
}
},
"node_modules/math-intrinsics": { "node_modules/math-intrinsics": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
@@ -9481,11 +9534,6 @@
"node": ">=8.6" "node": ">=8.6"
} }
}, },
"node_modules/microseconds": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/microseconds/-/microseconds-0.2.0.tgz",
"integrity": "sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA=="
},
"node_modules/mime": { "node_modules/mime": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
@@ -9545,6 +9593,7 @@
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": { "dependencies": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
}, },
@@ -9571,14 +9620,6 @@
"multicast-dns": "cli.js" "multicast-dns": "cli.js"
} }
}, },
"node_modules/nano-time": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/nano-time/-/nano-time-1.0.0.tgz",
"integrity": "sha512-flnngywOoQ0lLQOTRNexn2gGSNuM9bKj9RZAWSzhQ+UJYaAFG9bac4DW9VHjUAzrOaIcajHybCTHe/bkvozQqA==",
"dependencies": {
"big-integer": "^1.6.16"
}
},
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.8", "version": "3.3.8",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
@@ -9786,11 +9827,6 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/oblivious-set": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/oblivious-set/-/oblivious-set-1.0.0.tgz",
"integrity": "sha512-z+pI07qxo4c2CulUHCDf9lcqDlMSo72N/4rLUpRXf6fu+q8vjt8y0xS+Tlf8NTJDdTXHbdeO1n3MlbctwEoXZw=="
},
"node_modules/obuf": { "node_modules/obuf": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz",
@@ -9833,6 +9869,7 @@
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"dependencies": { "dependencies": {
"wrappy": "1" "wrappy": "1"
} }
@@ -10034,6 +10071,7 @@
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"dev": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }
@@ -10467,37 +10505,33 @@
"react": ">=18" "react": ">=18"
} }
}, },
"node_modules/react-query": { "node_modules/react-redux": {
"version": "3.39.3", "version": "9.2.0",
"resolved": "https://registry.npmjs.org/react-query/-/react-query-3.39.3.tgz", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
"integrity": "sha512-nLfLz7GiohKTJDuT4us4X3h/8unOh+00MLb2yJoGTPjxKs2bc1iDhkNx2bd5MKklXnOD3NrVZ+J2UXujA5In4g==", "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.5.5", "@types/use-sync-external-store": "^0.0.6",
"broadcast-channel": "^3.4.1", "use-sync-external-store": "^1.4.0"
"match-sorter": "^6.0.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/tannerlinsley"
}, },
"peerDependencies": { "peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" "@types/react": "^18.2.25 || ^19",
"react": "^18.0 || ^19",
"redux": "^5.0.0"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"react-dom": { "@types/react": {
"optional": true "optional": true
}, },
"react-native": { "redux": {
"optional": true "optional": true
} }
} }
}, },
"node_modules/react-router": { "node_modules/react-router": {
"version": "7.0.1", "version": "7.5.2",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.1.tgz", "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.5.2.tgz",
"integrity": "sha512-WVAhv9oWCNsja5AkK6KLpXJDSJCQizOIyOd4vvB/+eHGbYx5vkhcmcmwWjQ9yqkRClogi+xjEg9fNEOd5EX/tw==", "integrity": "sha512-9Rw8r199klMnlGZ8VAsV/I8WrIF6IyJ90JQUdboupx1cdkgYqwnrYjH+I/nY/7cA1X5zia4mDJqH36npP7sxGQ==",
"dependencies": { "dependencies": {
"@types/cookie": "^0.6.0",
"cookie": "^1.0.1", "cookie": "^1.0.1",
"set-cookie-parser": "^2.6.0", "set-cookie-parser": "^2.6.0",
"turbo-stream": "2.4.0" "turbo-stream": "2.4.0"
@@ -10516,11 +10550,11 @@
} }
}, },
"node_modules/react-router-dom": { "node_modules/react-router-dom": {
"version": "7.0.1", "version": "7.5.2",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.0.1.tgz", "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.5.2.tgz",
"integrity": "sha512-duBzwAAiIabhFPZfDjcYpJ+f08TMbPMETgq254GWne2NW1ZwRHhZLj7tpSp8KGb7JvZzlLcjGUnqLxpZQVEPng==", "integrity": "sha512-yk1XW8Fj7gK7flpYBXF3yzd2NbX6P7Kxjvs2b5nu1M04rb5pg/Zc4fGdBNTeT4eDYL2bvzWNyKaIMJX/RKHTTg==",
"dependencies": { "dependencies": {
"react-router": "7.0.1" "react-router": "7.5.2"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=20.0.0"
@@ -10597,6 +10631,19 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/redux": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="
},
"node_modules/redux-thunk": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
"integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
"peerDependencies": {
"redux": "^5.0.0"
}
},
"node_modules/refractor": { "node_modules/refractor": {
"version": "3.6.0", "version": "3.6.0",
"resolved": "https://registry.npmjs.org/refractor/-/refractor-3.6.0.tgz", "resolved": "https://registry.npmjs.org/refractor/-/refractor-3.6.0.tgz",
@@ -10888,11 +10935,6 @@
"url": "https://opencollective.com/unified" "url": "https://opencollective.com/unified"
} }
}, },
"node_modules/remove-accents": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.5.0.tgz",
"integrity": "sha512-8g3/Otx1eJaVD12e31UbJj1YzdtVvzH85HV7t+9MJYk/u3XmkOUJ5Ys9wQrf9PCPK8+xn4ymzqYCiZl6QWKn+A=="
},
"node_modules/renderkid": { "node_modules/renderkid": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/renderkid/-/renderkid-3.0.0.tgz", "resolved": "https://registry.npmjs.org/renderkid/-/renderkid-3.0.0.tgz",
@@ -10930,6 +10972,11 @@
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
"dev": true "dev": true
}, },
"node_modules/reselect": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
"integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w=="
},
"node_modules/resolve": { "node_modules/resolve": {
"version": "1.22.8", "version": "1.22.8",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
@@ -10986,21 +11033,6 @@
"node": ">= 4" "node": ">= 4"
} }
}, },
"node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"deprecated": "Rimraf versions prior to v4 are no longer supported",
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/run-applescript": { "node_modules/run-applescript": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz",
@@ -12140,15 +12172,6 @@
"node": ">= 4.0.0" "node": ">= 4.0.0"
} }
}, },
"node_modules/unload": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/unload/-/unload-2.2.0.tgz",
"integrity": "sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==",
"dependencies": {
"@babel/runtime": "^7.6.2",
"detect-node": "^2.0.4"
}
},
"node_modules/unpipe": { "node_modules/unpipe": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@@ -12207,6 +12230,14 @@
"requires-port": "^1.0.0" "requires-port": "^1.0.0"
} }
}, },
"node_modules/use-sync-external-store": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.5.0.tgz",
"integrity": "sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/util": { "node_modules/util": {
"version": "0.12.5", "version": "0.12.5",
"resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz",
@@ -12824,7 +12855,8 @@
"node_modules/wrappy": { "node_modules/wrappy": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true
}, },
"node_modules/write-file-atomic": { "node_modules/write-file-atomic": {
"version": "4.0.2", "version": "4.0.2",

View File

@@ -12,19 +12,23 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@reduxjs/toolkit": "^2.7.0",
"@tanstack/react-query": "^4.36.1",
"assert": "^2.1.0", "assert": "^2.1.0",
"axios": "^1.7.9", "axios": "^1.7.9",
"bulma": "^1.0.2", "bulma": "^1.0.2",
"katex": "^0.16.11", "katex": "^0.16.11",
"oidc-client-ts": "^3.1.0", "oidc-client-ts": "^3.1.0",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"prismjs": "^1.30.0",
"process": "^0.11.10", "process": "^0.11.10",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-markdown": "^9.0.1", "react-markdown": "^9.0.1",
"react-query": "^3.39.3", "react-redux": "^9.2.0",
"react-router-dom": "^7.0.1", "react-router-dom": "^7.0.1",
"react-syntax-highlighter": "^15.6.1", "react-syntax-highlighter": "^15.6.1",
"redux": "^5.0.1",
"rehype-katex": "^7.0.1", "rehype-katex": "^7.0.1",
"rehype-raw": "^7.0.0", "rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.0", "remark-gfm": "^4.0.0",

View File

@@ -1,5 +1,7 @@
import React from "react"; import React from "react";
import {BrowserRouter as Router, Navigate, Route, Routes} from "react-router-dom"; import {BrowserRouter as Router, Navigate, Route, Routes} from "react-router-dom";
import { Provider } from 'react-redux';
import { store } from './store';
import MainNavigation from "./components/Navigations/MainNavigation"; import MainNavigation from "./components/Navigations/MainNavigation";
import SideNavigation from "./components/Navigations/SideNavigation"; import SideNavigation from "./components/Navigations/SideNavigation";
import MarkdownContent from "./components/Markdowns/MarkdownContent"; import MarkdownContent from "./components/Markdowns/MarkdownContent";
@@ -14,33 +16,35 @@ import MarkdownTemplateEditor from "./components/MarkdownTemplate/MarkdownTempla
const App = () => { const App = () => {
return ( return (
<Router> <Provider store={store}>
<div className="app-container"> <Router>
<MainNavigation /> <div className="app-container">
<div className="content-container"> <MainNavigation />
<SideNavigation /> <div className="content-container">
<main className="main-content"> <SideNavigation />
<Routes> <main className="main-content">
<Route <Routes>
path="/" <Route
element={<Navigate to = "/markdown/1"/>} path="/"
/> element={<Navigate to = "/markdown/1"/>}
<Route path="/testx" element={<h2>test2</h2>}/> />
<Route path="/markdown/:id" element={<MarkdownContent />} /> <Route path="/testx" element={<h2>test2</h2>}/>
<Route path="/callback" element={<Callback />} /> <Route path="/markdown/:id" element={<MarkdownContent />} />
<Route path="/test" element={<h1>TEST</h1>}></Route> <Route path="/callback" element={<Callback />} />
<Route path="/markdown/create" element={<MarkdownEditor />} /> <Route path="/test" element={<h1>TEST</h1>}></Route>
<Route path="/markdown/edit/:id" element={<MarkdownEditor />} /> <Route path="/markdown/create" element={<MarkdownEditor />} />
<Route path="/popup_callback" element={<PopupCallback />} /> <Route path="/markdown/edit/:id" element={<MarkdownEditor />} />
<Route path="/silent_callback" element={<SilentCallback />} /> <Route path="/popup_callback" element={<PopupCallback />} />
<Route path="/template/create" element={<MarkdownTemplateEditor />} /> <Route path="/silent_callback" element={<SilentCallback />} />
<Route path="/template/edit/:id" element={<MarkdownTemplateEditor />} /> <Route path="/template/create" element={<MarkdownTemplateEditor />} />
</Routes> <Route path="/template/edit/:id" element={<MarkdownTemplateEditor />} />
</main> </Routes>
</main>
</div>
</div> </div>
</div> <Footer />
<Footer /> </Router>
</Router> </Provider>
); );
}; };

View File

@@ -23,7 +23,7 @@ const MarkdownEditor = () => {
const [isRawMode, setIsRawMode] = useState(false); const [isRawMode, setIsRawMode] = useState(false);
const [rawContent, setRawContent] = useState(""); const [rawContent, setRawContent] = useState("");
const [jsonError, setJsonError] = useState(""); const [jsonError, setJsonError] = useState("");
const {data: markdown, isLoading, error} = useMarkdown(id); const {data: markdown, isFetching: isMarkdownFetching, error} = useMarkdown(id);
const saveMarkdown = useSaveMarkdown(); const saveMarkdown = useSaveMarkdown();
const {data: setting, isFetching: isSettingFetching} = useMarkdownSetting(markdown?.setting_id); const {data: setting, isFetching: isSettingFetching} = useMarkdownSetting(markdown?.setting_id);
const {data: templateSetting, isFetching: isTemplateSettingFetching} = useMarkdownTemplateSetting(setting?.template_setting_id); const {data: templateSetting, isFetching: isTemplateSettingFetching} = useMarkdownTemplateSetting(setting?.template_setting_id);
@@ -31,9 +31,9 @@ const MarkdownEditor = () => {
const updateTemplateSetting = useUpdateMarkdownTemplateSetting(); const updateTemplateSetting = useUpdateMarkdownTemplateSetting();
const createTemplateSetting = useCreateMarkdownTemplateSetting(); const createTemplateSetting = useCreateMarkdownTemplateSetting();
const updateSetting = useUpdateMarkdownSetting(); const updateSetting = useUpdateMarkdownSetting();
const {data: templates} = useMarkdownTemplates(); const {data: templates, isFetching: templatesAreFetching} = useMarkdownTemplates();
const notReady = isLoading || isTemplateFetching || isSettingFetching || isTemplateSettingFetching; const notReady = isMarkdownFetching || isTemplateFetching || isSettingFetching || isTemplateSettingFetching || templatesAreFetching;
useEffect(() => { useEffect(() => {
if(markdown){ if(markdown){
setTitle(markdown.title); setTitle(markdown.title);
@@ -156,9 +156,16 @@ const MarkdownEditor = () => {
if (!hasPermission) if (!hasPermission)
return <div className="notification is-danger">Permission Denied</div>; return <div className="notification is-danger">Permission Denied</div>;
if(notReady) if(notReady) {
console.log("=============");
console.log("isMarkdownFetching", isMarkdownFetching );
console.log("isTemplateFetching", isTemplateFetching );
console.log("isSettingFetching", isSettingFetching );
console.log("isTemplateSettingFetching", isTemplateSettingFetching);
console.log( "TemplatesAreFetching", templatesAreFetching);
console.log("----------------");
return <p>Loading...</p>; return <p>Loading...</p>;
}
if(error) if(error)
return <p>{error.message || "Failed to load markdown"}</p>; return <p>{error.message || "Failed to load markdown"}</p>;

View File

@@ -3,7 +3,8 @@ import {useCreatePathSetting, usePathSetting} from "../../utils/queries/path-set
import WebhookSettingPanel from "../Settings/PathSettings/WebhookSettingPanel"; import WebhookSettingPanel from "../Settings/PathSettings/WebhookSettingPanel";
import React, {useState} from "react"; import React, {useState} from "react";
const PathSettingModal = ({ isOpen, path, onClose }) => { const PathSettingModal = ({ isOpen, path, onClose }) => {
const {data: pathSetting, isLoading: isPathSettingLoading} = usePathSetting(path?.setting_id || 0); const settingId = path?.setting_id || 0;
const {data: pathSetting, isLoading: isPathSettingLoading} = usePathSetting(settingId);
const createPathSetting = useCreatePathSetting(); const createPathSetting = useCreatePathSetting();
const updatePath = useUpdatePath(); const updatePath = useUpdatePath();
@@ -17,7 +18,7 @@ const PathSettingModal = ({ isOpen, path, onClose }) => {
}; };
if(isPathSettingLoading) if(settingId && isPathSettingLoading)
return (<p>Loading...</p>); return (<p>Loading...</p>);
return ( return (
@@ -73,4 +74,4 @@ const PathSettingModal = ({ isOpen, path, onClose }) => {
}; };
export default PathSettingModal; export default PathSettingModal;

View File

@@ -1,4 +1,6 @@
import React, {useState} from "react"; import React, {useState} from "react";
import { useSelector, useDispatch } from 'react-redux';
import { toggleNodeExpansion } from '../../store/navigationSlice';
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import PermissionGuard from "../PermissionGuard"; import PermissionGuard from "../PermissionGuard";
import "./PathNode.css"; import "./PathNode.css";
@@ -9,10 +11,13 @@ import PathSettingModal from "../Modals/PathSettingModal";
const PathNode = ({ path, isRoot = false }) => { const PathNode = ({ path, isRoot = false }) => {
const [isPathSettingModalOpen, setIsPathSettingModalOpen] = useState(false); const [isPathSettingModalOpen, setIsPathSettingModalOpen] = useState(false);
const [isExpanded, setIsExpanded] = useState(isRoot);
const [isEditing, setIsEditing] = useState(false); const [isEditing, setIsEditing] = useState(false);
const [newName, setNewName] = useState(path.name || ""); const [newName, setNewName] = useState(path.name || "");
const expandedNodes = useSelector(state => state.navigation.expandedNodes);
const dispatch = useDispatch();
const isExpanded = isRoot || expandedNodes[path.id];
const deletePath = useDeletePath(); const deletePath = useDeletePath();
const updatePath = useUpdatePath(); const updatePath = useUpdatePath();
@@ -23,11 +28,13 @@ const PathNode = ({ path, isRoot = false }) => {
const expand = () => { const expand = () => {
if(!isExpanded) if (!isExpanded) {
setIsExpanded(true); dispatch(toggleNodeExpansion(path.id));
}
}; };
const toggleExpand = () => { const toggleExpand = () => {
setIsExpanded(!isExpanded); dispatch(toggleNodeExpansion(path.id));
}; };
const handleSave = () => { const handleSave = () => {

View File

@@ -1,4 +1,6 @@
import React, { useContext, useEffect } from 'react'; import React, { useContext, useEffect } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { setSelectedTab } from '../../store/navigationSlice';
import "./SideNavigation.css"; import "./SideNavigation.css";
import TreeTab from "./SideTabs/TreeTab"; import TreeTab from "./SideTabs/TreeTab";
import TemplateTab from "./SideTabs/TemplateTab"; import TemplateTab from "./SideTabs/TemplateTab";
@@ -6,7 +8,8 @@ import { AuthContext } from "../../AuthProvider";
const SideNavigation = () => { const SideNavigation = () => {
const { roles } = useContext(AuthContext); const { roles } = useContext(AuthContext);
const [selectedTab, setSelectedTab] = React.useState("tree"); const selectedTab = useSelector(state => state.navigation.selectedTab);
const dispatch = useDispatch();
const allTabs = [ const allTabs = [
{ id: "tree", label: "Tree", component: <TreeTab /> }, { id: "tree", label: "Tree", component: <TreeTab /> },
@@ -19,9 +22,9 @@ const SideNavigation = () => {
useEffect(() => { useEffect(() => {
if (!visibleTabs.find(tab => tab.id === selectedTab)) { if (!visibleTabs.find(tab => tab.id === selectedTab)) {
setSelectedTab(visibleTabs[0]?.id || ""); dispatch(setSelectedTab(visibleTabs[0]?.id || ""));
} }
}, [visibleTabs, selectedTab]); }, [visibleTabs, selectedTab, dispatch]);
const current = visibleTabs.find(t => t.id === selectedTab); const current = visibleTabs.find(t => t.id === selectedTab);
@@ -35,7 +38,7 @@ const SideNavigation = () => {
key={tab.id} key={tab.id}
className={tab.id === selectedTab ? "is-active" : ""} className={tab.id === selectedTab ? "is-active" : ""}
> >
<a onClick={() => setSelectedTab(tab.id)}> <a onClick={() => dispatch(setSelectedTab(tab.id))}>
{tab.label} {tab.label}
</a> </a>
</li> </li>

View File

@@ -1,6 +1,6 @@
import React, {useEffect, useState, useRef, useContext} from "react"; import React, {useEffect, useState, useRef, useContext} from "react";
import {useCreatePath, usePaths} from "../utils/queries/path-queries"; import {useCreatePath, usePaths} from "../utils/queries/path-queries";
import { useQueryClient } from "react-query"; import { useQueryClient } from "@tanstack/react-query";
import "./PathManager.css"; import "./PathManager.css";
import {fetch_} from "../utils/request-utils"; import {fetch_} from "../utils/request-utils";
import {ConfigContext} from "../ConfigProvider"; import {ConfigContext} from "../ConfigProvider";

View File

@@ -3,7 +3,7 @@ import ReactDOM from "react-dom/client";
import App from "./App"; import App from "./App";
import AuthProvider, {AuthContext} from "./AuthProvider"; import AuthProvider, {AuthContext} from "./AuthProvider";
import "bulma/css/bulma.min.css"; import "bulma/css/bulma.min.css";
import {QueryClient, QueryClientProvider} from "react-query" import {QueryClient, QueryClientProvider} from "@tanstack/react-query"
import ConfigProvider from "./ConfigProvider"; import ConfigProvider from "./ConfigProvider";
const queryClient = new QueryClient({ const queryClient = new QueryClient({
@@ -11,7 +11,7 @@ const queryClient = new QueryClient({
queries: { queries: {
retry: 2, retry: 2,
refetchOnWindowFocus: false, refetchOnWindowFocus: false,
staleTimeout: 5 * 60 * 1000, staleTime: 5 * 60 * 1000,
onError: (error) => { onError: (error) => {
if (error.message === "Unauthorized"){ if (error.message === "Unauthorized"){
const {logout} = queryClient const {logout} = queryClient
@@ -38,7 +38,7 @@ const EnhancedAuthProvider = ({children}) => {
}; };
React.useEffect(() => { React.useEffect(() => {
queryClient.setQueryDefaults("auths", { queryClient.setQueryDefaults(["auths"], {
context: {logout} context: {logout}
}); });
}, [logout]); }, [logout]);

8
src/store/index.js Normal file
View File

@@ -0,0 +1,8 @@
import { configureStore } from '@reduxjs/toolkit';
import navigationReducer from './navigationSlice';
export const store = configureStore({
reducer: {
navigation: navigationReducer,
},
});

View File

@@ -0,0 +1,24 @@
import { createSlice } from '@reduxjs/toolkit';
const navigationSlice = createSlice({
name: 'navigation',
initialState: {
selectedTab: "tree",
expandedNodes: {}
},
reducers: {
setSelectedTab: (state, action) => {
state.selectedTab = action.payload;
},
toggleNodeExpansion: (state, action) => {
const nodeId = action.payload;
state.expandedNodes[nodeId] = !state.expandedNodes[nodeId];
},
setExpandedNodes: (state, action) => {
state.expandedNodes = action.payload;
}
}
});
export const { setSelectedTab, toggleNodeExpansion, setExpandedNodes } = navigationSlice.actions;
export default navigationSlice.reducer;

View File

@@ -1,12 +1,12 @@
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
import {useMutation, useQuery, useQueryClient} from "react-query"; import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query";
import {fetch_} from "../request-utils"; import {fetch_} from "../request-utils";
export const useMarkdownPermissionSettings = () => { export const useMarkdownPermissionSettings = () => {
const config = useConfig(); const config = useConfig();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useQuery( return useQuery(
"markdown_permission_settings", ["markdown_permission_settings"],
() => fetch_(`${config.BACKEND_HOST}/api/setting/markdown/permission/`), { () => fetch_(`${config.BACKEND_HOST}/api/setting/markdown/permission/`), {
onSuccess: (data) => { onSuccess: (data) => {
if(data){ if(data){
@@ -38,7 +38,7 @@ export const useCreateMarkdownPermissionSetting = () => {
}), { }), {
onSuccess: (data) => { onSuccess: (data) => {
queryClient.invalidateQueries(["markdown_permission_setting", data.id]); queryClient.invalidateQueries(["markdown_permission_setting", data.id]);
queryClient.invalidateQueries("markdown_permission_settings"); queryClient.invalidateQueries(["markdown_permission_settings"]);
} }
}); });
}; };
@@ -53,7 +53,7 @@ export const useUpdateMarkdownPermissionSetting = () => {
}),{ }),{
onSuccess: (res) => { onSuccess: (res) => {
queryClient.invalidateQueries(["markdown_permission_setting", res.id]); queryClient.invalidateQueries(["markdown_permission_setting", res.id]);
queryClient.invalidateQueries("markdown_permission_settings"); queryClient.invalidateQueries(["markdown_permission_settings"]);
} }
} }
); );
@@ -68,8 +68,8 @@ export const useDeleteMarkdownPermissionSetting = () => {
}), { }), {
onSuccess: (res, variables) => { onSuccess: (res, variables) => {
queryClient.invalidateQueries(["markdown_permission_setting", variables.id]); queryClient.invalidateQueries(["markdown_permission_setting", variables.id]);
queryClient.invalidateQueries("markdown_permission_settings"); queryClient.invalidateQueries(["markdown_permission_settings"]);
} }
} }
); );
}; };

View File

@@ -1,4 +1,4 @@
import {useQuery, useMutation, useQueryClient} from 'react-query'; import {useQuery, useMutation, useQueryClient} from '@tanstack/react-query';
import {fetch_} from "../request-utils"; import {fetch_} from "../request-utils";
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
@@ -70,7 +70,7 @@ export const useSaveMarkdown = () => {
onSuccess: (res) => { onSuccess: (res) => {
queryClient.invalidateQueries(["markdownsByPath", res.path_id]); queryClient.invalidateQueries(["markdownsByPath", res.path_id]);
queryClient.invalidateQueries(["markdown", res.id]); queryClient.invalidateQueries(["markdown", res.id]);
queryClient.invalidateQueries("tree"); queryClient.invalidateQueries(["tree"]);
}, },
}); });
}; };
@@ -87,8 +87,8 @@ export const useMoveMarkdown = () => {
}, },
{ {
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries("paths"); queryClient.invalidateQueries(["paths"]);
queryClient.invalidateQueries("tree"); queryClient.invalidateQueries(["tree"]);
} }
} }
); );
@@ -111,4 +111,3 @@ export const useLinks = () => {
const config = useConfig(); const config = useConfig();
return useQuery(["links"], () => fetch_(`${config.BACKEND_HOST}/api/markdown/links`)); return useQuery(["links"], () => fetch_(`${config.BACKEND_HOST}/api/markdown/links`));
} }

View File

@@ -1,12 +1,12 @@
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
import {useMutation, useQuery, useQueryClient} from "react-query"; import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query";
import {fetch_} from "../request-utils"; import {fetch_} from "../request-utils";
export const useMarkdownSettings = () => { export const useMarkdownSettings = () => {
const config = useConfig(); const config = useConfig();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useQuery( return useQuery(
"markdown_setting", ["markdown_setting"],
() => fetch_(`${config.BACKEND_HOST}/api/setting/markdown/`), () => fetch_(`${config.BACKEND_HOST}/api/setting/markdown/`),
{ {
onSuccess: (data) => { onSuccess: (data) => {

View File

@@ -1,5 +1,5 @@
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
import {useMutation, useQuery, useQueryClient} from "react-query"; import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query";
import {fetch_} from "../request-utils"; import {fetch_} from "../request-utils";
import {template} from "@babel/core"; import {template} from "@babel/core";
import {data} from "react-router-dom"; import {data} from "react-router-dom";
@@ -19,7 +19,7 @@ export const useMarkdownTemplates = () => {
const config = useConfig(); const config = useConfig();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useQuery( return useQuery(
"markdown_templates", ["markdown_templates"],
() => fetch_(`${config.BACKEND_HOST}/api/template/markdown/`), { () => fetch_(`${config.BACKEND_HOST}/api/template/markdown/`), {
onSuccess: (data) => { onSuccess: (data) => {
if(data){ if(data){
@@ -43,7 +43,7 @@ export const useUpdateMarkdownTemplate = () => {
{ {
onSuccess: (data) => { onSuccess: (data) => {
queryClient.invalidateQueries(["markdown_template", data.id]); queryClient.invalidateQueries(["markdown_template", data.id]);
queryClient.invalidateQueries("markdown_templates"); queryClient.invalidateQueries(["markdown_templates"]);
} }
} }
); );
@@ -59,7 +59,7 @@ export const useCreateMarkdownTemplate = () => {
}),{ }),{
onSuccess: (data) => { onSuccess: (data) => {
queryClient.invalidateQueries(["markdown_template", data.id]); queryClient.invalidateQueries(["markdown_template", data.id]);
queryClient.invalidateQueries("markdown_templates"); queryClient.invalidateQueries(["markdown_templates"]);
} }
} }
); );
@@ -74,7 +74,7 @@ export const useDeleteMarkdownTemplate = () => {
}), { }), {
onSuccess: (res, variables) => { onSuccess: (res, variables) => {
queryClient.invalidateQueries(["markdown_template", variables]); queryClient.invalidateQueries(["markdown_template", variables]);
queryClient.invalidateQueries("markdown_templates"); queryClient.invalidateQueries(["markdown_templates"]);
} }
} }
) )
@@ -95,7 +95,7 @@ export const useSaveMarkdownTemplate = () => {
},{ },{
onSuccess: (data) => { onSuccess: (data) => {
queryClient.invalidateQueries(["markdown_template", data.id]); queryClient.invalidateQueries(["markdown_template", data.id]);
queryClient.invalidateQueries("markdown_templates"); queryClient.invalidateQueries(["markdown_templates"]);
} }
}); });
} }

View File

@@ -1,12 +1,12 @@
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
import {useMutation, useQuery, useQueryClient} from "react-query"; import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query";
import {fetch_} from "../request-utils"; import {fetch_} from "../request-utils";
export const useMarkdownTemplateSettings = () => { export const useMarkdownTemplateSettings = () => {
const config = useConfig(); const config = useConfig();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useQuery( return useQuery(
"markdown_template_settings", ["markdown_template_settings"],
() => fetch_(`${config.BACKEND_HOST}/api/setting/markdown/template/`), { () => fetch_(`${config.BACKEND_HOST}/api/setting/markdown/template/`), {
onSuccess: (data) => { onSuccess: (data) => {
if(data){ if(data){
@@ -53,7 +53,7 @@ export const useUpdateMarkdownTemplateSetting = () => {
}),{ }),{
onSuccess: (res) => { onSuccess: (res) => {
queryClient.invalidateQueries(["markdown_template_setting", res.id]); queryClient.invalidateQueries(["markdown_template_setting", res.id]);
queryClient.invalidateQueries("markdown_template_settings"); queryClient.invalidateQueries(["markdown_template_settings"]);
} }
} }
); );

View File

@@ -1,4 +1,4 @@
import { useQuery, useMutation, useQueryClient } from "react-query"; import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { fetch_ } from "../request-utils"; import { fetch_ } from "../request-utils";
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
@@ -47,7 +47,7 @@ export const useCreatePath = () => {
{ {
onSuccess: (res) => { onSuccess: (res) => {
queryClient.invalidateQueries(["paths", res.parent_id]); queryClient.invalidateQueries(["paths", res.parent_id]);
queryClient.invalidateQueries("tree"); queryClient.invalidateQueries(["tree"]);
}, },
} }
); );
@@ -66,7 +66,7 @@ export const useUpdatePath = () => {
onSuccess: (res) => { onSuccess: (res) => {
queryClient.invalidateQueries(["paths", res.parent_id]); queryClient.invalidateQueries(["paths", res.parent_id]);
queryClient.invalidateQueries(["path", res.id]); queryClient.invalidateQueries(["path", res.id]);
queryClient.invalidateQueries("tree"); queryClient.invalidateQueries(["tree"]);
}, },
} }
); );
@@ -82,8 +82,8 @@ export const useDeletePath = () => {
}), }),
{ {
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries("paths"); queryClient.invalidateQueries(["paths"]);
queryClient.invalidateQueries("tree"); queryClient.invalidateQueries(["tree"]);
}, },
} }
); );
@@ -101,8 +101,8 @@ export const useMovePath = () => {
}, },
{ {
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries("paths"); queryClient.invalidateQueries(["paths"]);
queryClient.invalidateQueries("tree"); queryClient.invalidateQueries(["tree"]);
} }
} }
); );

View File

@@ -1,5 +1,5 @@
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
import {useMutation, useQuery, useQueryClient} from "react-query"; import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query";
import {fetch_} from "../request-utils"; import {fetch_} from "../request-utils";
export const usePathSettings = () => { export const usePathSettings = () => {
@@ -40,7 +40,7 @@ export const useCreatePathSetting = () => {
}), { }), {
onSuccess: (data) => { onSuccess: (data) => {
queryClient.invalidateQueries(["path_setting", data.id]); queryClient.invalidateQueries(["path_setting", data.id]);
queryClient.invalidateQueries("path_settings"); queryClient.invalidateQueries(["path_settings"]);
} }
} }
); );
@@ -57,7 +57,7 @@ export const useUpdatePathSetting = () => {
}), { }), {
onSuccess: (data, variables) => { onSuccess: (data, variables) => {
queryClient.invalidateQueries(["path_setting", variables.id]); queryClient.invalidateQueries(["path_setting", variables.id]);
queryClient.invalidateQueries("path_settings"); queryClient.invalidateQueries(["path_settings"]);
} }
} }
); );
@@ -73,7 +73,7 @@ export const useDeletePathSetting = () => {
}),{ }),{
onSuccess: (data, variables) => { onSuccess: (data, variables) => {
queryClient.invalidateQueries(["path_setting", variables.id]); queryClient.invalidateQueries(["path_setting", variables.id]);
queryClient.invalidateQueries("path_settings"); queryClient.invalidateQueries(["path_settings"]);
} }
} }
); );

View File

@@ -1,4 +1,4 @@
import {useQuery, useMutation, useQueryClient} from "react-query"; import {useQuery, useMutation, useQueryClient} from "@tanstack/react-query";
import {fetch_} from "../request-utils"; import {fetch_} from "../request-utils";
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
@@ -7,13 +7,13 @@ export const useTree = () => {
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const config = useConfig(); const config = useConfig();
return useQuery( return useQuery(
"tree", ["tree"],
() => fetch_(`${config.BACKEND_HOST}/api/tree/`), () => fetch_(`${config.BACKEND_HOST}/api/tree/`),
{ {
onSuccess: data => { onSuccess: data => {
if(data) if(data)
queryClient.setQueryData("tree", data); queryClient.setQueryData(["tree"], data);
} }
} }
); );
} }

View File

@@ -1,12 +1,12 @@
import {fetch_ } from "../request-utils" import {fetch_ } from "../request-utils"
import {useConfig} from "../../ConfigProvider"; import {useConfig} from "../../ConfigProvider";
import {useMutation, useQuery, useQueryClient} from "react-query"; import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query";
export const useWebhooks = () =>{ export const useWebhooks = () =>{
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const config = useConfig(); const config = useConfig();
return useQuery( return useQuery(
"webhooks", ["webhooks"],
() => fetch_(`${config.BACKEND_HOST}/api/webhook/`), () => fetch_(`${config.BACKEND_HOST}/api/webhook/`),
{ {
onSuccess: (data) => { onSuccess: (data) => {
@@ -33,7 +33,7 @@ export const useCreateWebhook = () => {
}), }),
{ {
onSuccess: () => { onSuccess: () => {
queryClient.invalidateQueries("webhooks"); queryClient.invalidateQueries(["webhooks"]);
} }
} }
); );
@@ -50,7 +50,7 @@ export const useUpdateWebhook = () =>{
{ {
onSuccess: (res) => { onSuccess: (res) => {
queryClient.invalidateQueries(["webhook", res.id]); queryClient.invalidateQueries(["webhook", res.id]);
queryClient.invalidateQueries("webhooks"); queryClient.invalidateQueries(["webhooks"]);
} }
} }
); );
@@ -66,7 +66,7 @@ export const useDeleteWebhook = () => {
{ {
onSuccess: (res, variables) => { onSuccess: (res, variables) => {
queryClient.invalidateQueries(["webhook", variables.id]); queryClient.invalidateQueries(["webhook", variables.id]);
queryClient.invalidateQueries("webhooks"); queryClient.invalidateQueries(["webhooks"]);
} }
} }
) )
@@ -76,7 +76,7 @@ export const useWebhookSettings = () => {
const config = useConfig(); const config = useConfig();
const queryClient = useQueryClient(); const queryClient = useQueryClient();
return useQuery( return useQuery(
"webhook_setting", ["webhook_setting"],
() => fetch_(`${config.BACKEND_HOST}/api/setting/path/webhook/`), () => fetch_(`${config.BACKEND_HOST}/api/setting/path/webhook/`),
{ {
onSuccess: (data) => { onSuccess: (data) => {
@@ -111,7 +111,7 @@ export const useCreateWebhookSetting = () => {
}),{ }),{
onSuccess: (res) => { onSuccess: (res) => {
queryClient.invalidateQueries(["webhook_setting", res.id]); queryClient.invalidateQueries(["webhook_setting", res.id]);
queryClient.invalidateQueries("webhook_setting"); queryClient.invalidateQueries(["webhook_setting"]);
} }
} }
); );
@@ -127,7 +127,7 @@ export const useUpdateWebhookSetting = () => {
}),{ }),{
onSuccess: (res, variables) => { onSuccess: (res, variables) => {
queryClient.invalidateQueries(["webhook_setting", variables.id]); queryClient.invalidateQueries(["webhook_setting", variables.id]);
queryClient.invalidateQueries("webhook_setting"); queryClient.invalidateQueries(["webhook_setting"]);
} }
} }
); );
@@ -144,9 +144,8 @@ export const useDeleteWebhookSetting = () => {
{ {
onSuccess: (res, variables) => { onSuccess: (res, variables) => {
queryClient.invalidateQueries(["webhook_setting", variables.id]); queryClient.invalidateQueries(["webhook_setting", variables.id]);
queryClient.invalidateQueries("webhook_setting"); queryClient.invalidateQueries(["webhook_setting"]);
} }
} }
); );
}; };

View File

@@ -30,7 +30,7 @@ module.exports = {
inject: true inject: true
}), }),
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
process: 'process/browser' process: 'process/browser.js'
}) })
], ],
@@ -42,12 +42,15 @@ module.exports = {
historyApiFallback: true, historyApiFallback: true,
}, },
resolve: { resolve: {
alias: {
'process/browser': require.resolve('process/browser.js')
},
fallback: { fallback: {
path: require.resolve('path-browserify'), path: require.resolve('path-browserify'),
fs: false, fs: false,
assert: require.resolve("assert/"), assert: require.resolve("assert/"),
process: require.resolve("process/browser"), process: require.resolve("process/browser.js"),
} }
}, },
devtool: 'source-map', devtool: 'source-map',
}; };