diff --git a/.vscode/settings.json b/.vscode/settings.json index 88756d2..72536b5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,6 +12,7 @@ "Sharrow", "sherlock", "softprops", + "tanstack", "TSQL" ], "cSpell.language": "en,es-ES" diff --git a/package-lock.json b/package-lock.json index 8ade519..6f4bd46 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "i18next": "^21.8.13", "i18next-browser-languagedetector": "^6.1.4", "jsonschema": "^1.4.1", + "ky": "^0.31.0", "lodash.debounce": "^4.0.8", "lodash.escaperegexp": "^4.1.2", "lodash.sortby": "^4.7.0", @@ -25,8 +26,10 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-error-boundary": "^3.1.4", + "react-hook-form": "^7.33.1", "react-i18next": "^11.18.0", "react-number-format": "^4.9.3", + "react-query": "^4.0.0-beta.23", "reactstrap": "^9.1.1", "sql-formatter": "^7.0.3", "typeface-montserrat": "^1.1.13", @@ -5766,6 +5769,11 @@ "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==", "dev": true }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz", + "integrity": "sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==" + }, "node_modules/@types/webpack": { "version": "4.41.32", "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.32.tgz", @@ -7040,8 +7048,7 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/base": { "version": "0.11.2", @@ -7144,8 +7151,6 @@ "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", - "dev": true, - "optional": true, "engines": { "node": ">=0.6" } @@ -7336,7 +7341,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -7354,6 +7358,21 @@ "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/brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -8305,8 +8324,7 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "node_modules/concat-stream": { "version": "2.0.0", @@ -9889,6 +9907,11 @@ "node": ">=8" } }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==" + }, "node_modules/detect-package-manager": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/detect-package-manager/-/detect-package-manager-2.0.1.tgz", @@ -12290,8 +12313,7 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/fsevents": { "version": "2.3.2", @@ -12600,7 +12622,6 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -13568,7 +13589,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -13577,8 +13597,7 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/ini": { "version": "1.3.8", @@ -14428,6 +14447,11 @@ "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-string-escape": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", @@ -14602,6 +14626,17 @@ "node": ">= 8" } }, + "node_modules/ky": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.31.0.tgz", + "integrity": "sha512-C27vqDb3vuxy4mi/x1wt9P1ES0QxEJg3CbPz2t3lTaQ4AvR/hkwES06yPdqol+q3hH+DrZKb/PKD+pAQkharNg==", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sindresorhus/ky?sponsor=1" + } + }, "node_modules/lazy-universal-dotenv": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lazy-universal-dotenv/-/lazy-universal-dotenv-3.0.1.tgz", @@ -15036,6 +15071,15 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/match-sorter": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/match-sorter/-/match-sorter-6.3.1.tgz", + "integrity": "sha512-mxybbo3pPNuA+ZuCUhm5bwNkXrJTbsk5VWbR5wiwz/GC6LIiegBGn2w3O08UG/jdbYLinw51fSQ5xNU1U3MgBw==", + "dependencies": { + "@babel/runtime": "^7.12.5", + "remove-accents": "0.4.2" + } + }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -15405,6 +15449,11 @@ "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/miller-rabin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", @@ -15500,7 +15549,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -15750,6 +15798,14 @@ "dev": true, "optional": true }, + "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": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", @@ -16277,6 +16333,11 @@ "integrity": "sha512-eJJDYkhJFFbBBAxeh8xW+weHlkI28n2ZdQV/J/DNfWfSKlGEf2xcfAbZTv3riEXHAhL9SVOTs2pRmXiSTf78xg==", "dev": true }, + "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/on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -16302,7 +16363,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "dependencies": { "wrappy": "1" } @@ -16678,7 +16738,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -17677,6 +17736,21 @@ "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz", "integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==" }, + "node_modules/react-hook-form": { + "version": "7.33.1", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.33.1.tgz", + "integrity": "sha512-ydTfTxEJdvgjCZBj5DDXRc58oTEfnFupEwwTAQ9FSKzykEJkX+3CiAkGtAMiZG7IPWHuzgT6AOBfogiKhUvKgg==", + "engines": { + "node": ">=12.22.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/react-hook-form" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17 || ^18" + } + }, "node_modules/react-i18next": { "version": "11.18.0", "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.18.0.tgz", @@ -17753,6 +17827,33 @@ "react-dom": "^16.8.0 || ^17 || ^18" } }, + "node_modules/react-query": { + "version": "4.0.0-beta.23", + "resolved": "https://registry.npmjs.org/react-query/-/react-query-4.0.0-beta.23.tgz", + "integrity": "sha512-e6mNBVAYGy0M1OwX0mhRB/lCkOedKeqTUrbPjNCqvm8hQGUsJJobqfHVvTv8o6JJaOO2MFcxKF4vZM+PEKbHZA==", + "dependencies": { + "@babel/runtime": "^7.17.9", + "@types/use-sync-external-store": "^0.0.3", + "broadcast-channel": "^3.4.1", + "match-sorter": "^6.0.2", + "use-sync-external-store": "^1.1.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, "node_modules/react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", @@ -18369,6 +18470,11 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remove-accents": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.4.2.tgz", + "integrity": "sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==" + }, "node_modules/remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", @@ -18511,7 +18617,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "dependencies": { "glob": "^7.1.3" }, @@ -21323,6 +21428,15 @@ "node": ">= 10.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": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -21481,6 +21595,14 @@ "react": "^16.8.0 || ^17.0.1 || ^18.0.0" } }, + "node_modules/use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/util": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", @@ -22746,8 +22868,7 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "node_modules/write-file-atomic": { "version": "3.0.3", @@ -27060,6 +27181,11 @@ "integrity": "sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==", "dev": true }, + "@types/use-sync-external-store": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz", + "integrity": "sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA==" + }, "@types/webpack": { "version": "4.41.32", "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-4.41.32.tgz", @@ -28101,8 +28227,7 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "base": { "version": "0.11.2", @@ -28173,9 +28298,7 @@ "big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", - "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", - "dev": true, - "optional": true + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==" }, "big.js": { "version": "5.2.2", @@ -28324,7 +28447,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -28339,6 +28461,21 @@ "fill-range": "^7.0.1" } }, + "broadcast-channel": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/broadcast-channel/-/broadcast-channel-3.7.0.tgz", + "integrity": "sha512-cIAKJXAxGJceNZGTZSBzMxzyOn72cVgPnKx4dc6LRjQgbaJUQqhy5rzL3zbMxkMWsGKkv2hSFkPRMEXfoMZ2Mg==", + "requires": { + "@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" + } + }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -29072,8 +29209,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "concat-stream": { "version": "2.0.0", @@ -30304,6 +30440,11 @@ "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", "dev": true }, + "detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==" + }, "detect-package-manager": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/detect-package-manager/-/detect-package-manager-2.0.1.tgz", @@ -32141,8 +32282,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "fsevents": { "version": "2.3.2", @@ -32374,7 +32514,6 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -33102,7 +33241,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -33111,8 +33249,7 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { "version": "1.3.8", @@ -33719,6 +33856,11 @@ "supports-color": "^7.0.0" } }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, "js-string-escape": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", @@ -33846,6 +33988,11 @@ "integrity": "sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ==", "dev": true }, + "ky": { + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/ky/-/ky-0.31.0.tgz", + "integrity": "sha512-C27vqDb3vuxy4mi/x1wt9P1ES0QxEJg3CbPz2t3lTaQ4AvR/hkwES06yPdqol+q3hH+DrZKb/PKD+pAQkharNg==" + }, "lazy-universal-dotenv": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/lazy-universal-dotenv/-/lazy-universal-dotenv-3.0.1.tgz", @@ -34198,6 +34345,15 @@ "integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==", "dev": true }, + "match-sorter": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/match-sorter/-/match-sorter-6.3.1.tgz", + "integrity": "sha512-mxybbo3pPNuA+ZuCUhm5bwNkXrJTbsk5VWbR5wiwz/GC6LIiegBGn2w3O08UG/jdbYLinw51fSQ5xNU1U3MgBw==", + "requires": { + "@babel/runtime": "^7.12.5", + "remove-accents": "0.4.2" + } + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -34493,6 +34649,11 @@ "picomatch": "^2.3.1" } }, + "microseconds": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/microseconds/-/microseconds-0.2.0.tgz", + "integrity": "sha512-n7DHHMjR1avBbSpsTBj6fmMGh2AGrifVV4e+WYc3Q9lO+xnSZ3NyhcBND3vzzatt05LFhoKFRxrIyklmLlUtyA==" + }, "miller-rabin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", @@ -34569,7 +34730,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } @@ -34778,6 +34938,14 @@ "dev": true, "optional": true }, + "nano-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/nano-time/-/nano-time-1.0.0.tgz", + "integrity": "sha512-flnngywOoQ0lLQOTRNexn2gGSNuM9bKj9RZAWSzhQ+UJYaAFG9bac4DW9VHjUAzrOaIcajHybCTHe/bkvozQqA==", + "requires": { + "big-integer": "^1.6.16" + } + }, "nanoid": { "version": "3.3.4", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", @@ -35200,6 +35368,11 @@ "integrity": "sha512-eJJDYkhJFFbBBAxeh8xW+weHlkI28n2ZdQV/J/DNfWfSKlGEf2xcfAbZTv3riEXHAhL9SVOTs2pRmXiSTf78xg==", "dev": true }, + "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==" + }, "on-finished": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", @@ -35219,7 +35392,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "requires": { "wrappy": "1" } @@ -35518,8 +35690,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" }, "path-key": { "version": "3.1.1", @@ -36267,6 +36438,12 @@ "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz", "integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==" }, + "react-hook-form": { + "version": "7.33.1", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.33.1.tgz", + "integrity": "sha512-ydTfTxEJdvgjCZBj5DDXRc58oTEfnFupEwwTAQ9FSKzykEJkX+3CiAkGtAMiZG7IPWHuzgT6AOBfogiKhUvKgg==", + "requires": {} + }, "react-i18next": { "version": "11.18.0", "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.18.0.tgz", @@ -36315,6 +36492,18 @@ "warning": "^4.0.2" } }, + "react-query": { + "version": "4.0.0-beta.23", + "resolved": "https://registry.npmjs.org/react-query/-/react-query-4.0.0-beta.23.tgz", + "integrity": "sha512-e6mNBVAYGy0M1OwX0mhRB/lCkOedKeqTUrbPjNCqvm8hQGUsJJobqfHVvTv8o6JJaOO2MFcxKF4vZM+PEKbHZA==", + "requires": { + "@babel/runtime": "^7.17.9", + "@types/use-sync-external-store": "^0.0.3", + "broadcast-channel": "^3.4.1", + "match-sorter": "^6.0.2", + "use-sync-external-store": "^1.1.0" + } + }, "react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", @@ -36793,6 +36982,11 @@ "mdast-squeeze-paragraphs": "^4.0.0" } }, + "remove-accents": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.4.2.tgz", + "integrity": "sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==" + }, "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", @@ -36902,7 +37096,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "requires": { "glob": "^7.1.3" } @@ -39153,6 +39346,15 @@ "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "dev": true }, + "unload": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unload/-/unload-2.2.0.tgz", + "integrity": "sha512-B60uB5TNBLtN6/LsgAf3udH9saB5p7gqJwcFfbOEZ8BcBHnGwCf6G/TGiEqkRAxX7zAFIUtzdrXQSdL3Q/wqNA==", + "requires": { + "@babel/runtime": "^7.6.2", + "detect-node": "^2.0.4" + } + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -39272,6 +39474,12 @@ "integrity": "sha512-Re4hjrP3a/2ABZjAc0b7AK9s626bnO+H33RO2VUhiDZ2StBz5B663K6WNNlr4QtHWaGUmvLpwt3whFvvWuolQw==", "requires": {} }, + "use-sync-external-store": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", + "requires": {} + }, "util": { "version": "0.11.1", "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", @@ -40284,8 +40492,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write-file-atomic": { "version": "3.0.3", diff --git a/package.json b/package.json index e7556b0..41f9892 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "i18next": "^21.8.13", "i18next-browser-languagedetector": "^6.1.4", "jsonschema": "^1.4.1", + "ky": "^0.31.0", "lodash.debounce": "^4.0.8", "lodash.escaperegexp": "^4.1.2", "lodash.sortby": "^4.7.0", @@ -73,8 +74,10 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-error-boundary": "^3.1.4", + "react-hook-form": "^7.33.1", "react-i18next": "^11.18.0", "react-number-format": "^4.9.3", + "react-query": "^4.0.0-beta.23", "reactstrap": "^9.1.1", "sql-formatter": "^7.0.3", "typeface-montserrat": "^1.1.13", diff --git a/public/config.json b/public/config.json index a7d10d8..d68125a 100644 --- a/public/config.json +++ b/public/config.json @@ -136,7 +136,18 @@ }, "projectInformation": "Project Information", "projectInformationPrompt": "Click on a feature for more information", - "transportation": "Transportation" + "transportation": "Transportation", + "comments": { + "leaveComment": "Leave comment", + "name": "Name", + "organization": "Organization", + "contact": "Contact Information (email/phone)", + "comment": "Comment*", + "submit": "Submit", + "cancel": "Cancel", + "required": "*Required", + "publicComments": "Public Comments" + } } }, "es": { @@ -151,8 +162,33 @@ }, "projectInformation": "Información del Proyecto", "projectInformationPrompt": "Haga clic en una función para obtener más información", - "transportation": "Transporte" + "transportation": "Transporte", + "comments": { + "leaveComment": "Comentar", + "name": "Nombre", + "organization": "Organización", + "contact": "Contacto (teléfono/correo electrónico)", + "comment": "Comentario*", + "submit": "Enviar", + "cancel": "Cancelar", + "required": "*Solicitado", + "publicComments": "Comentarios del Público" + } } } + }, + "projectInformation": { + "commentsEnabled": true, + "commentsTableUrl": "https://services1.arcgis.com/taguadKoI1XFwivx/arcgis/rest/services/Draft_Projects_2023_2050_RTP_Phased_by_Need/FeatureServer/2", + "newCommentsOpenUntil": "9999-01-31T00:00:00.000Z", + "fieldNames": { + "globalId": "GlobalID", + "personName": "PersonName", + "personOrg": "PersonOrg", + "personCont": "PersonCont", + "comment": "Comment", + "commentDt": "CommentDT", + "guid": "GUID" + } } } diff --git a/public/config.schema.json b/public/config.schema.json index ec59a6b..b049c59 100644 --- a/public/config.schema.json +++ b/public/config.schema.json @@ -57,7 +57,7 @@ "title": "WFRC RTP Projects", "type": "object", "additionalProperties": false, - "required": ["infoText", "projectTypes", "sherlock", "openOnLoad", "translations"], + "required": ["infoText", "projectTypes", "sherlock", "openOnLoad", "translations", "projectInformation"], "properties": { "infoText": { "title": "Info Popup Content", @@ -189,6 +189,67 @@ "additionalProperties": false }, "required": ["en"] + }, + "projectInformation": { + "title": "Project Information Widget Config", + "description": "Configuration options for the project information widget", + "type": "object", + "additionalProperties": false, + "required": ["commentsEnabled", "commentsTableUrl", "newCommentsOpenUntil", "fieldNames"], + "properties": { + "commentsEnabled": { + "title": "Comments Enabled", + "description": "Whether the comments widget is enabled", + "type": "boolean" + }, + "commentsTableUrl": { + "title": "Comments Table URL", + "description": "The URL to the feature service endpoint for the comments table", + "type": "string" + }, + "newCommentsOpenUntil": { + "title": "New Comments Open Until", + "description": "The date after which new comments will no longer be accepted.", + "type": "string" + }, + "fieldNames": { + "title": "Field Names", + "description": "An object that contains the field names for the comments table", + "type": "object", + "additionalProperties": false, + "required": ["globalId", "personName", "personOrg", "personCont", "comment", "commentDt", "guid"], + "properties": { + "globalId": { + "title": "Global ID", + "type": "string" + }, + "personName": { + "title": "Person Name", + "type": "string" + }, + "personOrg": { + "title": "Person Organization", + "type": "string" + }, + "personCont": { + "title": "Person Contact", + "type": "string" + }, + "comment": { + "title": "Comment", + "type": "string" + }, + "commentDt": { + "title": "Comment Date", + "type": "string" + }, + "guid": { + "title": "GUID", + "type": "string" + } + } + } + } } } } diff --git a/src/App.jsx b/src/App.jsx index 1166771..d15f80b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,14 +5,17 @@ import WebMap from '@arcgis/core/WebMap'; import Home from '@arcgis/core/widgets/Home'; import { faFilter, faHandPointer } from '@fortawesome/free-solid-svg-icons'; import React from 'react'; +import { QueryClient, QueryClientProvider } from 'react-query'; import 'typeface-montserrat'; import './App.scss'; import Filter from './components/Filter'; import MapWidget from './components/MapWidget'; import ProjectInformation from './components/ProjectInformation'; import { MapServiceProvider, Sherlock } from './components/Sherlock'; -import { useSpecialTranslation } from './i18n'; import config from './services/config'; +import { useSpecialTranslation } from './services/i18n'; + +const queryClient = new QueryClient(); function App() { const [mapView, setMapView] = React.useState(null); @@ -140,33 +143,35 @@ function App() { }, [mapView]); return ( -
-
-

RTP Projects

-
-
- - - - - - - + +
+
+

RTP Projects

+
+
+ + + + + + + +
-
+ ); } diff --git a/src/bootstrap.scss b/src/bootstrap.scss index a9ac9da..57b846f 100644 --- a/src/bootstrap.scss +++ b/src/bootstrap.scss @@ -36,7 +36,7 @@ $nav-link-color: $gray-700; // @import '../node_modules/bootstrap/scss/breadcrumb'; // @import '../node_modules/bootstrap/scss/pagination'; // @import '../node_modules/bootstrap/scss/badge'; -// @import '../node_modules/bootstrap/scss/alert'; +@import '../node_modules/bootstrap/scss/alert'; // @import '../node_modules/bootstrap/scss/progress'; // @import '../node_modules/bootstrap/scss/list-group'; @import '../node_modules/bootstrap/scss/close'; diff --git a/src/components/Comments.jsx b/src/components/Comments.jsx new file mode 100644 index 0000000..789f166 --- /dev/null +++ b/src/components/Comments.jsx @@ -0,0 +1,184 @@ +import { faChevronDown, faChevronUp } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import ky from 'ky'; +import PropTypes from 'prop-types'; +import { useState } from 'react'; +import { Controller, useForm } from 'react-hook-form'; +import { useMutation, useQuery, useQueryClient } from 'react-query'; +import { Alert, Button, Collapse, Form, FormGroup, Input, Label } from 'reactstrap'; +import config from '../services/config'; +import { useSpecialTranslation } from '../services/i18n'; + +export default function Comments({ globalId }) { + const [isNewCommentFormOpen, setIsNewCommentFormOpen] = useState(false); + const [isPublicCommentsOpen, setIsPublicCommentsOpen] = useState(false); + + const clientId = `existing-comments-${globalId}`; + const fetchComments = async () => { + const response = await ky + .get(`${config.projectInformation.commentsTableUrl}/query`, { + searchParams: { + f: 'json', + where: `${config.projectInformation.fieldNames.guid} = '${globalId}'`, + outFields: '*', + orderByFields: `${config.projectInformation.fieldNames.commentDt} DESC`, + }, + }) + .json(); + + return response.features ?? []; + }; + + const existingCommentsQuery = useQuery([clientId], fetchComments); + + const t = useSpecialTranslation(); + + const { handleSubmit, formState, reset, control } = useForm({ mode: 'onChange' }); + const queryClient = useQueryClient(); + const submitComment = async (data) => { + await ky + .post(`${config.projectInformation.commentsTableUrl}/addFeatures`, { + searchParams: { + f: 'json', + features: JSON.stringify([ + { + attributes: { + ...data, + [config.projectInformation.fieldNames.guid]: globalId, + [config.projectInformation.fieldNames.commentDt]: new Date(), + }, + }, + ]), + }, + }) + .json(); + + queryClient.invalidateQueries([clientId]); + + reset(); + }; + const submitMutation = useMutation(submitComment, { retry: 3 }); + + const toggleNewCommentForm = () => { + setIsNewCommentFormOpen((current) => !current); + }; + const togglePublicComments = () => { + setIsPublicCommentsOpen((current) => !current); + }; + + return ( +
+
+ +
+ + +
submitMutation.mutate(data))}> + + + ( + + )} + rules={{ maxLength: 50 }} + defaultValue="" + /> + + + + ( + + )} + defaultValue="" + /> + + + + ( + + )} + defaultValue="" + /> + + + + ( + + )} + defaultValue="" + /> + + {submitMutation.isError ? ( + There was an error submitting your comment. Please try again later. + ) : null} +
+ {t('trans:comments.required')} +
+ + +
+
+
+
+ +
+ +
+ + + {existingCommentsQuery.isError ? There was an error loading the comments. : null} + {!existingCommentsQuery.isLoading && existingCommentsQuery.data?.length ? ( + existingCommentsQuery.data.map((comment) => ( + +

{comment.attributes[config.projectInformation.fieldNames.comment]}

+ + {new Date(comment.attributes[config.projectInformation.fieldNames.commentDt]).toLocaleString()} + +
+ )) + ) : ( + No comments yet. + )} +
+
+ ); +} + +Comments.propTypes = { + globalId: PropTypes.string.isRequired, +}; diff --git a/src/components/Comments.stories.jsx b/src/components/Comments.stories.jsx new file mode 100644 index 0000000..fafd795 --- /dev/null +++ b/src/components/Comments.stories.jsx @@ -0,0 +1,19 @@ +import { QueryClient, QueryClientProvider } from 'react-query'; +import Comments from './Comments'; + +export default { + component: Comments, + decorators: [ + (Story) => { + const queryClient = new QueryClient(); + return ( + + + + ); + }, + ], +}; + +export const Default = () => ; +export const ExistingComments = () => ; diff --git a/src/components/Details.jsx b/src/components/Details.jsx index b3932a5..ac9a6c2 100644 --- a/src/components/Details.jsx +++ b/src/components/Details.jsx @@ -3,12 +3,15 @@ import Feature from '@arcgis/core/widgets/Feature'; import PropTypes from 'prop-types'; import { useEffect, useRef, useState } from 'react'; import { Collapse } from 'reactstrap'; +import config from '../services/config'; +import Comments from './Comments'; import './Details.scss'; export default function Details({ graphic, highlightGraphic }) { const [collapsed, setCollapsed] = useState(true); const containerRef = useRef(); - const [title, setTitle] = useState(); + const [title, setTitle] = useState(null); + const [featureWidgetGraphic, setFeatureWidgetGraphic] = useState(null); const toggle = () => setCollapsed(!collapsed); @@ -29,6 +32,8 @@ export default function Details({ graphic, highlightGraphic }) { setTitle(feature.title); containerRef.current.appendChild(feature.container); + + setFeatureWidgetGraphic(feature.graphic); }; if (graphic) { @@ -50,11 +55,16 @@ export default function Details({ graphic, highlightGraphic }) {
+ {config.projectInformation.commentsEnabled && + featureWidgetGraphic && + Object.keys(featureWidgetGraphic.attributes).some( + (name) => name === config.projectInformation.fieldNames.globalId + ) && }
); } Details.propTypes = { graphic: PropTypes.object, - highlightGraphic: PropTypes.object, + highlightGraphic: PropTypes.func.isRequired, }; diff --git a/src/components/Details.stories.jsx b/src/components/Details.stories.jsx index 067d0d7..7d58dbe 100644 --- a/src/components/Details.stories.jsx +++ b/src/components/Details.stories.jsx @@ -1,7 +1,6 @@ import Details from './Details'; export default { - title: 'Details', component: Details, }; diff --git a/src/components/InfoPopup.stories.jsx b/src/components/InfoPopup.stories.jsx index bbefb10..ed2c721 100644 --- a/src/components/InfoPopup.stories.jsx +++ b/src/components/InfoPopup.stories.jsx @@ -1,7 +1,6 @@ import InfoPopup from './InfoPopup'; export default { - title: 'Info Popup', component: InfoPopup, }; diff --git a/src/components/MapWidget.jsx b/src/components/MapWidget.jsx index 27dfeb6..25a97ba 100644 --- a/src/components/MapWidget.jsx +++ b/src/components/MapWidget.jsx @@ -4,7 +4,7 @@ import 'perfect-scrollbar/css/perfect-scrollbar.css'; import PropTypes from 'prop-types'; import React, { createContext, useEffect, useRef, useState } from 'react'; import { Button, Card, CardHeader } from 'reactstrap'; -import { useSpecialTranslation } from '../i18n'; +import { useSpecialTranslation } from '../services/i18n'; import './MapWidget.scss'; export const MapWidgetContext = createContext(); diff --git a/src/components/MapWidget.stories.jsx b/src/components/MapWidget.stories.jsx index bded835..f0e2fd6 100644 --- a/src/components/MapWidget.stories.jsx +++ b/src/components/MapWidget.stories.jsx @@ -2,7 +2,6 @@ import { faHandPointer, faList } from '@fortawesome/free-solid-svg-icons'; import MapWidget from './MapWidget'; export default { - title: 'MapWidget', component: MapWidget, }; diff --git a/src/components/ProjectInformation.jsx b/src/components/ProjectInformation.jsx index 875f14e..b42cb71 100644 --- a/src/components/ProjectInformation.jsx +++ b/src/components/ProjectInformation.jsx @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import React from 'react'; import { Spinner } from 'reactstrap'; -import { useSpecialTranslation } from '../i18n'; +import { useSpecialTranslation } from '../services/i18n'; import Details from './Details'; import { MapWidgetContext } from './MapWidget'; import './ProjectInformation.scss'; @@ -29,7 +29,7 @@ export default function ProjectInformation({ graphics, showLoader, highlightGrap return (
- {graphics.length === 0 && !showLoader &&

{t('trans:projectInformationPrompt')}

} + {graphics.length === 0 && !showLoader &&

{t('trans:projectInformationPrompt')}

} {showLoader && (
diff --git a/src/components/ProjectInformation.scss b/src/components/ProjectInformation.scss index 76748ee..ad45520 100644 --- a/src/components/ProjectInformation.scss +++ b/src/components/ProjectInformation.scss @@ -1,14 +1,4 @@ .project-information { height: 100%; margin: -1.25rem; - p { - margin: 1.25rem; - } - .loader { - margin-top: 1.25rem; - height: 100%; - display: flex; - align-items: center; - justify-content: center; - } } diff --git a/src/i18n.js b/src/services/i18n.js similarity index 100% rename from src/i18n.js rename to src/services/i18n.js diff --git a/src/i18n.test.js b/src/services/i18n.test.js similarity index 100% rename from src/i18n.test.js rename to src/services/i18n.test.js