diff --git a/eslint.config.mts b/eslint.config.mts index 3522f15..b6d5456 100644 --- a/eslint.config.mts +++ b/eslint.config.mts @@ -1,14 +1,7 @@ -import path from "node:path" -import { fileURLToPath } from "node:url" -import { FlatCompat } from "@eslint/eslintrc" import { defineConfig } from "eslint/config" -import js from "@eslint/js" import globals from "globals" import tseslint from "typescript-eslint" -import pluginReact from "eslint-plugin-react" - -const __dirname = path.dirname(fileURLToPath(import.meta.url)) -const compat = new FlatCompat({ baseDirectory: __dirname }) +import nextVitals from "eslint-config-next/core-web-vitals" export default defineConfig([ { @@ -17,17 +10,13 @@ export default defineConfig([ globals: { ...globals.browser, ...globals.node }, }, }, - ...compat.extends("next/core-web-vitals"), - ...compat.extends("plugin:@typescript-eslint/recommended"), - ...compat.extends("plugin:@typescript-eslint/recommended-requiring-type-checking"), - ...tseslint.configs.recommended, - pluginReact.configs.flat.recommended, + ...nextVitals, { - files: ["*.ts", "*.tsx"], + files: ["src/**/*.{ts,tsx,mts,cts}"], languageOptions: { parser: tseslint.parser, parserOptions: { - project: path.join(__dirname, "tsconfig.json"), + project: "./tsconfig.json", }, }, plugins: { diff --git a/package-lock.json b/package-lock.json index 84ab558..5185203 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,23 +20,23 @@ "@trpc/server": "^10.45.3", "@types/react-select": "^5.0.1", "dayjs": "^1.11.11", - "dotenv": "^16.4.5", + "dotenv": "^17.3.1", "ldapts": "^7.0.11", - "lucide-react": "^0.511.0", - "next": "16.0.10", + "lucide-react": "^0.575.0", + "next": "^16.1.6", "next-auth": "^4.24.13", - "nodemailer": "^7.0.10", + "nodemailer": "^7.0.13", "papaparse": "^5.5.3", "rate-limiter-flexible": "^5.0.3", - "react": "19.2.1", - "react-dom": "19.2.1", - "react-hook-form": "^7.51.4", + "react": "^19.2.4", + "react-dom": "^19.2.4", + "react-hook-form": "^7.71.2", "react-select": "^5.8.0", - "superjson": "2.2.1", + "superjson": "^2.2.6", "zod": "^3.23.8" }, "devDependencies": { - "@eslint/js": "^9.39.1", + "@eslint/js": "^9.39.3", "@hookform/devtools": "^4.3.1", "@tailwindcss/typography": "^0.5.13", "@types/eslint": "^8.56.10", @@ -46,23 +46,23 @@ "@types/prettier": "^2.7.3", "@types/react": "19.2.7", "@types/react-dom": "19.2.3", - "@typescript-eslint/eslint-plugin": "^8.47.0", - "@typescript-eslint/parser": "^8.47.0", + "@typescript-eslint/eslint-plugin": "^8.56.1", + "@typescript-eslint/parser": "^8.56.1", "@vitejs/plugin-react": "^4.3.4", - "autoprefixer": "^10.4.19", + "autoprefixer": "^10.4.24", "daisyui": "^4.11.1", - "eslint": "^9.39.1", - "eslint-config-next": "16.0.7", + "eslint": "^9.39.3", + "eslint-config-next": "^16.1.6", "eslint-plugin-react": "^7.37.5", "globals": "^16.5.0", "jiti": "^2.6.1", "postcss": "^8.4.38", - "prettier": "^3.2.5", + "prettier": "^3.8.1", "prettier-plugin-tailwindcss": "^0.5.14", "prisma": "^5.22.0", "tailwindcss": "^3.4.3", "typescript": "^5.4.5", - "typescript-eslint": "^8.47.0", + "typescript-eslint": "^8.56.1", "vitest": "^3.0.9" } }, @@ -1054,30 +1054,6 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@eslint/config-array/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/@eslint/config-array/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/@eslint/config-helpers": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", @@ -1105,20 +1081,20 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", - "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.4.tgz", + "integrity": "sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ==", "dev": true, "license": "MIT", "dependencies": { - "ajv": "^6.12.4", + "ajv": "^6.14.0", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.1", - "minimatch": "^3.1.2", + "minimatch": "^3.1.3", "strip-json-comments": "^3.1.1" }, "engines": { @@ -1128,17 +1104,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/@eslint/eslintrc/node_modules/globals": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", @@ -1162,19 +1127,6 @@ "node": ">= 4" } }, - "node_modules/@eslint/eslintrc/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/@eslint/js": { "version": "9.39.3", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.3.tgz", @@ -1903,15 +1855,15 @@ } }, "node_modules/@next/env": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/env/-/env-16.0.10.tgz", - "integrity": "sha512-8tuaQkyDVgeONQ1MeT9Mkk8pQmZapMKFh5B+OrFUlG3rVmYTXcXlBetBgTurKXGaIZvkoqRT9JL5K3phXcgang==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/env/-/env-16.1.6.tgz", + "integrity": "sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { - "version": "16.0.7", - "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.0.7.tgz", - "integrity": "sha512-hFrTNZcMEG+k7qxVxZJq3F32Kms130FAhG8lvw2zkKBgAcNOJIxlljNiCjGygvBshvaGBdf88q2CqWtnqezDHA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.1.6.tgz", + "integrity": "sha512-/Qq3PTagA6+nYVfryAtQ7/9FEr/6YVyvOtl6rZnGsbReGLf0jZU6gkpr1FuChAQpvV46a78p4cmHOVP8mbfSMQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1919,9 +1871,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.0.10.tgz", - "integrity": "sha512-4XgdKtdVsaflErz+B5XeG0T5PeXKDdruDf3CRpnhN+8UebNa5N2H58+3GDgpn/9GBurrQ1uWW768FfscwYkJRg==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.1.6.tgz", + "integrity": "sha512-wTzYulosJr/6nFnqGW7FrG3jfUUlEf8UjGA0/pyypJl42ExdVgC6xJgcXQ+V8QFn6niSG2Pb8+MIG1mZr2vczw==", "cpu": [ "arm64" ], @@ -1935,9 +1887,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.0.10.tgz", - "integrity": "sha512-spbEObMvRKkQ3CkYVOME+ocPDFo5UqHb8EMTS78/0mQ+O1nqE8toHJVioZo4TvebATxgA8XMTHHrScPrn68OGw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.1.6.tgz", + "integrity": "sha512-BLFPYPDO+MNJsiDWbeVzqvYd4NyuRrEYVB5k2N3JfWncuHAy2IVwMAOlVQDFjj+krkWzhY2apvmekMkfQR0CUQ==", "cpu": [ "x64" ], @@ -1951,9 +1903,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.0.10.tgz", - "integrity": "sha512-uQtWE3X0iGB8apTIskOMi2w/MKONrPOUCi5yLO+v3O8Mb5c7K4Q5KD1jvTpTF5gJKa3VH/ijKjKUq9O9UhwOYw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.1.6.tgz", + "integrity": "sha512-OJYkCd5pj/QloBvoEcJ2XiMnlJkRv9idWA/j0ugSuA34gMT6f5b7vOiCQHVRpvStoZUknhl6/UxOXL4OwtdaBw==", "cpu": [ "arm64" ], @@ -1967,9 +1919,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.0.10.tgz", - "integrity": "sha512-llA+hiDTrYvyWI21Z0L1GiXwjQaanPVQQwru5peOgtooeJ8qx3tlqRV2P7uH2pKQaUfHxI/WVarvI5oYgGxaTw==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.1.6.tgz", + "integrity": "sha512-S4J2v+8tT3NIO9u2q+S0G5KdvNDjXfAv06OhfOzNDaBn5rw84DGXWndOEB7d5/x852A20sW1M56vhC/tRVbccQ==", "cpu": [ "arm64" ], @@ -1983,9 +1935,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.0.10.tgz", - "integrity": "sha512-AK2q5H0+a9nsXbeZ3FZdMtbtu9jxW4R/NgzZ6+lrTm3d6Zb7jYrWcgjcpM1k8uuqlSy4xIyPR2YiuUr+wXsavA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.1.6.tgz", + "integrity": "sha512-2eEBDkFlMMNQnkTyPBhQOAyn2qMxyG2eE7GPH2WIDGEpEILcBPI/jdSv4t6xupSP+ot/jkfrCShLAa7+ZUPcJQ==", "cpu": [ "x64" ], @@ -1999,9 +1951,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.0.10.tgz", - "integrity": "sha512-1TDG9PDKivNw5550S111gsO4RGennLVl9cipPhtkXIFVwo31YZ73nEbLjNC8qG3SgTz/QZyYyaFYMeY4BKZR/g==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.1.6.tgz", + "integrity": "sha512-oicJwRlyOoZXVlxmIMaTq7f8pN9QNbdes0q2FXfRsPhfCi8n8JmOZJm5oo1pwDaFbnnD421rVU409M3evFbIqg==", "cpu": [ "x64" ], @@ -2015,9 +1967,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.0.10.tgz", - "integrity": "sha512-aEZIS4Hh32xdJQbHz121pyuVZniSNoqDVx1yIr2hy+ZwJGipeqnMZBJHyMxv2tiuAXGx6/xpTcQJ6btIiBjgmg==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.1.6.tgz", + "integrity": "sha512-gQmm8izDTPgs+DCWH22kcDmuUp7NyiJgEl18bcr8irXA5N2m2O+JQIr6f3ct42GOs9c0h8QF3L5SzIxcYAAXXw==", "cpu": [ "arm64" ], @@ -2031,9 +1983,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.0.10.tgz", - "integrity": "sha512-E+njfCoFLb01RAFEnGZn6ERoOqhK1Gl3Lfz1Kjnj0Ulfu7oJbuMyvBKNj/bw8XZnenHDASlygTjZICQW+rYW1Q==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.1.6.tgz", + "integrity": "sha512-NRfO39AIrzBnixKbjuo2YiYhB6o9d8v/ymU9m/Xk8cyVk+k7XylniXkHwjs4s70wedVffc6bQNbufk5v0xEm0A==", "cpu": [ "x64" ], @@ -2976,17 +2928,17 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.56.0.tgz", - "integrity": "sha512-lRyPDLzNCuae71A3t9NEINBiTn7swyOhvUj3MyUOxb8x6g6vPEFoOU+ZRmGMusNC3X3YMhqMIX7i8ShqhT74Pw==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.56.1.tgz", + "integrity": "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.56.0", - "@typescript-eslint/type-utils": "8.56.0", - "@typescript-eslint/utils": "8.56.0", - "@typescript-eslint/visitor-keys": "8.56.0", + "@typescript-eslint/scope-manager": "8.56.1", + "@typescript-eslint/type-utils": "8.56.1", + "@typescript-eslint/utils": "8.56.1", + "@typescript-eslint/visitor-keys": "8.56.1", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.4.0" @@ -2999,22 +2951,22 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.56.0", + "@typescript-eslint/parser": "^8.56.1", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/parser": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.56.0.tgz", - "integrity": "sha512-IgSWvLobTDOjnaxAfDTIHaECbkNlAlKv2j5SjpB2v7QHKv1FIfjwMy8FsDbVfDX/KjmCmYICcw7uGaXLhtsLNg==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.56.1.tgz", + "integrity": "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.56.0", - "@typescript-eslint/types": "8.56.0", - "@typescript-eslint/typescript-estree": "8.56.0", - "@typescript-eslint/visitor-keys": "8.56.0", + "@typescript-eslint/scope-manager": "8.56.1", + "@typescript-eslint/types": "8.56.1", + "@typescript-eslint/typescript-estree": "8.56.1", + "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3" }, "engines": { @@ -3030,14 +2982,14 @@ } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.56.0.tgz", - "integrity": "sha512-M3rnyL1vIQOMeWxTWIW096/TtVP+8W3p/XnaFflhmcFp+U4zlxUxWj4XwNs6HbDeTtN4yun0GNTTDBw/SvufKg==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.56.1.tgz", + "integrity": "sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.56.0", - "@typescript-eslint/types": "^8.56.0", + "@typescript-eslint/tsconfig-utils": "^8.56.1", + "@typescript-eslint/types": "^8.56.1", "debug": "^4.4.3" }, "engines": { @@ -3052,14 +3004,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.56.0.tgz", - "integrity": "sha512-7UiO/XwMHquH+ZzfVCfUNkIXlp/yQjjnlYUyYz7pfvlK3/EyyN6BK+emDmGNyQLBtLGaYrTAI6KOw8tFucWL2w==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.56.1.tgz", + "integrity": "sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.0", - "@typescript-eslint/visitor-keys": "8.56.0" + "@typescript-eslint/types": "8.56.1", + "@typescript-eslint/visitor-keys": "8.56.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3070,9 +3022,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.56.0.tgz", - "integrity": "sha512-bSJoIIt4o3lKXD3xmDh9chZcjCz5Lk8xS7Rxn+6l5/pKrDpkCwtQNQQwZ2qRPk7TkUYhrq3WPIHXOXlbXP0itg==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.56.1.tgz", + "integrity": "sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ==", "dev": true, "license": "MIT", "engines": { @@ -3087,15 +3039,15 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.56.0.tgz", - "integrity": "sha512-qX2L3HWOU2nuDs6GzglBeuFXviDODreS58tLY/BALPC7iu3Fa+J7EOTwnX9PdNBxUI7Uh0ntP0YWGnxCkXzmfA==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.56.1.tgz", + "integrity": "sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.0", - "@typescript-eslint/typescript-estree": "8.56.0", - "@typescript-eslint/utils": "8.56.0", + "@typescript-eslint/types": "8.56.1", + "@typescript-eslint/typescript-estree": "8.56.1", + "@typescript-eslint/utils": "8.56.1", "debug": "^4.4.3", "ts-api-utils": "^2.4.0" }, @@ -3112,9 +3064,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.56.0.tgz", - "integrity": "sha512-DBsLPs3GsWhX5HylbP9HNG15U0bnwut55Lx12bHB9MpXxQ+R5GC8MwQe+N1UFXxAeQDvEsEDY6ZYwX03K7Z6HQ==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.56.1.tgz", + "integrity": "sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw==", "dev": true, "license": "MIT", "engines": { @@ -3126,18 +3078,18 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.56.0.tgz", - "integrity": "sha512-ex1nTUMWrseMltXUHmR2GAQ4d+WjkZCT4f+4bVsps8QEdh0vlBsaCokKTPlnqBFqqGaxilDNJG7b8dolW2m43Q==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.56.1.tgz", + "integrity": "sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.56.0", - "@typescript-eslint/tsconfig-utils": "8.56.0", - "@typescript-eslint/types": "8.56.0", - "@typescript-eslint/visitor-keys": "8.56.0", + "@typescript-eslint/project-service": "8.56.1", + "@typescript-eslint/tsconfig-utils": "8.56.1", + "@typescript-eslint/types": "8.56.1", + "@typescript-eslint/visitor-keys": "8.56.1", "debug": "^4.4.3", - "minimatch": "^9.0.5", + "minimatch": "^10.2.2", "semver": "^7.7.3", "tinyglobby": "^0.2.15", "ts-api-utils": "^2.4.0" @@ -3154,16 +3106,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.56.0.tgz", - "integrity": "sha512-RZ3Qsmi2nFGsS+n+kjLAYDPVlrzf7UhTffrDIKr+h2yzAlYP/y5ZulU0yeDEPItos2Ph46JAL5P/On3pe7kDIQ==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.56.1.tgz", + "integrity": "sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.56.0", - "@typescript-eslint/types": "8.56.0", - "@typescript-eslint/typescript-estree": "8.56.0" + "@typescript-eslint/scope-manager": "8.56.1", + "@typescript-eslint/types": "8.56.1", + "@typescript-eslint/typescript-estree": "8.56.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -3178,13 +3130,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.56.0.tgz", - "integrity": "sha512-q+SL+b+05Ud6LbEE35qe4A99P+htKTKVbyiNEe45eCbJFyh/HVK9QXwlrbz+Q4L8SOW4roxSVwXYj4DMBT7Ieg==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.56.1.tgz", + "integrity": "sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.56.0", + "@typescript-eslint/types": "8.56.1", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -3999,17 +3951,19 @@ } }, "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } }, "node_modules/baseline-browser-mapping": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.0.tgz", "integrity": "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA==", - "dev": true, "license": "Apache-2.0", "bin": { "baseline-browser-mapping": "dist/cli.cjs" @@ -4032,13 +3986,16 @@ } }, "node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.3.tgz", + "integrity": "sha512-fy6KJm2RawA5RcHkLa1z/ScpBeA762UF9KmZQxwIbDtRJrgLzM10depAiEQ+CXYcoiqW1/m96OAAoke2nE9EeA==", "dev": true, "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0" + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" } }, "node_modules/braces": { @@ -4314,13 +4271,6 @@ "node": ">= 6" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -4337,15 +4287,15 @@ } }, "node_modules/copy-anything": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", - "integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-4.0.5.tgz", + "integrity": "sha512-7Vv6asjS4gMOuILabD3l739tsaxFQmC+a7pLZm02zyvs8p977bL3zEgq3yDk5rn9B0PbYgIv++jmHcuUab4RhA==", "license": "MIT", "dependencies": { - "is-what": "^4.1.8" + "is-what": "^5.2.0" }, "engines": { - "node": ">=12.13" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/mesqueeb" @@ -4646,9 +4596,9 @@ } }, "node_modules/dotenv": { - "version": "16.6.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", - "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "version": "17.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.3.1.tgz", + "integrity": "sha512-IO8C/dzEb6O3F9/twg6ZLXz164a2fhTnEWb95H23Dm4OuN+92NmEAlTrupP9VW6Jm3sO26tQlqyvyi4CsnY9GA==", "license": "BSD-2-Clause", "engines": { "node": ">=12" @@ -5004,13 +4954,13 @@ } }, "node_modules/eslint-config-next": { - "version": "16.0.7", - "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.0.7.tgz", - "integrity": "sha512-WubFGLFHfk2KivkdRGfx6cGSFhaQqhERRfyO8BRx+qiGPGp7WLKcPvYC4mdx1z3VhVRcrfFzczjjTrbJZOpnEQ==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.1.6.tgz", + "integrity": "sha512-vKq40io2B0XtkkNDYyleATwblNt8xuh3FWp8SpSz3pt7P01OkBFlKsJZ2mWt5WsCySlDQLckb1zMY9yE9Qy0LA==", "dev": true, "license": "MIT", "dependencies": { - "@next/eslint-plugin-next": "16.0.7", + "@next/eslint-plugin-next": "16.1.6", "eslint-import-resolver-node": "^0.3.6", "eslint-import-resolver-typescript": "^3.5.2", "eslint-plugin-import": "^2.32.0", @@ -5030,42 +4980,7 @@ } } }, - "node_modules/eslint-config-next/node_modules/globals": { - "version": "16.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz", - "integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint-import-resolver-node": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", - "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^3.2.7", - "is-core-module": "^2.13.0", - "resolve": "^1.22.4" - } - }, - "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-import-resolver-typescript": { + "node_modules/eslint-config-next/node_modules/eslint-import-resolver-typescript": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.10.1.tgz", "integrity": "sha512-A1rHYb06zjMGAxdLSkN2fXPBwuSaQ0iO5M/hdyS0Ajj1VBaRp0sPD3dn1FhME3c/JluGFbwSxyCfqdSbtQLAHQ==", @@ -5100,35 +5015,7 @@ } } }, - "node_modules/eslint-module-utils": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz", - "integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^3.2.7" - }, - "engines": { - "node": ">=4" - }, - "peerDependenciesMeta": { - "eslint": { - "optional": true - } - } - }, - "node_modules/eslint-module-utils/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-plugin-import": { + "node_modules/eslint-config-next/node_modules/eslint-plugin-import": { "version": "2.32.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", @@ -5162,18 +5049,7 @@ "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" } }, - "node_modules/eslint-plugin-import/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/eslint-plugin-import/node_modules/debug": { + "node_modules/eslint-config-next/node_modules/eslint-plugin-import/node_modules/debug": { "version": "3.2.7", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", @@ -5183,30 +5059,7 @@ "ms": "^2.1.1" } }, - "node_modules/eslint-plugin-import/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/eslint-plugin-import/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/eslint-plugin-jsx-a11y": { + "node_modules/eslint-config-next/node_modules/eslint-plugin-jsx-a11y": { "version": "6.10.2", "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.10.2.tgz", "integrity": "sha512-scB3nz4WmG75pV8+3eRUQOHZlNSUhFNq37xnpgRkCCELU3XMvXAxLk1eqWWyE22Ki4Q01Fnsw9BA3cJHDPgn2Q==", @@ -5236,28 +5089,97 @@ "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9" } }, - "node_modules/eslint-plugin-jsx-a11y/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "node_modules/eslint-config-next/node_modules/eslint-plugin-react-hooks": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz", + "integrity": "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==", "dev": true, "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" } }, - "node_modules/eslint-plugin-jsx-a11y/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/eslint-config-next/node_modules/globals": { + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz", + "integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-config-next/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz", + "integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==", + "dev": true, + "license": "MIT", "dependencies": { - "brace-expansion": "^1.1.7" + "debug": "^3.2.7" }, "engines": { - "node": "*" + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" } }, "node_modules/eslint-plugin-react": { @@ -5293,50 +5215,6 @@ "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" } }, - "node_modules/eslint-plugin-react-hooks": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz", - "integrity": "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.24.4", - "@babel/parser": "^7.24.4", - "hermes-parser": "^0.25.1", - "zod": "^3.25.0 || ^4.0.0", - "zod-validation-error": "^3.5.0 || ^4.0.0" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" - } - }, - "node_modules/eslint-plugin-react/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/eslint-plugin-react/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/eslint-plugin-react/node_modules/resolve": { "version": "2.0.0-next.6", "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.6.tgz", @@ -5401,17 +5279,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint/node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, "node_modules/eslint/node_modules/eslint-visitor-keys": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", @@ -5435,19 +5302,6 @@ "node": ">= 4" } }, - "node_modules/eslint/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/espree": { "version": "10.4.0", "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", @@ -5717,7 +5571,6 @@ "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, "hasInstallScript": true, "license": "MIT", "optional": true, @@ -6505,12 +6358,12 @@ } }, "node_modules/is-what": { - "version": "4.1.16", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.16.tgz", - "integrity": "sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-5.5.0.tgz", + "integrity": "sha512-oG7cgbmg5kLYae2N5IVd3jm2s+vldjxJzK1pcu9LfpGuQ93MQSzo0okvRna+7y5ifrD+20FE8FvjusyGaz14fw==", "license": "MIT", "engines": { - "node": ">=12.13" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/mesqueeb" @@ -6834,9 +6687,9 @@ } }, "node_modules/lucide-react": { - "version": "0.511.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.511.0.tgz", - "integrity": "sha512-VK5a2ydJ7xm8GvBeKLS9mu1pVK6ucef9780JVUjw6bAjJL/QXnd4Y0p7SPeOUMC27YhzNCZvm5d/QX0Tp3rc0w==", + "version": "0.575.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.575.0.tgz", + "integrity": "sha512-VuXgKZrk0uiDlWjGGXmKV6MSk9Yy4l10qgVvzGn2AWBx1Ylt0iBexKOAoA6I7JO3m+M9oeovJd3yYENfkUbOeg==", "license": "ISC", "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" @@ -6893,16 +6746,16 @@ } }, "node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.2.tgz", + "integrity": "sha512-+G4CpNBxa5MprY+04MbgOw1v7So6n5JY166pFi9KfYwT78fxScCeSNQSNzp6dpPSW2rONOps6Ocam1wFhCgoVw==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^5.0.2" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -6978,13 +6831,14 @@ "license": "MIT" }, "node_modules/next": { - "version": "16.0.10", - "resolved": "https://registry.npmjs.org/next/-/next-16.0.10.tgz", - "integrity": "sha512-RtWh5PUgI+vxlV3HdR+IfWA1UUHu0+Ram/JBO4vWB54cVPentCD0e+lxyAYEsDTqGGMg7qpjhKh6dc6aW7W/sA==", + "version": "16.1.6", + "resolved": "https://registry.npmjs.org/next/-/next-16.1.6.tgz", + "integrity": "sha512-hkyRkcu5x/41KoqnROkfTm2pZVbKxvbZRuNvKXLRXxs3VfyO0WhY50TQS40EuKO9SW3rBj/sF3WbVwDACeMZyw==", "license": "MIT", "dependencies": { - "@next/env": "16.0.10", + "@next/env": "16.1.6", "@swc/helpers": "0.5.15", + "baseline-browser-mapping": "^2.8.3", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" @@ -6996,14 +6850,14 @@ "node": ">=20.9.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "16.0.10", - "@next/swc-darwin-x64": "16.0.10", - "@next/swc-linux-arm64-gnu": "16.0.10", - "@next/swc-linux-arm64-musl": "16.0.10", - "@next/swc-linux-x64-gnu": "16.0.10", - "@next/swc-linux-x64-musl": "16.0.10", - "@next/swc-win32-arm64-msvc": "16.0.10", - "@next/swc-win32-x64-msvc": "16.0.10", + "@next/swc-darwin-arm64": "16.1.6", + "@next/swc-darwin-x64": "16.1.6", + "@next/swc-linux-arm64-gnu": "16.1.6", + "@next/swc-linux-arm64-musl": "16.1.6", + "@next/swc-linux-x64-gnu": "16.1.6", + "@next/swc-linux-x64-musl": "16.1.6", + "@next/swc-win32-arm64-msvc": "16.1.6", + "@next/swc-win32-x64-msvc": "16.1.6", "sharp": "^0.34.4" }, "peerDependencies": { @@ -7868,24 +7722,24 @@ "license": "ISC" }, "node_modules/react": { - "version": "19.2.1", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.1.tgz", - "integrity": "sha512-DGrYcCWK7tvYMnWh79yrPHt+vdx9tY+1gPZa7nJQtO/p8bLTDaHp4dzwEhQB7pZ4Xe3ok4XKuEPrVuc+wlpkmw==", + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", + "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "19.2.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.1.tgz", - "integrity": "sha512-ibrK8llX2a4eOskq1mXKu/TGZj9qzomO+sNfO98M6d9zIPOEhlBkMkBUBLd1vgS0gQsLDBzA+8jJBVXDnfHmJg==", + "version": "19.2.4", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", + "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", "license": "MIT", "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { - "react": "^19.2.1" + "react": "^19.2.4" } }, "node_modules/react-hook-form": { @@ -8701,12 +8555,12 @@ } }, "node_modules/superjson": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.1.tgz", - "integrity": "sha512-8iGv75BYOa0xRJHK5vRLEjE2H/i4lulTjzpUXic3Eg8akftYjkmQDa8JARQ42rlczXyFR3IeRoeFCc7RxHsYZA==", + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/superjson/-/superjson-2.2.6.tgz", + "integrity": "sha512-H+ue8Zo4vJmV2nRjpx86P35lzwDT3nItnIsocgumgr0hHMQ+ZGq5vrERg9kJBo5AWGmxZDhzDo+WVIJqkB0cGA==", "license": "MIT", "dependencies": { - "copy-anything": "^3.0.2" + "copy-anything": "^4" }, "engines": { "node": ">=16" @@ -9186,16 +9040,16 @@ } }, "node_modules/typescript-eslint": { - "version": "8.56.0", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.56.0.tgz", - "integrity": "sha512-c7toRLrotJ9oixgdW7liukZpsnq5CZ7PuKztubGYlNppuTqhIoWfhgHo/7EU0v06gS2l/x0i2NEFK1qMIf0rIg==", + "version": "8.56.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.56.1.tgz", + "integrity": "sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/eslint-plugin": "8.56.0", - "@typescript-eslint/parser": "8.56.0", - "@typescript-eslint/typescript-estree": "8.56.0", - "@typescript-eslint/utils": "8.56.0" + "@typescript-eslint/eslint-plugin": "8.56.1", + "@typescript-eslint/parser": "8.56.1", + "@typescript-eslint/typescript-estree": "8.56.1", + "@typescript-eslint/utils": "8.56.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -9743,24 +9597,6 @@ "dev": true, "license": "ISC" }, - "node_modules/yaml": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", - "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", - "dev": true, - "license": "ISC", - "optional": true, - "peer": true, - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14.6" - }, - "funding": { - "url": "https://github.com/sponsors/eemeli" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index dbd2b76..73e24b3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "build": "next build", "dev": "next dev", "postinstall": "prisma generate", - "lint": "next lint", + "lint": "eslint .", "start": "next start", "test": "vitest", "db:generate": "prisma generate", @@ -26,23 +26,23 @@ "@trpc/server": "^10.45.3", "@types/react-select": "^5.0.1", "dayjs": "^1.11.11", - "dotenv": "^16.4.5", + "dotenv": "^17.3.1", "ldapts": "^7.0.11", - "lucide-react": "^0.511.0", - "next": "16.0.10", + "lucide-react": "^0.575.0", + "next": "^16.1.6", "next-auth": "^4.24.13", - "nodemailer": "^7.0.10", + "nodemailer": "^7.0.13", "papaparse": "^5.5.3", "rate-limiter-flexible": "^5.0.3", - "react": "19.2.1", - "react-dom": "19.2.1", - "react-hook-form": "^7.51.4", + "react": "^19.2.4", + "react-dom": "^19.2.4", + "react-hook-form": "^7.71.2", "react-select": "^5.8.0", - "superjson": "2.2.1", + "superjson": "^2.2.6", "zod": "^3.23.8" }, "devDependencies": { - "@eslint/js": "^9.39.1", + "@eslint/js": "^9.39.3", "@hookform/devtools": "^4.3.1", "@tailwindcss/typography": "^0.5.13", "@types/eslint": "^8.56.10", @@ -52,30 +52,31 @@ "@types/prettier": "^2.7.3", "@types/react": "19.2.7", "@types/react-dom": "19.2.3", - "@typescript-eslint/eslint-plugin": "^8.47.0", - "@typescript-eslint/parser": "^8.47.0", + "@typescript-eslint/eslint-plugin": "^8.56.1", + "@typescript-eslint/parser": "^8.56.1", "@vitejs/plugin-react": "^4.3.4", - "autoprefixer": "^10.4.19", + "autoprefixer": "^10.4.24", "daisyui": "^4.11.1", - "eslint": "^9.39.1", - "eslint-config-next": "16.0.7", + "eslint": "^9.39.3", + "eslint-config-next": "^16.1.6", "eslint-plugin-react": "^7.37.5", "globals": "^16.5.0", "jiti": "^2.6.1", "postcss": "^8.4.38", - "prettier": "^3.2.5", + "prettier": "^3.8.1", "prettier-plugin-tailwindcss": "^0.5.14", "prisma": "^5.22.0", "tailwindcss": "^3.4.3", "typescript": "^5.4.5", - "typescript-eslint": "^8.47.0", + "typescript-eslint": "^8.56.1", "vitest": "^3.0.9" }, "ct3aMetadata": { "initVersion": "7.10.3" }, "overrides": { + "minimatch": "^10.2.1", "@types/react": "19.2.7", "@types/react-dom": "19.2.3" } -} +} \ No newline at end of file diff --git a/src/components/FormElements/CategorySelector.tsx b/src/components/FormElements/CategorySelector.tsx index 73b370c..42e67f5 100644 --- a/src/components/FormElements/CategorySelector.tsx +++ b/src/components/FormElements/CategorySelector.tsx @@ -5,7 +5,7 @@ import Select from "react-select" type Props = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any + control: Control categories: Category[] | undefined } @@ -28,7 +28,6 @@ const CategorySelector = (props: Props) => { onChange={onChange} isMulti={true} onBlur={onBlur} - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment value={value} name={name} ref={ref} diff --git a/src/components/FormElements/GroupOrderSplit.tsx b/src/components/FormElements/GroupOrderSplit.tsx index c2d1743..fb8608b 100644 --- a/src/components/FormElements/GroupOrderSplit.tsx +++ b/src/components/FormElements/GroupOrderSplit.tsx @@ -1,14 +1,13 @@ import type { ProcurementItem } from "@prisma/client" import { useSession } from "next-auth/react" -import { ChangeEvent, useEffect, useRef, useState } from "react" +import { type ChangeEvent, useMemo, useRef, useState } from "react" import { z } from "zod" import { calculateAdditionalPricing } from "~/helper/dataProcessing" -import { Tid, id } from "~/helper/zodTypes" -import { RouterOutputs, api } from "~/utils/api" -import ActionResponsePopup, { AnimationHandle, animate } from "../General/ActionResponsePopup" +import { type Tid, id } from "~/helper/zodTypes" +import { type RouterOutputs, api } from "~/utils/api" +import ActionResponsePopup, { type AnimationHandle, animate } from "../General/ActionResponsePopup" import { ConfirmationModal } from "../General/ConfirmationModal" - type UserItemList = { [user: Tid]: { items: ProcurementItem[] @@ -56,6 +55,58 @@ type Props = { group: RouterOutputs["groupOrders"]["getInProgress"][number] } +const buildDerivedGroupData = (group: RouterOutputs["groupOrders"]["getInProgress"][number]) => { + const itemList: ProcurementItem[] = [] + const userItemList: UserItemList = {} + const baseSplit: Split[] = [] + + group.procurementWishes.forEach((element) => { + element.items.forEach((item) => { + itemList.push(item) + if (Object.keys(userItemList).includes(element.userId)) { + userItemList[element.userId]!.items.push(item) + } else { + userItemList[element.userId] = { + items: [item], + username: element.user.name ?? "", + } + } + }) + }) + + for (const proc of group.procurementWishes) { + const splitIndex = baseSplit.findIndex((split) => split.user === proc.userId) + if (splitIndex !== -1) { + baseSplit[splitIndex]!.procurementWishs.push({ + id: proc.id, + items: proc.items.map((item) => ({ + item, + defaultCost: 0, + overwritenCost: undefined, + finalCost: 0, + })), + }) + } else { + baseSplit.push({ + user: proc.userId, + procurementWishs: [ + { + id: proc.id, + items: proc.items.map((item) => ({ + item, + defaultCost: 0, + overwritenCost: undefined, + finalCost: 0, + })), + }, + ], + }) + } + } + + return { itemList, userItemList, baseSplit } +} + const GroupOrderSplit = (props: Props) => { const { group } = props @@ -65,157 +116,97 @@ const GroupOrderSplit = (props: Props) => { const allUserRequest = api.user.getAllUsers.useQuery() - const [itemList, setItemList] = useState([]) - const [userItemList, setUserItemList] = useState({}) - const [split, setSplit] = useState([]) - const [allUsersOverwritten, setAllUsersOverwritten] = useState() + const { itemList, userItemList, baseSplit } = useMemo(() => buildDerivedGroupData(group), [group]) + + const [overwrittenCosts, setOverwrittenCosts] = useState>({}) const [closeGroupOrderModalOpen, setCloseGroupOrderModalOpen] = useState(false) const [selectedDestination, setSelectedDestination] = useState(sessionData?.user.id.toString() ?? "") const [destinationError, setDestinationError] = useState(false) - // restructure data from group into (user)ItemList - useEffect(() => { - const itemList: ProcurementItem[] = [] - const userItemList: UserItemList = {} - group.procurementWishes.forEach((element) => { - element.items.forEach((item) => { - itemList.push(item) - if (Object.keys(userItemList).includes(element.userId)) { - userItemList[element.userId]!.items.push(item) - } else { - userItemList[element.userId] = { - items: [item], - username: element.user.name ?? "", - } - } - }) - }) - const groupOrderSplit: Split[] = [] - for (const proc of group.procurementWishes) { - const splitIndex = groupOrderSplit.findIndex((split) => split.user === proc.userId) - if (splitIndex !== -1) { - groupOrderSplit[splitIndex]!.procurementWishs.push({ - id: proc.id, - items: proc.items.map((item) => ({ - item: item, - defaultCost: 0, - overwritenCost: undefined, - finalCost: 0, - })), - }) - } else { - groupOrderSplit.push({ - user: proc.userId, - procurementWishs: [ - { - id: proc.id, - items: proc.items.map((item) => ({ - item, - defaultCost: 0, - overwritenCost: undefined, - finalCost: 0, - })), - }, - ], - }) - } - } - setSplit([...groupOrderSplit]) - setUserItemList({ ...userItemList }) - setItemList([...itemList]) - }, [JSON.stringify(group)]) - const totalItems = itemList.length const [totalAmount, setTotalAmount] = useState(0) const typeTotalAmount = (e: ChangeEvent) => { const userInput = e.currentTarget.value const value = parseFloat(userInput) - const pricePerItem = value / totalItems setTotalAmount(value) - setSplit((oldSplit) => - oldSplit.map((split) => ({ - ...split, - procurementWishs: split.procurementWishs.map((wish) => ({ - ...wish, - items: wish.items.map((item) => ({ - ...item, - defaultCost: pricePerItem, - overwritenCost: undefined, - finalCost: pricePerItem, - })), - })), - })), - ) } const overwriteUserExpence = ( e: ChangeEvent, - userId: Tid, - procID: Tid, - itemIndex: number, + itemId: Tid, ) => { const cost = parseFloat(e.currentTarget.value) - if (!Number.isNaN(cost)) { - setSplit((oldSplit) => { - const copy = [...oldSplit] - const splitIndex = copy.findIndex((split) => split.user === userId) - const procIndex = copy[splitIndex]!.procurementWishs.findIndex((wish) => wish.id === procID) - copy[splitIndex]!.procurementWishs[procIndex]!.items[itemIndex]!.overwritenCost = cost - return copy - }) - } else { - setSplit((oldSplit) => { - const copy = [...oldSplit] - const splitIndex = copy.findIndex((split) => split.user === userId) - const procIndex = copy[splitIndex]!.procurementWishs.findIndex((wish) => wish.id === procID) - copy[splitIndex]!.procurementWishs[procIndex]!.items[itemIndex]!.overwritenCost = undefined - return copy - }) - } - updateFinalCost() + setOverwrittenCosts((previous) => ({ + ...previous, + [itemId]: Number.isNaN(cost) ? undefined : cost, + })) } - const updateFinalCost = () => { - setSplit((oldSplit) => { - let overwrittenItems = 0 - let overwrittenItemsSum = 0 - - for (const userContent of oldSplit) { - for (const proc of userContent.procurementWishs) { - for (const item of proc.items) { - if (item.overwritenCost !== undefined) { - overwrittenItemsSum += item.overwritenCost - overwrittenItems += 1 - } + const split = useMemo(() => { + const defaultCost = totalItems > 0 ? totalAmount / totalItems : 0 + + const splitWithDefaults = baseSplit.map((userContent) => ({ + ...userContent, + procurementWishs: userContent.procurementWishs.map((proc) => ({ + ...proc, + items: proc.items.map((item) => ({ + ...item, + defaultCost, + overwritenCost: overwrittenCosts[item.item.id], + finalCost: defaultCost, + })), + })), + })) + + let overwrittenItems = 0 + let overwrittenItemsSum = 0 + + for (const userContent of splitWithDefaults) { + for (const proc of userContent.procurementWishs) { + for (const item of proc.items) { + if (item.overwritenCost !== undefined) { + overwrittenItemsSum += item.overwritenCost + overwrittenItems += 1 } } } - setAllUsersOverwritten(overwrittenItemsSum > totalAmount ? overwrittenItemsSum : undefined) - const pricePerRemainingItem = - totalAmount - overwrittenItemsSum > 0 - ? (totalAmount - overwrittenItemsSum) / (totalItems - overwrittenItems) - : 0 - const copy = [...oldSplit] - for (const [userIndex, userContent] of copy.entries()) { - for (const [procIndex, proc] of userContent.procurementWishs.entries()) { - for (const [itemIndex, item] of proc.items.entries()) { - if (item.overwritenCost !== undefined) { - copy[userIndex]!.procurementWishs[procIndex]!.items[itemIndex]!.finalCost = - item.overwritenCost - } else { - copy[userIndex]!.procurementWishs[procIndex]!.items[itemIndex]!.finalCost = - pricePerRemainingItem - } + } + + const remainingItems = totalItems - overwrittenItems + const pricePerRemainingItem = + totalAmount - overwrittenItemsSum > 0 && remainingItems > 0 + ? (totalAmount - overwrittenItemsSum) / remainingItems + : 0 + + return splitWithDefaults.map((userContent) => ({ + ...userContent, + procurementWishs: userContent.procurementWishs.map((proc) => ({ + ...proc, + items: proc.items.map((item) => ({ + ...item, + finalCost: item.overwritenCost ?? pricePerRemainingItem, + })), + })), + })) + }, [baseSplit, overwrittenCosts, totalAmount, totalItems]) + + const allUsersOverwritten = useMemo(() => { + let overwrittenItemsSum = 0 + for (const userContent of split) { + for (const proc of userContent.procurementWishs) { + for (const item of proc.items) { + if (item.overwritenCost !== undefined) { + overwrittenItemsSum += item.overwritenCost } } } - return copy - }) - } + } + return overwrittenItemsSum > totalAmount ? overwrittenItemsSum : undefined + }, [split, totalAmount]) const closeGroupOrderRequest = api.groupOrders.close.useMutation() - + const closeGroupOrder = async () => { if (!selectedDestination) { setDestinationError(true) @@ -293,7 +284,7 @@ const GroupOrderSplit = (props: Props) => { {split.map((userContent) => userContent.procurementWishs.map((proc) => - proc.items.map((item, itemIndex) => ( + proc.items.map((item) => ( {userItemList[userContent.user]?.username} {item.item.name} @@ -315,9 +306,7 @@ const GroupOrderSplit = (props: Props) => { step={0.01} min={0} value={item.overwritenCost || ""} - onChange={(e) => - overwriteUserExpence(e, userContent.user, proc.id, itemIndex) - } + onChange={(e) => overwriteUserExpence(e, item.item.id)} className="input input-sm input-bordered max-w-[6rem]" /> diff --git a/src/components/Forms/CategoryForm.tsx b/src/components/Forms/CategoryForm.tsx index cf1bcd5..0c7665b 100644 --- a/src/components/Forms/CategoryForm.tsx +++ b/src/components/Forms/CategoryForm.tsx @@ -3,7 +3,7 @@ import { useEffect } from "react" import type { SubmitHandler } from "react-hook-form" import { useForm } from "react-hook-form" import { z } from "zod" -import { Tid } from "~/helper/zodTypes" +import { type Tid } from "~/helper/zodTypes" import { api } from "~/utils/api" export const addCategoryValidationSchem = z.object({ diff --git a/src/components/Forms/ClearingAccountForm.tsx b/src/components/Forms/ClearingAccountForm.tsx index 120c254..0285f88 100644 --- a/src/components/Forms/ClearingAccountForm.tsx +++ b/src/components/Forms/ClearingAccountForm.tsx @@ -3,7 +3,7 @@ import { useEffect } from "react" import type { SubmitHandler } from "react-hook-form" import { useForm } from "react-hook-form" import { z } from "zod" -import { Tid } from "~/helper/zodTypes" +import { type Tid } from "~/helper/zodTypes" import { api } from "~/utils/api" export const validationSchema = z.object({ @@ -25,10 +25,6 @@ const ClearingAccountForm = (props: Props) => { type FormType = z.infer - useEffect(() => { - reset() - }, [props.id]) - const { register: addItemRegister, handleSubmit: addItemSubmit, @@ -37,6 +33,10 @@ const ClearingAccountForm = (props: Props) => { resolver: zodResolver(validationSchema), }) + useEffect(() => { + reset() + }, [props.id]) + const onSubmit: SubmitHandler = async (data) => { if (!!props.id) { await updateRequest.mutateAsync({ id: props.id, ...data }) diff --git a/src/components/Forms/GrouporderForm.tsx b/src/components/Forms/GrouporderForm.tsx index 3ecb38f..6f83528 100644 --- a/src/components/Forms/GrouporderForm.tsx +++ b/src/components/Forms/GrouporderForm.tsx @@ -4,9 +4,9 @@ import type { SubmitHandler } from "react-hook-form" import { useForm } from "react-hook-form" import { zodResolver } from "@hookform/resolvers/zod" import { z } from "zod" -import { id, Tid } from "~/helper/zodTypes" +import { id, type Tid } from "~/helper/zodTypes" import { api } from "~/utils/api" -import ActionResponsePopup, { AnimationHandle, animate } from "../General/ActionResponsePopup" +import ActionResponsePopup, { type AnimationHandle, animate } from "../General/ActionResponsePopup" export const validationSchema = z.object({ name: z.string().optional(), diff --git a/src/components/Forms/GrouporderTemplateForm.tsx b/src/components/Forms/GrouporderTemplateForm.tsx index d8a8c08..df37a57 100644 --- a/src/components/Forms/GrouporderTemplateForm.tsx +++ b/src/components/Forms/GrouporderTemplateForm.tsx @@ -4,7 +4,7 @@ import { z } from "zod" import { weekdays } from "~/helper/globalTypes" import { api } from "~/utils/api" import { zodResolver } from "@hookform/resolvers/zod" -import { Tid } from "~/helper/zodTypes" +import { type Tid } from "~/helper/zodTypes" import { useEffect } from "react" import { getTimeFromDateString } from "~/helper/dataProcessing" diff --git a/src/components/Forms/ItemForm.tsx b/src/components/Forms/ItemForm.tsx index 3a424b7..45e1084 100644 --- a/src/components/Forms/ItemForm.tsx +++ b/src/components/Forms/ItemForm.tsx @@ -3,7 +3,7 @@ import { useEffect } from "react" import type { SubmitHandler } from "react-hook-form" import { useForm } from "react-hook-form" import { z } from "zod" -import { Tid, formCategories, id } from "~/helper/zodTypes" +import { type Tid, formCategories, id } from "~/helper/zodTypes" import { api } from "~/utils/api" import CategorySelector from "../FormElements/CategorySelector" diff --git a/src/components/Forms/ProcurementItemForm.tsx b/src/components/Forms/ProcurementItemForm.tsx index ac55d92..1e0fc37 100644 --- a/src/components/Forms/ProcurementItemForm.tsx +++ b/src/components/Forms/ProcurementItemForm.tsx @@ -3,7 +3,7 @@ import { useEffect } from "react" import type { SubmitHandler } from "react-hook-form" import { useForm } from "react-hook-form" import { z } from "zod" -import { Tid, formCategories, id } from "~/helper/zodTypes" +import { type Tid, formCategories, id } from "~/helper/zodTypes" import { api } from "~/utils/api" import CategorySelector from "../FormElements/CategorySelector" diff --git a/src/components/Forms/UserForm.tsx b/src/components/Forms/UserForm.tsx index 018ec90..bfb9d02 100644 --- a/src/components/Forms/UserForm.tsx +++ b/src/components/Forms/UserForm.tsx @@ -1,9 +1,9 @@ import { zodResolver } from "@hookform/resolvers/zod" -import { use, useEffect, useState } from "react" +import { use, useState } from "react" import type { SubmitHandler } from "react-hook-form" import { useForm } from "react-hook-form" import { z } from "zod" -import { Tid } from "~/helper/zodTypes" +import { type Tid } from "~/helper/zodTypes" import { api } from "~/utils/api" type Props = { @@ -14,14 +14,8 @@ const UserForm = (props: Props) => { const trpcUtils = api.useUtils() const updateRequest = api.user.updateUser.useMutation() const userDate = api.user.getUser.useQuery({ id: props.id! }, { enabled: !!props.id }) - - useEffect(() => { - if (userDate.data) { - setAllowOverdraw(userDate.data.allowOverdraw) - } - }, [userDate.data, props.id ?? ""]) - - const [allowOverdraw, setAllowOverdraw] = useState(false) + const [allowOverdrawOverride, setAllowOverdrawOverride] = useState(null) + const allowOverdraw = allowOverdrawOverride ?? userDate.data?.allowOverdraw ?? false const save = async () => { if (!!props.id) { @@ -44,7 +38,7 @@ const UserForm = (props: Props) => { type="checkbox" className="checkbox" checked={allowOverdraw} - onClick={() => setAllowOverdraw((s) => !s)} + onClick={() => setAllowOverdrawOverride(!allowOverdraw)} /> diff --git a/src/components/General/ActionResponsePopup.tsx b/src/components/General/ActionResponsePopup.tsx index 19c4b77..1a567aa 100644 --- a/src/components/General/ActionResponsePopup.tsx +++ b/src/components/General/ActionResponsePopup.tsx @@ -4,7 +4,7 @@ import { useImperativeHandle, useState, useCallback, - useEffect, + useSyncExternalStore, } from "react" import { CheckCircle, AlertCircle } from "lucide-react" import { createPortal } from "react-dom" @@ -37,14 +37,14 @@ const ActionResponsePopup = forwardRef(function ActionR _props, ref ) { + const isClient = useSyncExternalStore( + () => () => undefined, + () => true, + () => false, + ) const [isOpen, setIsOpen] = useState(false) const [status, setStatus] = useState("success") const [message, setMessage] = useState("") - const [isMounted, setIsMounted] = useState(false) - - useEffect(() => { - setIsMounted(true) - }, []) const reset = useCallback(() => { setIsOpen(false) @@ -73,7 +73,7 @@ const ActionResponsePopup = forwardRef(function ActionR const IconComponent = status === "success" ? CheckCircle : AlertCircle const iconColorClass = status === "success" ? "text-green-500" : "text-red-500" - if (!isMounted) { + if (!isClient) { return null } diff --git a/src/components/General/BuyItemCard.tsx b/src/components/General/BuyItemCard.tsx index 71466f1..7677a71 100644 --- a/src/components/General/BuyItemCard.tsx +++ b/src/components/General/BuyItemCard.tsx @@ -114,6 +114,7 @@ const BuyItemCard = ({ item, buyAction, buttonName, userBalance }: Props) => { cancelText="Abbrechen" proceedText="Jetzt kaufen" proceedButtonClass="btn btn-primary" + className="z-[70]" >

diff --git a/src/components/General/ConfirmationModal.tsx b/src/components/General/ConfirmationModal.tsx index c41e611..b8f6660 100644 --- a/src/components/General/ConfirmationModal.tsx +++ b/src/components/General/ConfirmationModal.tsx @@ -1,4 +1,4 @@ -import { PropsWithChildren, useEffect, useState } from "react" +import { HTMLProps, type PropsWithChildren, useSyncExternalStore } from "react" import { createPortal } from "react-dom" type Props = { @@ -9,27 +9,30 @@ type Props = { cancelText?: string proceedText?: string proceedButtonClass?: string + className?: HTMLProps["className"] } export const ConfirmationModal = (props: PropsWithChildren) => { - const [isMounted, setIsMounted] = useState(false) - - useEffect(() => { - setIsMounted(true) - }, []) + const isClient = useSyncExternalStore( + () => () => undefined, + () => true, + () => false, + ) const onProceedClick = () => { props.close() props.proceed() } - if (!isMounted) { + if (!isClient) { return null } return createPortal( <> -

-
+ +