mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
Merge pull request #28 from utopia-os/lint-typescript
fix(other): lint typescript
This commit is contained in:
commit
17a70d687a
40
.eslintrc.js
40
.eslintrc.js
@ -7,7 +7,7 @@ module.exports = {
|
||||
'standard',
|
||||
'eslint:recommended',
|
||||
'plugin:@eslint-community/eslint-comments/recommended',
|
||||
// 'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
// 'plugin:import/recommended',
|
||||
// 'plugin:import/typescript',
|
||||
// 'plugin:promise/recommended',
|
||||
@ -20,7 +20,7 @@ module.exports = {
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: [
|
||||
// '@typescript-eslint',
|
||||
'@typescript-eslint',
|
||||
// 'import',
|
||||
// 'promise',
|
||||
// 'security',
|
||||
@ -139,24 +139,24 @@ module.exports = {
|
||||
{
|
||||
files: ['*.ts', '*.tsx'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
// parserOptions: {
|
||||
// tsconfigRootDir: __dirname,
|
||||
// project: ['./tsconfig.json', '**/tsconfig.json'],
|
||||
// ecmaVersion: 'latest',
|
||||
// parser: '@typescript-eslint/parser',
|
||||
// sourceType: 'module',
|
||||
// },
|
||||
// plugins: ['@typescript-eslint'],
|
||||
// extends: [
|
||||
// 'plugin:@typescript-eslint/recommended',
|
||||
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
// 'plugin:@typescript-eslint/strict',
|
||||
// ],
|
||||
// rules: {
|
||||
// // allow explicitly defined dangling promises
|
||||
// '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
||||
// 'no-void': ['error', { allowAsStatement: true }],
|
||||
// },
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: ['./tsconfig.json', '**/tsconfig.json'],
|
||||
ecmaVersion: 'latest',
|
||||
parser: '@typescript-eslint/parser',
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
||||
'plugin:@typescript-eslint/strict',
|
||||
],
|
||||
rules: {
|
||||
// allow explicitly defined dangling promises
|
||||
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
|
||||
'no-void': ['error', { allowAsStatement: true }],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['!*.json'],
|
||||
|
||||
159
package-lock.json
generated
159
package-lock.json
generated
@ -35,8 +35,8 @@
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@types/react-leaflet": "^2.8.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
||||
"@typescript-eslint/parser": "^5.38.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"daisyui": "^4.6.1",
|
||||
"eslint": "^8.24.0",
|
||||
@ -111,7 +111,6 @@
|
||||
"integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"eslint-visitor-keys": "^3.4.3"
|
||||
},
|
||||
@ -131,7 +130,6 @@
|
||||
"integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
|
||||
}
|
||||
@ -407,10 +405,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/json-schema": {
|
||||
"version": "7.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
|
||||
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
|
||||
"dev": true
|
||||
"version": "7.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
|
||||
"integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/json5": {
|
||||
"version": "0.0.29",
|
||||
@ -480,23 +479,33 @@
|
||||
"@types/react": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/semver": {
|
||||
"version": "7.5.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz",
|
||||
"integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/unist": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz",
|
||||
"integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ=="
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "5.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.38.1.tgz",
|
||||
"integrity": "sha512-ky7EFzPhqz3XlhS7vPOoMDaQnQMn+9o5ICR9CPr/6bw8HrFkzhMSxuA3gRfiJVvs7geYrSeawGJjZoZQKCOglQ==",
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz",
|
||||
"integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "5.38.1",
|
||||
"@typescript-eslint/type-utils": "5.38.1",
|
||||
"@typescript-eslint/utils": "5.38.1",
|
||||
"@eslint-community/regexpp": "^4.4.0",
|
||||
"@typescript-eslint/scope-manager": "5.62.0",
|
||||
"@typescript-eslint/type-utils": "5.62.0",
|
||||
"@typescript-eslint/utils": "5.62.0",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.2.0",
|
||||
"regexpp": "^3.2.0",
|
||||
"natural-compare-lite": "^1.4.0",
|
||||
"semver": "^7.3.7",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
@ -533,14 +542,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "5.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.38.1.tgz",
|
||||
"integrity": "sha512-LDqxZBVFFQnQRz9rUZJhLmox+Ep5kdUmLatLQnCRR6523YV+XhRjfYzStQ4MheFA8kMAfUlclHSbu+RKdRwQKw==",
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz",
|
||||
"integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "5.38.1",
|
||||
"@typescript-eslint/types": "5.38.1",
|
||||
"@typescript-eslint/typescript-estree": "5.38.1",
|
||||
"@typescript-eslint/scope-manager": "5.62.0",
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"@typescript-eslint/typescript-estree": "5.62.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@ -560,13 +570,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "5.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.1.tgz",
|
||||
"integrity": "sha512-BfRDq5RidVU3RbqApKmS7RFMtkyWMM50qWnDAkKgQiezRtLKsoyRKIvz1Ok5ilRWeD9IuHvaidaLxvGx/2eqTQ==",
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz",
|
||||
"integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.38.1",
|
||||
"@typescript-eslint/visitor-keys": "5.38.1"
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"@typescript-eslint/visitor-keys": "5.62.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@ -577,13 +588,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "5.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.38.1.tgz",
|
||||
"integrity": "sha512-UU3j43TM66gYtzo15ivK2ZFoDFKKP0k03MItzLdq0zV92CeGCXRfXlfQX5ILdd4/DSpHkSjIgLLLh1NtkOJOAw==",
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz",
|
||||
"integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "5.38.1",
|
||||
"@typescript-eslint/utils": "5.38.1",
|
||||
"@typescript-eslint/typescript-estree": "5.62.0",
|
||||
"@typescript-eslint/utils": "5.62.0",
|
||||
"debug": "^4.3.4",
|
||||
"tsutils": "^3.21.0"
|
||||
},
|
||||
@ -604,10 +616,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "5.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.1.tgz",
|
||||
"integrity": "sha512-QTW1iHq1Tffp9lNfbfPm4WJabbvpyaehQ0SrvVK2yfV79SytD9XDVxqiPvdrv2LK7DGSFo91TB2FgWanbJAZXg==",
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz",
|
||||
"integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
@ -617,13 +630,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "5.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.1.tgz",
|
||||
"integrity": "sha512-99b5e/Enoe8fKMLdSuwrfH/C0EIbpUWmeEKHmQlGZb8msY33qn1KlkFww0z26o5Omx7EVjzVDCWEfrfCDHfE7g==",
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz",
|
||||
"integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.38.1",
|
||||
"@typescript-eslint/visitor-keys": "5.38.1",
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"@typescript-eslint/visitor-keys": "5.62.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@ -644,13 +658,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
|
||||
"version": "7.5.4",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
||||
"version": "7.6.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
|
||||
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
},
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
@ -659,17 +671,20 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "5.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.38.1.tgz",
|
||||
"integrity": "sha512-oIuUiVxPBsndrN81oP8tXnFa/+EcZ03qLqPDfSZ5xIJVm7A9V0rlkQwwBOAGtrdN70ZKDlKv+l1BeT4eSFxwXA==",
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz",
|
||||
"integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@types/json-schema": "^7.0.9",
|
||||
"@typescript-eslint/scope-manager": "5.38.1",
|
||||
"@typescript-eslint/types": "5.38.1",
|
||||
"@typescript-eslint/typescript-estree": "5.38.1",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@typescript-eslint/scope-manager": "5.62.0",
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"@typescript-eslint/typescript-estree": "5.62.0",
|
||||
"eslint-scope": "^5.1.1",
|
||||
"eslint-utils": "^3.0.0"
|
||||
"semver": "^7.3.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@ -682,13 +697,27 @@
|
||||
"eslint": "^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "5.38.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.1.tgz",
|
||||
"integrity": "sha512-bSHr1rRxXt54+j2n4k54p4fj8AHJ49VDWtjpImOpzQj4qjAiOpPni+V1Tyajh19Api1i844F757cur8wH3YvOA==",
|
||||
"node_modules/@typescript-eslint/utils/node_modules/semver": {
|
||||
"version": "7.6.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
|
||||
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "5.62.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz",
|
||||
"integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "5.38.1",
|
||||
"@typescript-eslint/types": "5.62.0",
|
||||
"eslint-visitor-keys": "^3.3.0"
|
||||
},
|
||||
"engines": {
|
||||
@ -2443,6 +2472,7 @@
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"esrecurse": "^4.3.0",
|
||||
"estraverse": "^4.1.1"
|
||||
@ -2456,6 +2486,7 @@
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
|
||||
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
@ -3155,6 +3186,13 @@
|
||||
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/graphemer": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz",
|
||||
"integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/has-bigints": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz",
|
||||
@ -4677,6 +4715,13 @@
|
||||
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/natural-compare-lite": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz",
|
||||
"integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-releases": {
|
||||
"version": "2.0.10",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.10.tgz",
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@types/react-leaflet": "^2.8.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
||||
"@typescript-eslint/parser": "^5.38.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
||||
"@typescript-eslint/parser": "^5.62.0",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"daisyui": "^4.6.1",
|
||||
"eslint": "^8.24.0",
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
import * as React from 'react'
|
||||
|
||||
type ContentProps = {
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { ToastContainer } from 'react-toastify'
|
||||
import { QuestsProvider } from '../Gaming/hooks/useQuests'
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
import { useAuth } from '../Auth'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { useRef, useState, useEffect } from 'react'
|
||||
import { NavLink, useLocation } from 'react-router-dom'
|
||||
import { Sidenav, initTE } from 'tw-elements'
|
||||
@ -7,7 +14,6 @@ import * as React from 'react'
|
||||
|
||||
type route = {
|
||||
path: string
|
||||
// eslint-disable-next-line no-undef
|
||||
icon: JSX.Element
|
||||
name: string
|
||||
submenu?: route
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import ChevronDownIcon from '@heroicons/react/24/outline/ChevronDownIcon'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
@ -8,7 +12,6 @@ function SidebarSubmenu({
|
||||
icon,
|
||||
}: {
|
||||
path: string
|
||||
// eslint-disable-next-line no-undef
|
||||
icon: JSX.Element
|
||||
name: string
|
||||
submenu?: any | undefined
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useState, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
import { AssetsApi } from '../../../types'
|
||||
|
||||
type AppState = {
|
||||
interface AppState {
|
||||
assetsApi: AssetsApi
|
||||
userType: string
|
||||
}
|
||||
|
||||
41
src/Components/AppShell/hooks/useAssets.tsx
Normal file
41
src/Components/AppShell/hooks/useAssets.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useState, createContext, useContext } from 'react'
|
||||
|
||||
import * as React from 'react'
|
||||
import { AssetsApi } from '../../../types'
|
||||
|
||||
type UseAssetManagerResult = ReturnType<typeof useAssetsManager>
|
||||
|
||||
const AssetContext = createContext<UseAssetManagerResult>({
|
||||
api: {} as AssetsApi,
|
||||
setAssetsApi: () => {},
|
||||
})
|
||||
|
||||
function useAssetsManager(): {
|
||||
api: AssetsApi
|
||||
setAssetsApi: (api: AssetsApi) => void
|
||||
} {
|
||||
const [api, setApi] = useState<AssetsApi>({} as AssetsApi)
|
||||
|
||||
const setAssetsApi = useCallback((api: AssetsApi) => {
|
||||
setApi(api)
|
||||
}, [])
|
||||
|
||||
return { api, setAssetsApi }
|
||||
}
|
||||
|
||||
export const AssetsProvider: React.FunctionComponent<{
|
||||
children?: React.ReactNode
|
||||
}> = ({ children }) => (
|
||||
<AssetContext.Provider value={useAssetsManager()}>{children}</AssetContext.Provider>
|
||||
)
|
||||
|
||||
export const useAssetApi = (): AssetsApi => {
|
||||
const { api } = useContext(AssetContext)
|
||||
return api
|
||||
}
|
||||
|
||||
export const useSetAssetApi = (): UseAssetManagerResult['setAssetsApi'] => {
|
||||
const { setAssetsApi } = useContext(AssetContext)
|
||||
return setAssetsApi
|
||||
}
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link, useNavigate } from 'react-router-dom'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { toast } from 'react-toastify'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
|
||||
@ -1,19 +1,26 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { createContext, useState, useContext, useEffect } from 'react'
|
||||
import * as React from 'react'
|
||||
import { UserApi, UserItem } from '../../types'
|
||||
|
||||
type AuthProviderProps = {
|
||||
interface AuthProviderProps {
|
||||
userApi: UserApi
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
type AuthCredentials = {
|
||||
interface AuthCredentials {
|
||||
email: string
|
||||
password: string
|
||||
otp?: string | undefined
|
||||
}
|
||||
|
||||
type AuthContextProps = {
|
||||
interface AuthContextProps {
|
||||
isAuthenticated: boolean
|
||||
user: UserItem | null
|
||||
login: (credentials: AuthCredentials) => Promise<UserItem | undefined>
|
||||
@ -58,9 +65,9 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
||||
setToken(token)
|
||||
if (token) {
|
||||
const me = await userApi.getUser()
|
||||
setUser(me as UserItem)
|
||||
setUser(me)
|
||||
setLoading(false)
|
||||
return me as UserItem
|
||||
return me
|
||||
} else return undefined
|
||||
} catch (error) {
|
||||
setLoading(false)
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useQuestsOpen, useSetQuestOpen } from './hooks/useQuests'
|
||||
import { useAuth } from '../Auth'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useState, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import * as React from 'react'
|
||||
import { useEffect } from 'react'
|
||||
import { TagView } from '../Templates/TagView'
|
||||
@ -10,12 +17,12 @@ export const Autocomplete = ({
|
||||
setFocus,
|
||||
}: {
|
||||
inputProps: any
|
||||
suggestions: Array<any>
|
||||
suggestions: any[]
|
||||
onSelected: (suggestion) => void
|
||||
pushFilteredSuggestions?: Array<any>
|
||||
pushFilteredSuggestions?: any[]
|
||||
setFocus?: boolean
|
||||
}) => {
|
||||
const [filteredSuggestions, setFilteredSuggestions] = React.useState<Array<any>>([])
|
||||
const [filteredSuggestions, setFilteredSuggestions] = React.useState<any[]>([])
|
||||
const [heighlightedSuggestion, setHeighlightedSuggestion] = React.useState<number>(0)
|
||||
|
||||
useEffect(() => {
|
||||
@ -28,7 +35,6 @@ export const Autocomplete = ({
|
||||
|
||||
const inputRef = React.useRef<HTMLInputElement>()
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const getSuggestionValue = (suggestion) => suggestion.name
|
||||
|
||||
const getSuggestions = (value) => {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useState } from 'react'
|
||||
import InformationCircleIcon from '@heroicons/react/24/outline/InformationCircleIcon'
|
||||
import * as React from 'react'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
/* eslint-disable @typescript-eslint/consistent-indexed-object-style */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import * as React from 'react'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import Tribute from 'tributejs'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/consistent-type-definitions */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import { useEffect, useState } from 'react'
|
||||
import * as React from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { Marker, Tooltip, useMap, useMapEvents } from 'react-leaflet'
|
||||
import { Item, LayerProps, Tag } from '../../types'
|
||||
@ -171,7 +180,7 @@ export const Layer = ({
|
||||
}
|
||||
let title = ''
|
||||
if (item.name) title = item.name
|
||||
else if (item.layer?.itemNameField) title = getValue(item, item.layer.itemNameField)
|
||||
else if (item.layer.itemNameField) title = getValue(item, item.layer.itemNameField)
|
||||
document.title = `${document.title.split('-')[0]} - ${title}`
|
||||
}
|
||||
},
|
||||
@ -195,7 +204,7 @@ export const Layer = ({
|
||||
})
|
||||
let title = ''
|
||||
if (ref.item.name) title = ref.item.name
|
||||
else if (ref.item.layer?.itemNameField)
|
||||
else if (ref.item.layer.itemNameField)
|
||||
title = getValue(ref.item.name, ref.item.layer.itemNameField)
|
||||
document.title = `${document.title.split('-')[0]} - ${title}`
|
||||
document
|
||||
@ -233,7 +242,7 @@ export const Layer = ({
|
||||
{items &&
|
||||
items
|
||||
.filter((item) => item.layer?.name === name)
|
||||
?.filter((item) =>
|
||||
.filter((item) =>
|
||||
filterTags.length === 0
|
||||
? item
|
||||
: filterTags.some((tag) =>
|
||||
@ -243,7 +252,7 @@ export const Layer = ({
|
||||
),
|
||||
),
|
||||
)
|
||||
?.filter((item) => item.layer && isLayerVisible(item.layer))
|
||||
.filter((item) => item.layer && isLayerVisible(item.layer))
|
||||
.filter(
|
||||
(item) =>
|
||||
(item.group_type && isGroupTypeVisible(item.group_type)) ||
|
||||
@ -254,7 +263,7 @@ export const Layer = ({
|
||||
if (getValue(item, itemTextField)) item[itemTextField] = getValue(item, itemTextField)
|
||||
else item[itemTextField] = ''
|
||||
|
||||
if (item?.tags) {
|
||||
if (item.tags) {
|
||||
item[itemTextField] = item[itemTextField] + '\n\n'
|
||||
item.tags.map((tag) => {
|
||||
if (!item[itemTextField].includes(`#${encodeTag(tag)}`)) {
|
||||
@ -372,7 +381,7 @@ export const Layer = ({
|
||||
// {children}}
|
||||
}
|
||||
{itemFormPopup &&
|
||||
itemFormPopup.layer!.name === name &&
|
||||
itemFormPopup.layer.name === name &&
|
||||
(children &&
|
||||
React.Children.toArray(children).some(
|
||||
(child) => React.isValidElement(child) && child.props.__TYPE === 'ItemForm',
|
||||
@ -381,10 +390,10 @@ export const Layer = ({
|
||||
React.isValidElement(child) && child.props.__TYPE === 'ItemForm' ? (
|
||||
<ItemFormPopup
|
||||
key={setItemFormPopup?.name}
|
||||
position={itemFormPopup!.position}
|
||||
layer={itemFormPopup!.layer}
|
||||
position={itemFormPopup.position}
|
||||
layer={itemFormPopup.layer}
|
||||
setItemFormPopup={setItemFormPopup}
|
||||
item={itemFormPopup!.item}
|
||||
item={itemFormPopup.item}
|
||||
>
|
||||
{child}
|
||||
</ItemFormPopup>
|
||||
@ -395,10 +404,10 @@ export const Layer = ({
|
||||
) : (
|
||||
<>
|
||||
<ItemFormPopup
|
||||
position={itemFormPopup!.position}
|
||||
layer={itemFormPopup!.layer}
|
||||
position={itemFormPopup.position}
|
||||
layer={itemFormPopup.layer}
|
||||
setItemFormPopup={setItemFormPopup}
|
||||
item={itemFormPopup!.item}
|
||||
item={itemFormPopup.item}
|
||||
/>
|
||||
</>
|
||||
))}
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import * as React from 'react'
|
||||
import { useLayers } from '../hooks/useLayers'
|
||||
import { useHasUserPermission } from '../hooks/usePermissions'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as L from 'leaflet'
|
||||
import * as React from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/prefer-ts-expect-error */
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as L from 'leaflet'
|
||||
import { useMap, useMapEvents } from 'react-leaflet'
|
||||
import 'leaflet.locatecontrol'
|
||||
|
||||
@ -1,3 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
import { useAddFilterTag } from '../../hooks/useFilter'
|
||||
import useWindowDimensions from '../../hooks/useWindowDimension'
|
||||
@ -23,9 +35,9 @@ export const SearchControl = () => {
|
||||
const [popupOpen, setPopupOpen] = useState(false)
|
||||
|
||||
const [value, setValue] = useState('')
|
||||
const [geoResults, setGeoResults] = useState<Array<any>>([])
|
||||
const [tagsResults, setTagsResults] = useState<Array<any>>([])
|
||||
const [itemsResults, setItemsResults] = useState<Array<Item>>([])
|
||||
const [geoResults, setGeoResults] = useState<any[]>([])
|
||||
const [tagsResults, setTagsResults] = useState<any[]>([])
|
||||
const [itemsResults, setItemsResults] = useState<Item[]>([])
|
||||
const [hideSuggestions, setHideSuggestions] = useState(true)
|
||||
|
||||
const map = useMap()
|
||||
@ -62,14 +74,14 @@ export const SearchControl = () => {
|
||||
if (item.layer?.itemTextField) item.text = getValue(item, item.layer.itemTextField)
|
||||
return (
|
||||
value.length > 2 &&
|
||||
((item.layer?.listed && item.name?.toLowerCase().includes(value.toLowerCase())) ||
|
||||
item.text?.toLowerCase().includes(value.toLowerCase()))
|
||||
((item.layer?.listed && item.name.toLowerCase().includes(value.toLowerCase())) ||
|
||||
item.text.toLowerCase().includes(value.toLowerCase()))
|
||||
)
|
||||
}),
|
||||
)
|
||||
let phrase = value
|
||||
if (value.startsWith('#')) phrase = value.substring(1)
|
||||
setTagsResults(tags.filter((tag) => tag.name?.toLowerCase().includes(phrase.toLowerCase())))
|
||||
setTagsResults(tags.filter((tag) => tag.name.toLowerCase().includes(phrase.toLowerCase())))
|
||||
},
|
||||
500,
|
||||
[value],
|
||||
|
||||
@ -17,7 +17,7 @@ export const TagsControl = () => {
|
||||
<div className='tw-card-actions tw-justify-end'>
|
||||
<label
|
||||
className='tw-btn tw-btn-xs tw-btn-circle tw-absolute tw--right-2 tw--top-2 tw-bg-white tw-text-gray-600'
|
||||
onClick={() => removeFilterTag(tag.name!)}
|
||||
onClick={() => removeFilterTag(tag.name)}
|
||||
>
|
||||
✕
|
||||
</label>
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { LatLng } from 'leaflet'
|
||||
import { Popup as LeafletPopup, useMap } from 'react-leaflet'
|
||||
@ -24,7 +33,6 @@ export interface ItemFormPopupProps {
|
||||
export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
const [spinner, setSpinner] = useState(false)
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [popupTitle, setPopupTitle] = useState<string>('')
|
||||
|
||||
const formRef = useRef<HTMLFormElement>(null)
|
||||
@ -34,7 +42,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
const addItem = useAddItem()
|
||||
const updateItem = useUpdateItem()
|
||||
const items = useItems()
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
||||
const removeItem = useRemoveItem()
|
||||
|
||||
const tags = useTags()
|
||||
@ -93,7 +101,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
||||
try {
|
||||
props.layer.onlyOnePerOwner &&
|
||||
item &&
|
||||
(await props.layer.api?.updateItem!({ ...formItem, id: item?.id }))
|
||||
(await props.layer.api?.updateItem!({ ...formItem, id: item.id }))
|
||||
;(!props.layer.onlyOnePerOwner || !item) &&
|
||||
(await props.layer.api?.createItem!({
|
||||
...formItem,
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import * as React from 'react'
|
||||
import { Item, ItemsApi } from '../../../../types'
|
||||
import { useHasUserPermission } from '../../hooks/usePermissions'
|
||||
@ -56,10 +67,10 @@ export function HeaderView({
|
||||
`${big ? '?width=160&heigth=160' : '?width=80&heigth=80'}`
|
||||
const title = itemNameField
|
||||
? getValue(item, itemNameField)
|
||||
: item.layer?.itemNameField && item && getValue(item, item.layer?.itemNameField)
|
||||
: item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField)
|
||||
const subtitle = itemSubnameField
|
||||
? getValue(item, itemSubnameField)
|
||||
: item.layer?.itemSubnameField && item && getValue(item, item.layer?.itemSubnameField)
|
||||
: item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField)
|
||||
|
||||
const [address] = React.useState<string>('')
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Link } from 'react-router-dom'
|
||||
import { getValue } from '../../../../Utils/GetValue'
|
||||
import { Item } from '../../../../types'
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
import * as React from 'react'
|
||||
import { TextInput } from '../../../Input'
|
||||
import { Item } from '../../../../types'
|
||||
|
||||
type StartEndInputProps = {
|
||||
interface StartEndInputProps {
|
||||
item?: Item
|
||||
showLabels?: boolean
|
||||
updateStartValue?: (value: string) => void
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
import * as React from 'react'
|
||||
import { Item } from '../../../../types'
|
||||
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { Item } from '../../../../types'
|
||||
import { useTags } from '../../hooks/useTags'
|
||||
import { useAddFilterTag } from '../../hooks/useFilter'
|
||||
@ -31,7 +40,7 @@ export const TextView = ({
|
||||
} else if (itemTextField && item) {
|
||||
text = getValue(item, itemTextField)
|
||||
} else {
|
||||
text = item?.layer?.itemTextField && item ? getValue(item, item.layer?.itemTextField) : ''
|
||||
text = item?.layer?.itemTextField && item ? getValue(item, item.layer.itemTextField) : ''
|
||||
}
|
||||
|
||||
if (item && text && truncate) text = truncateText(removeMarkdownKeepLinksAndParagraphs(text), 100)
|
||||
@ -106,10 +115,10 @@ export const TextView = ({
|
||||
return (
|
||||
<a
|
||||
style={{ color: tag ? tag.color : '#faa', fontWeight: 'bold', cursor: 'pointer' }}
|
||||
key={tag ? tag.name + item!.id : item.id}
|
||||
key={tag ? tag.name + item.id : item.id}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
addFilterTag(tag!)
|
||||
addFilterTag(tag)
|
||||
}}
|
||||
>
|
||||
{decodeTag(children)}
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { Popup as LeafletPopup, useMap } from 'react-leaflet'
|
||||
import { Item } from '../../../types'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
export const SelectPosition = ({ setSelectNewItemPosition }: { setSelectNewItemPosition }) => {
|
||||
return (
|
||||
<div className='tw-animate-pulseGrow tw-button tw-z-1000 tw-absolute tw-right-5 tw-top-4 tw-drop-shadow-md'>
|
||||
|
||||
@ -27,16 +27,16 @@ export function Tags({ data, api }: { data?: Tag[]; api?: ItemsApi<Tag> }) {
|
||||
const decodedTags = urlTags ? decodeURIComponent(urlTags) : ''
|
||||
const decodedTagsArray = decodedTags.split(';')
|
||||
if (
|
||||
decodedTagsArray?.some(
|
||||
decodedTagsArray.some(
|
||||
(ut) => !filterTags.find((ft) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()),
|
||||
) ||
|
||||
filterTags?.some(
|
||||
filterTags.some(
|
||||
(ft) =>
|
||||
!decodedTagsArray?.find((ut) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()),
|
||||
!decodedTagsArray.find((ut) => ut.toLocaleLowerCase() === ft.name.toLocaleLowerCase()),
|
||||
)
|
||||
) {
|
||||
resetFilterTags()
|
||||
decodedTagsArray?.map((urlTag) => {
|
||||
decodedTagsArray.map((urlTag) => {
|
||||
const tag = tags.find((t) => t.name.toLocaleLowerCase() === urlTag.toLocaleLowerCase())
|
||||
tag && addFilterTag(tag)
|
||||
return null
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { TileLayer, MapContainer, useMapEvents, GeoJSON } from 'react-leaflet'
|
||||
import 'leaflet/dist/leaflet.css'
|
||||
import * as React from 'react'
|
||||
@ -99,7 +107,6 @@ export function UtopiaMapInner({
|
||||
)
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const onEachFeature = (feature: Feature<GeoJSONGeometry, any>, layer: L.Layer) => {
|
||||
if (feature.properties) {
|
||||
layer.bindPopup(feature.properties.name)
|
||||
@ -157,7 +164,7 @@ export function UtopiaMapInner({
|
||||
eventHandlers={{
|
||||
click: (e) => {
|
||||
if (selectNewItemPosition) {
|
||||
e.layer!.closePopup()
|
||||
e.layer.closePopup()
|
||||
setMapClicked({ position: e.latlng, setItemFormPopup })
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import * as React from 'react'
|
||||
import { createContext, useContext, useState } from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { useEffect } from 'react'
|
||||
import { useTimeout } from './useTimeout'
|
||||
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable no-case-declarations */
|
||||
import { useCallback, useReducer, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
@ -121,7 +125,7 @@ function useFilterManager(initialTags: Tag[]): {
|
||||
const urlTags = params.get('tags')
|
||||
const decodedTags = urlTags ? decodeURIComponent(urlTags) : ''
|
||||
|
||||
if (!decodedTags?.includes(tag.name)) {
|
||||
if (!decodedTags.includes(tag.name)) {
|
||||
params.set('tags', `${urlTags || ''}${urlTags ? ';' : ''}${tag.name}`)
|
||||
}
|
||||
if (windowDimensions.width < 786 && location.pathname.split('/').length > 2)
|
||||
@ -141,7 +145,7 @@ function useFilterManager(initialTags: Tag[]): {
|
||||
const urlTags = params.get('tags')
|
||||
let newUrlTags = ''
|
||||
const tags = urlTags?.split(';')
|
||||
if (tags?.length === 0 && urlTags?.length && urlTags?.length > 0) tags[0] = urlTags
|
||||
if (tags?.length === 0 && urlTags?.length && urlTags.length > 0) tags[0] = urlTags
|
||||
tags?.map((urlTag) => {
|
||||
if (!(urlTag.toLocaleLowerCase() === name.toLocaleLowerCase())) {
|
||||
newUrlTags = newUrlTags + `${newUrlTags === '' ? urlTag : `;${urlTag}`}`
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
import { useCallback, useReducer, createContext, useContext, useState } from 'react'
|
||||
import * as React from 'react'
|
||||
import { Item, LayerProps } from '../../../types'
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useReducer, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
import { LayerProps } from '../../../types'
|
||||
|
||||
type ActionType = { type: 'ADD LAYER'; layer: LayerProps }
|
||||
interface ActionType {
|
||||
type: 'ADD LAYER'
|
||||
layer: LayerProps
|
||||
}
|
||||
|
||||
type UseItemManagerResult = ReturnType<typeof useLayerManager>
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/ban-types */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
import { useCallback, useReducer, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
import { Item } from '../../../types'
|
||||
import { Marker, Popup } from 'leaflet'
|
||||
|
||||
type LeafletRef = {
|
||||
interface LeafletRef {
|
||||
item: Item
|
||||
marker: Marker
|
||||
popup: Popup
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { useCallback, useReducer, createContext, useContext } from 'react'
|
||||
import * as React from 'react'
|
||||
import { Item, ItemsApi, LayerProps, Permission, PermissionAction } from '../../../types'
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/await-thenable */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import * as React from 'react'
|
||||
import { createContext, useContext, useEffect, useState } from 'react'
|
||||
import { Geometry, Item, LayerProps } from '../../../types'
|
||||
@ -7,7 +16,7 @@ import { useHasUserPermission } from './usePermissions'
|
||||
import { LatLng } from 'leaflet'
|
||||
import { ItemFormPopupProps } from '../Subcomponents/ItemFormPopup'
|
||||
|
||||
type PolygonClickedProps = {
|
||||
interface PolygonClickedProps {
|
||||
position: LatLng
|
||||
setItemFormPopup: React.Dispatch<React.SetStateAction<ItemFormPopupProps | null>>
|
||||
}
|
||||
@ -51,15 +60,14 @@ function useSelectPositionManager(): {
|
||||
mapClicked &&
|
||||
mapClicked.setItemFormPopup({
|
||||
layer: selectPosition as LayerProps,
|
||||
position: mapClicked?.position,
|
||||
position: mapClicked.position,
|
||||
})
|
||||
setSelectPosition(null)
|
||||
}
|
||||
if ('text' in selectPosition) {
|
||||
const position =
|
||||
mapClicked?.position.lng &&
|
||||
new Geometry(mapClicked?.position.lng, mapClicked?.position.lat)
|
||||
position && itemUpdatePosition({ ...(selectPosition as Item), position })
|
||||
mapClicked?.position.lng && new Geometry(mapClicked.position.lng, mapClicked.position.lat)
|
||||
position && itemUpdatePosition({ ...selectPosition, position })
|
||||
setSelectPosition(null)
|
||||
}
|
||||
}
|
||||
@ -70,11 +78,11 @@ function useSelectPositionManager(): {
|
||||
const itemUpdateParent = async (updatedItem: Item) => {
|
||||
if (
|
||||
markerClicked?.layer?.api?.collectionName &&
|
||||
hasUserPermission(markerClicked?.layer?.api?.collectionName, 'update', markerClicked)
|
||||
hasUserPermission(markerClicked.layer.api.collectionName, 'update', markerClicked)
|
||||
) {
|
||||
let success = false
|
||||
try {
|
||||
await updatedItem?.layer?.api?.updateItem!({
|
||||
await updatedItem.layer?.api?.updateItem!({
|
||||
id: updatedItem.id,
|
||||
parent: updatedItem.parent,
|
||||
position: null,
|
||||
@ -99,7 +107,7 @@ function useSelectPositionManager(): {
|
||||
const itemUpdatePosition = async (updatedItem: Item) => {
|
||||
let success = false
|
||||
try {
|
||||
await updatedItem?.layer?.api?.updateItem!({
|
||||
await updatedItem.layer?.api?.updateItem!({
|
||||
id: updatedItem.id,
|
||||
position: updatedItem.position,
|
||||
})
|
||||
@ -118,12 +126,12 @@ function useSelectPositionManager(): {
|
||||
const newRelations = markerClicked.relations || []
|
||||
|
||||
if (!newRelations.some((r) => r.related_items_id === id)) {
|
||||
newRelations?.push({ items_id: markerClicked.id, related_items_id: id })
|
||||
newRelations.push({ items_id: markerClicked.id, related_items_id: id })
|
||||
const updatedItem = { id: markerClicked.id, relations: newRelations }
|
||||
|
||||
let success = false
|
||||
try {
|
||||
await markerClicked?.layer?.api?.updateItem!(updatedItem)
|
||||
await markerClicked.layer?.api?.updateItem!(updatedItem)
|
||||
success = true
|
||||
} catch (error) {
|
||||
toast.error(error.toString())
|
||||
|
||||
@ -1,3 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useCallback, useReducer, createContext, useContext, useState } from 'react'
|
||||
import * as React from 'react'
|
||||
import { Item, ItemsApi, Tag } from '../../../types'
|
||||
@ -77,14 +87,14 @@ function useTagsManager(initialTags: Tag[]): {
|
||||
tag,
|
||||
})
|
||||
if (!tags.some((t) => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())) {
|
||||
api?.createItem && api.createItem(tag)
|
||||
api.createItem && api.createItem(tag)
|
||||
}
|
||||
}
|
||||
|
||||
const getItemTags = useCallback(
|
||||
(item: Item) => {
|
||||
const text =
|
||||
item?.layer?.itemTextField && item ? getValue(item, item.layer?.itemTextField) : undefined
|
||||
item.layer?.itemTextField && item ? getValue(item, item.layer.itemTextField) : undefined
|
||||
const itemTagStrings = text?.match(hashTagRegex)
|
||||
const itemTags: Tag[] = []
|
||||
itemTagStrings?.map((tag) => {
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { useCallback, useEffect, useRef } from 'react'
|
||||
|
||||
export const useTimeout = (callback, delay) => {
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { useMap } from 'react-leaflet'
|
||||
|
||||
export const setItemLocation = () => {
|
||||
// eslint-disable-next-line no-unused-vars, react-hooks/rules-of-hooks
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
const map = useMap()
|
||||
|
||||
return <div></div>
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { useItems, useUpdateItem, useAddItem } from '../Map/hooks/useItems'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { getValue } from '../../Utils/GetValue'
|
||||
@ -81,25 +88,25 @@ export function ProfileForm() {
|
||||
|
||||
useEffect(() => {
|
||||
const newColor =
|
||||
item.layer?.itemColorField && getValue(item, item.layer?.itemColorField)
|
||||
? getValue(item, item.layer?.itemColorField)
|
||||
item.layer?.itemColorField && getValue(item, item.layer.itemColorField)
|
||||
? getValue(item, item.layer.itemColorField)
|
||||
: getItemTags(item) && getItemTags(item)[0]?.color
|
||||
? getItemTags(item)[0].color
|
||||
: item?.layer?.markerDefaultColor
|
||||
: item.layer?.markerDefaultColor
|
||||
|
||||
const offers = (item?.offers ?? []).reduce((acc: Tag[], o) => {
|
||||
const offers = (item.offers ?? []).reduce((acc: Tag[], o) => {
|
||||
const offer = tags.find((t) => t.id === o.tags_id)
|
||||
if (offer) acc.push(offer)
|
||||
return acc
|
||||
}, [])
|
||||
|
||||
const needs = (item?.needs ?? []).reduce((acc: Tag[], o) => {
|
||||
const needs = (item.needs ?? []).reduce((acc: Tag[], o) => {
|
||||
const need = tags.find((t) => t.id === o.tags_id)
|
||||
if (need) acc.push(need)
|
||||
return acc
|
||||
}, [])
|
||||
|
||||
const relations = (item?.relations ?? []).reduce((acc: Item[], r) => {
|
||||
const relations = (item.relations ?? []).reduce((acc: Item[], r) => {
|
||||
const relatedItem = items.find((i) => i.id === r.related_items_id)
|
||||
if (relatedItem) acc.push(relatedItem)
|
||||
return acc
|
||||
@ -121,8 +128,8 @@ export function ProfileForm() {
|
||||
offers,
|
||||
needs,
|
||||
relations,
|
||||
start: item?.start ?? '',
|
||||
end: item?.end ?? '',
|
||||
start: item.start ?? '',
|
||||
end: item.end ?? '',
|
||||
})
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [item, tags, items])
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/await-thenable */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { MapOverlayPage } from '../Templates'
|
||||
import { useItems, useRemoveItem, useUpdateItem } from '../Map/hooks/useItems'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
@ -22,9 +31,9 @@ import { useAppState } from '../AppShell/hooks/useAppState'
|
||||
export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any> }) {
|
||||
const [item, setItem] = useState<Item>()
|
||||
const [updatePermission, setUpdatePermission] = useState<boolean>(false)
|
||||
const [relations, setRelations] = useState<Array<Item>>([])
|
||||
const [offers, setOffers] = useState<Array<Tag>>([])
|
||||
const [needs, setNeeds] = useState<Array<Tag>>([])
|
||||
const [relations, setRelations] = useState<Item[]>([])
|
||||
const [offers, setOffers] = useState<Tag[]>([])
|
||||
const [needs, setNeeds] = useState<Tag[]>([])
|
||||
const [loading, setLoading] = useState<boolean>(false)
|
||||
const [template, setTemplate] = useState<string>('')
|
||||
|
||||
@ -42,7 +51,7 @@ export function ProfileView({ attestationApi }: { attestationApi?: ItemsApi<any>
|
||||
const leafletRefs = useLeafletRefs()
|
||||
const appState = useAppState()
|
||||
|
||||
const [attestations, setAttestations] = useState<Array<any>>([])
|
||||
const [attestations, setAttestations] = useState<any[]>([])
|
||||
|
||||
useEffect(() => {
|
||||
if (attestationApi) {
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { useState } from 'react'
|
||||
import { useHasUserPermission } from '../../Map/hooks/usePermissions'
|
||||
import DialogModal from '../../Templates/DialogModal'
|
||||
@ -52,7 +56,7 @@ export function ActionButton({
|
||||
setModalOpen(true)
|
||||
}}
|
||||
style={{
|
||||
backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor}`,
|
||||
backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`,
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
@ -76,7 +80,7 @@ export function ActionButton({
|
||||
triggerAddButton()
|
||||
}}
|
||||
style={{
|
||||
backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item?.layer?.markerDefaultColor}`,
|
||||
backgroundColor: `${colorField && getValue(item, colorField) ? getValue(item, colorField) : getItemTags(item) && getItemTags(item)[0] && getItemTags(item)[0].color ? getItemTags(item)[0].color : item.layer?.markerDefaultColor}`,
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
import * as React from 'react'
|
||||
import { useState, useCallback, useRef } from 'react'
|
||||
import ReactCrop, { Crop, centerCrop, makeAspectCrop } from 'react-image-crop'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import * as React from 'react'
|
||||
import { HexColorPicker } from 'react-colorful'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import * as React from 'react'
|
||||
import { TextInput } from '../../Input'
|
||||
import { FormState } from '../Templates/OnepagerForm'
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
import { Link } from 'react-router-dom'
|
||||
import { useAppState } from '../../AppShell/hooks/useAppState'
|
||||
import { Item } from '../../../types'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable react/prop-types */
|
||||
import { TextInput } from '../../Input'
|
||||
import { AvatarWidget } from './AvatarWidget'
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import * as React from 'react'
|
||||
import ComboBoxInput from '../../Input/ComboBoxInput'
|
||||
import { Item } from '../../../types'
|
||||
import { useEffect } from 'react'
|
||||
import { FormState } from '../Templates/OnepagerForm'
|
||||
|
||||
type groupType = {
|
||||
interface groupType {
|
||||
groupTypes_id: {
|
||||
name: string
|
||||
color: string
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { useEffect } from 'react'
|
||||
import { getValue } from '../../../Utils/GetValue'
|
||||
import { Item } from '../../../types'
|
||||
@ -31,10 +38,10 @@ export function LinkedItemsHeaderView({
|
||||
appState.assetsApi.url + getValue(item, item.layer?.itemAvatarField)
|
||||
const title = itemNameField
|
||||
? getValue(item, itemNameField)
|
||||
: item.layer?.itemNameField && item && getValue(item, item.layer?.itemNameField)
|
||||
: item.layer?.itemNameField && item && getValue(item, item.layer.itemNameField)
|
||||
const subtitle = itemSubnameField
|
||||
? getValue(item, itemSubnameField)
|
||||
: item.layer?.itemSubnameField && item && getValue(item, item.layer?.itemSubnameField)
|
||||
: item.layer?.itemSubnameField && item && getValue(item, item.layer.itemSubnameField)
|
||||
|
||||
useEffect(() => {}, [item])
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { LayerProps } from '../../../types'
|
||||
import { useHasUserPermission } from '../../Map/hooks/usePermissions'
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import * as React from 'react'
|
||||
import { PopupStartEndInput } from '../../Map'
|
||||
import { Item } from '../../../types'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import * as React from 'react'
|
||||
import { TextAreaInput } from '../../Input'
|
||||
import { FormState } from '../Templates/OnepagerForm'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { Item } from '../../../types'
|
||||
import { getValue } from '../../../Utils/GetValue'
|
||||
import { TextView } from '../../Map'
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const RelationCard = ({ title, description, imageSrc }) => (
|
||||
<div className={`tw-mb-6 ${imageSrc ? 'md:tw-flex md:tw-space-x-4' : ''}`}>
|
||||
|
||||
@ -2,12 +2,13 @@ import { toast } from 'react-toastify'
|
||||
import SocialShareButton from './SocialShareButton'
|
||||
|
||||
const SocialShareBar = ({
|
||||
// eslint-disable-next-line react/prop-types
|
||||
url,
|
||||
// eslint-disable-next-line react/prop-types
|
||||
title,
|
||||
// eslint-disable-next-line react/prop-types
|
||||
platforms = ['facebook', 'twitter', 'linkedin', 'xing', 'email'],
|
||||
}: {
|
||||
url: string
|
||||
title: string
|
||||
platforms?: string[]
|
||||
}) => {
|
||||
const copyLink = () => {
|
||||
navigator.clipboard
|
||||
@ -15,7 +16,7 @@ const SocialShareBar = ({
|
||||
.then(() => {
|
||||
toast.success('link copied to clipboard')
|
||||
})
|
||||
.catch((error) => {
|
||||
.catch((error: never) => {
|
||||
toast.error('Fehler beim Kopieren des Links: ', error)
|
||||
})
|
||||
}
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
|
||||
const platformConfigs = {
|
||||
@ -70,8 +74,15 @@ const platformConfigs = {
|
||||
},
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const SocialShareButton = ({ platform, url, title }) => {
|
||||
const SocialShareButton = ({
|
||||
platform,
|
||||
url,
|
||||
title,
|
||||
}: {
|
||||
platform: string
|
||||
url: string
|
||||
title: string
|
||||
}) => {
|
||||
const config = platformConfigs[platform]
|
||||
|
||||
if (!config) {
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useTags } from '../../Map/hooks/useTags'
|
||||
@ -11,10 +17,10 @@ export const TagsWidget = ({ placeholder, containerStyle, defaultTags, onUpdate
|
||||
const [input, setInput] = useState('')
|
||||
const [isKeyReleased, setIsKeyReleased] = useState(false)
|
||||
const tags = useTags()
|
||||
const [pushFilteredSuggestions, setPushFilteredSuggestions] = useState<Array<any>>([])
|
||||
const [pushFilteredSuggestions, setPushFilteredSuggestions] = useState<any[]>([])
|
||||
|
||||
const [focusInput, setFocusInput] = useState<boolean>(false)
|
||||
const [currentTags, setCurrentTags] = useState<Array<Tag>>(defaultTags)
|
||||
const [currentTags, setCurrentTags] = useState<Tag[]>(defaultTags)
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentTags(defaultTags)
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import * as React from 'react'
|
||||
import { Item } from '../../../types'
|
||||
import { FormState } from './OnepagerForm'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { GroupSubHeaderView } from '../Subcomponents/GroupSubHeaderView'
|
||||
import { ProfileTextView } from '../Subcomponents/ProfileTextView'
|
||||
import { ContactInfoView } from '../Subcomponents/ContactInfoView'
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import * as React from 'react'
|
||||
import { Item, Tag } from '../../../types'
|
||||
import { TextAreaInput } from '../../Input'
|
||||
import { GroupSubheaderForm } from '../Subcomponents/GroupSubheaderForm'
|
||||
import { ContactInfoForm } from '../Subcomponents/ContactInfoForm'
|
||||
|
||||
export type FormState = {
|
||||
export interface FormState {
|
||||
color: string
|
||||
id: string
|
||||
group_type: string
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { Item } from '../../../types'
|
||||
import { TextView } from '../../Map'
|
||||
import { ContactInfoView } from '../Subcomponents/ContactInfoView'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { TextAreaInput } from '../../Input'
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable react/prop-types */
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import { TextAreaInput } from '../../Input'
|
||||
|
||||
@ -1,3 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { StartEndView, TextView } from '../../Map'
|
||||
import { TagView } from '../../Templates/TagView'
|
||||
import { LinkedItemsHeaderView } from '../Subcomponents/LinkedItemsHeaderView'
|
||||
@ -21,11 +29,11 @@ export const TabsView = ({
|
||||
linkItem,
|
||||
unlinkItem,
|
||||
}: {
|
||||
attestations: Array<any>
|
||||
attestations: any[]
|
||||
item: Item
|
||||
offers: Array<Tag>
|
||||
needs: Array<Tag>
|
||||
relations: Array<Item>
|
||||
offers: Tag[]
|
||||
needs: Tag[]
|
||||
relations: Item[]
|
||||
updatePermission: boolean
|
||||
loading: boolean
|
||||
linkItem: (id: string) => Promise<void>
|
||||
@ -110,7 +118,7 @@ export const TabsView = ({
|
||||
className={
|
||||
'tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]'
|
||||
}
|
||||
aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Credibility'}`}
|
||||
aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 2 ? '❤️' : '❤️\u00A0Credibility'}`}
|
||||
checked={activeTab === 2 && true}
|
||||
onChange={() => updateActiveTab(2)}
|
||||
/>
|
||||
@ -178,8 +186,8 @@ export const TabsView = ({
|
||||
type='radio'
|
||||
name='my_tabs_2'
|
||||
role='tab'
|
||||
className={`tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 ${!(item.layer?.itemType.icon_as_labels && activeTab !== 3) && 'tw-min-w-[10.4em]'} [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]`}
|
||||
aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 3 ? '♻️' : '♻️\u00A0Offers & Needs'}`}
|
||||
className={`tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 ${!(item.layer.itemType.icon_as_labels && activeTab !== 3) && 'tw-min-w-[10.4em]'} [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]`}
|
||||
aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 3 ? '♻️' : '♻️\u00A0Offers & Needs'}`}
|
||||
checked={activeTab === 3 && true}
|
||||
onChange={() => updateActiveTab(3)}
|
||||
/>
|
||||
@ -195,7 +203,7 @@ export const TabsView = ({
|
||||
<div className='tw-flex tw-flex-wrap tw-mb-4'>
|
||||
{offers.map((o) => (
|
||||
<TagView
|
||||
key={o?.id}
|
||||
key={o.id}
|
||||
tag={o}
|
||||
onClick={() => {
|
||||
addFilterTag(o)
|
||||
@ -212,7 +220,7 @@ export const TabsView = ({
|
||||
<h3 className='-tw-mb-2 tw-col-span-1'>Needs</h3>
|
||||
<div className='tw-flex tw-flex-wrap tw-mb-4'>
|
||||
{needs.map((n) => (
|
||||
<TagView key={n?.id} tag={n} onClick={() => addFilterTag(n)} />
|
||||
<TagView key={n.id} tag={n} onClick={() => addFilterTag(n)} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
@ -232,7 +240,7 @@ export const TabsView = ({
|
||||
name='my_tabs_2'
|
||||
role='tab'
|
||||
className='tw-tab tw-font-bold !tw-ps-2 !tw-pe-2 [--tab-border-color:var(--fallback-bc,oklch(var(--bc)/0.2))]'
|
||||
aria-label={`${item.layer?.itemType.icon_as_labels && activeTab !== 7 ? '🔗' : '🔗\u00A0Relations'}`}
|
||||
aria-label={`${item.layer.itemType.icon_as_labels && activeTab !== 7 ? '🔗' : '🔗\u00A0Relations'}`}
|
||||
checked={activeTab === 7 && true}
|
||||
onChange={() => updateActiveTab(7)}
|
||||
/>
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as React from 'react'
|
||||
import { MapOverlayPage } from '../Templates'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { useEffect } from 'react'
|
||||
|
||||
// Improved version of https://usehooks.com/useOnClickOutside/
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { Item } from '../../types'
|
||||
import { encodeTag } from '../../Utils/FormatTags'
|
||||
@ -140,7 +151,7 @@ export const onUpdateItem = async (
|
||||
) => {
|
||||
let changedItem = {} as Item
|
||||
|
||||
const offerUpdates: Array<any> = []
|
||||
const offerUpdates: any[] = []
|
||||
// check for new offers
|
||||
await state.offers?.map((o) => {
|
||||
const existingOffer = item?.offers?.find((t) => t.tags_id === o.id)
|
||||
@ -150,7 +161,7 @@ export const onUpdateItem = async (
|
||||
return null
|
||||
})
|
||||
|
||||
const needsUpdates: Array<any> = []
|
||||
const needsUpdates: any[] = []
|
||||
|
||||
await state.needs?.map((n) => {
|
||||
const existingNeed = item?.needs?.find((t) => t.tags_id === n.id)
|
||||
@ -181,8 +192,8 @@ export const onUpdateItem = async (
|
||||
...(state.needs.length > 0 && { needs: needsUpdates }),
|
||||
}
|
||||
|
||||
const offersState: Array<any> = []
|
||||
const needsState: Array<any> = []
|
||||
const offersState: any[] = []
|
||||
const needsState: any[] = []
|
||||
|
||||
state.offers.map((o) => {
|
||||
offersState.push({ items_id: item?.id, tags_id: o.id })
|
||||
|
||||
@ -1,3 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import * as React from 'react'
|
||||
import { MapOverlayPage } from './MapOverlayPage'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
@ -11,7 +20,7 @@ import { toast } from 'react-toastify'
|
||||
export const AttestationForm = ({ api }: { api?: ItemsApi<any> }) => {
|
||||
const items = useItems()
|
||||
const appState = useAppState()
|
||||
const [users, setUsers] = useState<Array<Item>>()
|
||||
const [users, setUsers] = useState<Item[]>()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
@ -36,7 +45,7 @@ export const AttestationForm = ({ api }: { api?: ItemsApi<any> }) => {
|
||||
}
|
||||
|
||||
const sendAttestation = async () => {
|
||||
const to: Array<any> = []
|
||||
const to: any[] = []
|
||||
users?.map((u) => to.push({ directus_users_id: u.user_created.id }))
|
||||
|
||||
api?.createItem &&
|
||||
|
||||
@ -11,7 +11,7 @@ export function CardPage({
|
||||
title: string
|
||||
hideTitle?: boolean
|
||||
children?: React.ReactNode
|
||||
parents?: Array<{ name: string; path: string }>
|
||||
parents?: { name: string; path: string }[]
|
||||
}) {
|
||||
return (
|
||||
<main className='tw-flex-1 tw-overflow-y-auto tw-overflow-x-hidden tw-pt-2 tw-px-6 tw-min-w-80 tw-flex tw-justify-center'>
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { useEffect, useRef } from 'react'
|
||||
|
||||
export const CircleLayout = ({
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
import { useState } from 'react'
|
||||
import { timeAgo } from '../../Utils/TimeAgo'
|
||||
import { Item } from '../../types'
|
||||
|
||||
@ -7,7 +7,7 @@ const isClickInsideRectangle = (e: MouseEvent, element: HTMLElement) => {
|
||||
return e.clientX > r.left && e.clientX < r.right && e.clientY > r.top && e.clientY < r.bottom
|
||||
}
|
||||
|
||||
type Props = {
|
||||
interface Props {
|
||||
title: string
|
||||
isOpened: boolean
|
||||
onClose: () => void
|
||||
@ -43,7 +43,7 @@ const DialogModal = ({
|
||||
if (isOpened) {
|
||||
return (
|
||||
<dialog
|
||||
className={`${className || ''} tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100`}
|
||||
className={`${className ?? ''} tw-card tw-shadow-xl tw-absolute tw-right-0 tw-top-0 tw-bottom-0 tw-left-0 tw-m-auto tw-transition-opacity tw-duration-300 tw-p-4 tw-max-w-xl tw-bg-base-100`}
|
||||
ref={ref}
|
||||
// eslint-disable-next-line react/no-unknown-property
|
||||
onCancel={onClose}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { useState } from 'react'
|
||||
|
||||
export const EmojiPicker = ({
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { DateUserInfo } from './DateUserInfo'
|
||||
import { StartEndView, TextView } from '../Map'
|
||||
import { HeaderView } from '../Map/Subcomponents/ItemPopupComponents/HeaderView'
|
||||
@ -45,7 +51,7 @@ export const ItemCard = ({
|
||||
<div className='tw-overflow-y-auto tw-overflow-x-hidden tw-max-h-64 fade'>
|
||||
{i.layer?.itemType.show_start_end && <StartEndView item={i}></StartEndView>}
|
||||
{i.layer?.itemType.show_text && (
|
||||
<TextView truncate item={i} itemTextField={i.layer?.itemTextField} />
|
||||
<TextView truncate item={i} itemTextField={i.layer.itemTextField} />
|
||||
)}
|
||||
</div>
|
||||
<DateUserInfo item={i}></DateUserInfo>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as L from 'leaflet'
|
||||
import * as React from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
import { Tag } from '../../types'
|
||||
@ -24,8 +29,8 @@ function groupAndCount(arr) {
|
||||
}
|
||||
|
||||
export const MarketView = () => {
|
||||
const [offers, setOffers] = useState<Array<Tag>>([])
|
||||
const [needs, setNeeds] = useState<Array<Tag>>([])
|
||||
const [offers, setOffers] = useState<Tag[]>([])
|
||||
const [needs, setNeeds] = useState<Tag[]>([])
|
||||
const navigate = useNavigate()
|
||||
|
||||
const items = useItems()
|
||||
@ -35,13 +40,13 @@ export const MarketView = () => {
|
||||
setOffers([])
|
||||
setNeeds([])
|
||||
items.map((i) => {
|
||||
i?.layer?.itemOffersField &&
|
||||
i.layer?.itemOffersField &&
|
||||
getValue(i, i.layer.itemOffersField)?.map((o) => {
|
||||
const tag = tags.find((t) => t.id === o.tags_id)
|
||||
tag && setOffers((current) => [...current, tag])
|
||||
return null
|
||||
})
|
||||
i?.layer?.itemNeedsField &&
|
||||
i.layer?.itemNeedsField &&
|
||||
getValue(i, i.layer.itemNeedsField)?.map((n) => {
|
||||
const tag = tags.find((t) => t.id === n.tags_id)
|
||||
tag && setNeeds((current) => [...current, tag])
|
||||
|
||||
@ -1,3 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable @typescript-eslint/no-misused-promises */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { Item } from '../../types'
|
||||
import { PopupStartEndInput } from '../Map'
|
||||
@ -122,7 +129,7 @@ export const OverlayItemsIndexPage = ({
|
||||
<div className='tw-overflow-scroll fade tw-flex-1'>
|
||||
<div className='tw-columns-1 md:tw-columns-2 lg:tw-columns-3 2xl:tw-columns-4 tw-gap-6 tw-pt-4'>
|
||||
{items
|
||||
?.filter((i) => i.layer?.name === layerName)
|
||||
.filter((i) => i.layer?.name === layerName)
|
||||
.filter((item) =>
|
||||
filterTags.length === 0
|
||||
? item
|
||||
@ -133,7 +140,7 @@ export const OverlayItemsIndexPage = ({
|
||||
),
|
||||
),
|
||||
)
|
||||
?.sort((a, b) => {
|
||||
.sort((a, b) => {
|
||||
// Convert date_created to milliseconds, handle undefined by converting to lowest possible date (0 milliseconds)
|
||||
const dateA = a.date_updated
|
||||
? new Date(a.date_updated).getTime()
|
||||
@ -147,7 +154,7 @@ export const OverlayItemsIndexPage = ({
|
||||
: 0
|
||||
return dateB - dateA // Subtracts milliseconds which are numbers
|
||||
})
|
||||
?.map((i, k) => (
|
||||
.map((i, k) => (
|
||||
<div key={k} className='tw-break-inside-avoid tw-mb-6'>
|
||||
<ItemCard
|
||||
i={i}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
import { useState } from 'react'
|
||||
import { MapOverlayPage } from './MapOverlayPage'
|
||||
import { useItems } from '../Map/hooks/useItems'
|
||||
@ -9,7 +10,7 @@ export const SelectUser = () => {
|
||||
const items = useItems()
|
||||
const users = items.filter((i) => i.layer?.itemType.name === appState.userType)
|
||||
|
||||
const [selectedUsers, setSelectedUsers] = useState<Array<string>>([])
|
||||
const [selectedUsers, setSelectedUsers] = useState<string[]>([])
|
||||
|
||||
return (
|
||||
<MapOverlayPage backdrop className='tw-h-3/4 tw-w-80'>
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as React from 'react'
|
||||
import { decodeTag } from '../../Utils/FormatTags'
|
||||
import { Tag } from '../../types'
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import Subtitle from '../Typography/Subtitle'
|
||||
import * as React from 'react'
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import * as React from 'react'
|
||||
|
||||
// eslint-disable-next-line react/prop-types
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
export function getValue(obj, path) {
|
||||
if (!obj || typeof path !== 'string') return undefined
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
import * as L from 'leaflet'
|
||||
|
||||
const createSvg = (shape: string, markerColor: string, borderColor: string) => {
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
const goldenRatioConjugate = 0.618033988749895
|
||||
|
||||
export const randomColor = () => {
|
||||
return hsvToHex((Math.random() + goldenRatioConjugate) % 1, 0.8, 0.7)
|
||||
}
|
||||
|
||||
function hsvToHex(h, s, v) {
|
||||
function hsvToHex(h: number, s: number, v: number) {
|
||||
let r, g, b
|
||||
const i = Math.floor(h * 6)
|
||||
const f = h * 6 - i
|
||||
@ -53,6 +58,6 @@ const rgbToHex = (r, g, b) =>
|
||||
[r, g, b]
|
||||
.map((x) => {
|
||||
const hex = x.toString(16)
|
||||
return hex.length === 1 ? '0' + hex : hex
|
||||
return hex.length === 1 ? `0${hex}` : hex
|
||||
})
|
||||
.join('')
|
||||
|
||||
@ -27,9 +27,9 @@ export async function reverseGeocode(lat: number, lon: number): Promise<string>
|
||||
const address = response.data.address
|
||||
|
||||
// Extrahiere Straße, Hausnummer und Ort
|
||||
const street = address.road || ''
|
||||
const houseNumber = address.house_number || ''
|
||||
const city = address.city || address.town || address.village || ''
|
||||
const street = address.road ?? ''
|
||||
const houseNumber = address.house_number ?? ''
|
||||
const city = address.city ?? address.town ?? address.village ?? ''
|
||||
|
||||
// Formatiere die Adresse
|
||||
const formattedAddress = `${street} ${houseNumber}, ${city}`.trim()
|
||||
|
||||
@ -39,8 +39,8 @@ export {
|
||||
export { TextInput, TextAreaInput, SelectBox } from './Components/Input'
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
interface Window {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
my_modal_3: any
|
||||
}
|
||||
}
|
||||
|
||||
15
src/types.ts
15
src/types.ts
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import * as React from 'react'
|
||||
import { ItemFormPopupProps } from './Components/Map/Subcomponents/ItemFormPopup'
|
||||
|
||||
@ -82,7 +83,7 @@ export class Geometry {
|
||||
}
|
||||
}
|
||||
|
||||
export type Relation = {
|
||||
export interface Relation {
|
||||
related_items_id: string
|
||||
[key: string]: any
|
||||
}
|
||||
@ -102,8 +103,8 @@ export class Item {
|
||||
relations?: Relation[]
|
||||
parent?: string
|
||||
subname?: string
|
||||
public_edit?: boolean;
|
||||
// eslint-disable-next-line no-undef
|
||||
public_edit?: boolean
|
||||
slug?: string;
|
||||
[key: string]: any
|
||||
constructor(
|
||||
id: string,
|
||||
@ -127,7 +128,7 @@ export interface AssetsApi {
|
||||
url: string
|
||||
}
|
||||
|
||||
export type Profile = {
|
||||
export interface Profile {
|
||||
id?: string
|
||||
avatar?: string
|
||||
color?: string
|
||||
@ -136,7 +137,7 @@ export type Profile = {
|
||||
geoposition?: Geometry
|
||||
}
|
||||
|
||||
export type UserItem = {
|
||||
export interface UserItem {
|
||||
id?: string
|
||||
role?: any
|
||||
email?: string
|
||||
@ -156,7 +157,7 @@ export interface UserApi {
|
||||
passwordReset(token: string, new_password: string)
|
||||
}
|
||||
|
||||
export type PermissionCondition = {
|
||||
export interface PermissionCondition {
|
||||
user_created?: {
|
||||
_eq: string // Erwartet den speziellen Wert "$CURRENT_USER" oder eine spezifische UUID
|
||||
}
|
||||
@ -167,7 +168,7 @@ export type PermissionCondition = {
|
||||
|
||||
export type PermissionAction = 'create' | 'read' | 'update' | 'delete'
|
||||
|
||||
export type Permission = {
|
||||
export interface Permission {
|
||||
id?: string
|
||||
policy: any
|
||||
collection: string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user