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