- améliore l'export/import (format de fichiers en paramètres, amélioration de la robustesse, )
- ajout bouton tout effacer des propositions et participants
This commit is contained in:
188
package-lock.json
generated
188
package-lock.json
generated
@@ -21,6 +21,7 @@
|
||||
"@supabase/supabase-js": "^2.56.0",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/nodemailer": "^7.0.1",
|
||||
"@types/qrcode": "^1.5.5",
|
||||
"@types/xlsx": "^0.0.35",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@@ -29,6 +30,7 @@
|
||||
"lucide-react": "^0.541.0",
|
||||
"next": "15.5.0",
|
||||
"nodemailer": "^7.0.5",
|
||||
"qrcode": "^1.5.4",
|
||||
"react": "19.1.0",
|
||||
"react-dom": "19.1.0",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
@@ -5105,6 +5107,15 @@
|
||||
"integrity": "sha512-PIzZZlEppgrpoT2QgbnDU+MMzuR6BbCjllj0bM70lWoejMeNJAxCchxnv7J3XFkI8MpygtRpzXrIlmWUBclP5A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/qrcode": {
|
||||
"version": "1.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.5.tgz",
|
||||
"integrity": "sha512-CdfBi/e3Qk+3Z/fXYShipBT13OJ2fDO2Q2w5CIP5anLTLIndQG9z6P1cnm+8zCWSpm5dnxMFd/uREtb0EXuQzg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/react": {
|
||||
"version": "19.1.11",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.11.tgz",
|
||||
@@ -5861,7 +5872,6 @@
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -5871,7 +5881,6 @@
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
@@ -6423,7 +6432,6 @@
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
@@ -6637,7 +6645,6 @@
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
@@ -6650,7 +6657,6 @@
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"devOptional": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/color-string": {
|
||||
@@ -6922,6 +6928,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/decamelize": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
|
||||
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/decimal.js": {
|
||||
"version": "10.6.0",
|
||||
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
|
||||
@@ -7054,6 +7069,12 @@
|
||||
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dijkstrajs": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
|
||||
"integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/doctrine": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
|
||||
@@ -8189,7 +8210,6 @@
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
@@ -8855,7 +8875,6 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -11392,7 +11411,6 @@
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
@@ -11447,7 +11465,6 @@
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
@@ -11632,6 +11649,15 @@
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pngjs": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
||||
"integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/possible-typed-array-names": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
|
||||
@@ -11785,6 +11811,127 @@
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/qrcode": {
|
||||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
|
||||
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dijkstrajs": "^1.0.1",
|
||||
"pngjs": "^5.0.0",
|
||||
"yargs": "^15.3.1"
|
||||
},
|
||||
"bin": {
|
||||
"qrcode": "bin/qrcode"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode/node_modules/cliui": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
|
||||
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^4.2.0",
|
||||
"strip-ansi": "^6.0.0",
|
||||
"wrap-ansi": "^6.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode/node_modules/find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"locate-path": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode/node_modules/locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-locate": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode/node_modules/p-limit": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
|
||||
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-try": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode/node_modules/p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-limit": "^2.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode/node_modules/y18n": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
|
||||
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/qrcode/node_modules/yargs": {
|
||||
"version": "15.4.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
|
||||
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cliui": "^6.0.0",
|
||||
"decamelize": "^1.2.0",
|
||||
"find-up": "^4.1.0",
|
||||
"get-caller-file": "^2.0.1",
|
||||
"require-directory": "^2.1.1",
|
||||
"require-main-filename": "^2.0.0",
|
||||
"set-blocking": "^2.0.0",
|
||||
"string-width": "^4.2.0",
|
||||
"which-module": "^2.0.0",
|
||||
"y18n": "^4.0.0",
|
||||
"yargs-parser": "^18.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/qrcode/node_modules/yargs-parser": {
|
||||
"version": "18.1.3",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
|
||||
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"camelcase": "^5.0.0",
|
||||
"decamelize": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/querystringify": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
@@ -11972,12 +12119,17 @@
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/require-main-filename": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
|
||||
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
@@ -12188,6 +12340,12 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/set-function-length": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
||||
@@ -12541,7 +12699,6 @@
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
@@ -12556,7 +12713,6 @@
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/string.prototype.includes": {
|
||||
@@ -12676,7 +12832,6 @@
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
@@ -13476,6 +13631,12 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/which-module": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
|
||||
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/which-typed-array": {
|
||||
"version": "1.1.19",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz",
|
||||
@@ -13530,7 +13691,6 @@
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
||||
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"@supabase/supabase-js": "^2.56.0",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/nodemailer": "^7.0.1",
|
||||
"@types/qrcode": "^1.5.5",
|
||||
"@types/xlsx": "^0.0.35",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
@@ -37,6 +38,7 @@
|
||||
"lucide-react": "^0.541.0",
|
||||
"next": "15.5.0",
|
||||
"nodemailer": "^7.0.5",
|
||||
"qrcode": "^1.5.4",
|
||||
"react": "19.1.0",
|
||||
"react-dom": "19.1.0",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
|
||||
@@ -9,6 +9,7 @@ import EditParticipantModal from '@/components/EditParticipantModal';
|
||||
import DeleteParticipantModal from '@/components/DeleteParticipantModal';
|
||||
import ImportFileModal from '@/components/ImportFileModal';
|
||||
import SendParticipantEmailModal from '@/components/SendParticipantEmailModal';
|
||||
import ClearAllParticipantsModal from '@/components/ClearAllParticipantsModal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -31,6 +32,7 @@ function CampaignParticipantsPageContent() {
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [showImportModal, setShowImportModal] = useState(false);
|
||||
const [showSendEmailModal, setShowSendEmailModal] = useState(false);
|
||||
const [showClearAllModal, setShowClearAllModal] = useState(false);
|
||||
const [selectedParticipant, setSelectedParticipant] = useState<Participant | null>(null);
|
||||
const [copiedParticipantId, setCopiedParticipantId] = useState<string | null>(null);
|
||||
|
||||
@@ -87,9 +89,9 @@ function CampaignParticipantsPageContent() {
|
||||
try {
|
||||
const participantsToCreate = data.map(row => ({
|
||||
campaign_id: campaignId,
|
||||
first_name: row.first_name || '',
|
||||
last_name: row.last_name || '',
|
||||
email: row.email || ''
|
||||
first_name: row.Prénom || '',
|
||||
last_name: row.Nom || '',
|
||||
email: row.Email || ''
|
||||
}));
|
||||
|
||||
// Créer les participants un par un
|
||||
@@ -103,6 +105,16 @@ function CampaignParticipantsPageContent() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleClearAllParticipants = async () => {
|
||||
try {
|
||||
await participantService.deleteAllByCampaign(campaignId);
|
||||
loadData();
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la suppression des participants:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const getInitials = (firstName: string, lastName: string) => {
|
||||
return `${firstName.charAt(0)}${lastName.charAt(0)}`.toUpperCase();
|
||||
};
|
||||
@@ -182,6 +194,16 @@ function CampaignParticipantsPageContent() {
|
||||
<Upload className="w-4 h-4 mr-2" />
|
||||
Importer
|
||||
</Button>
|
||||
{participants.length > 0 && (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => setShowClearAllModal(true)}
|
||||
className="text-red-600 border-red-200 hover:bg-red-50 hover:border-red-300 dark:text-red-400 dark:border-red-800 dark:hover:bg-red-900/20"
|
||||
>
|
||||
<User className="w-4 h-4 mr-2" />
|
||||
Tout effacer
|
||||
</Button>
|
||||
)}
|
||||
<Button onClick={() => setShowAddModal(true)} size="lg">
|
||||
✨ Nouveau participant
|
||||
</Button>
|
||||
@@ -377,6 +399,14 @@ function CampaignParticipantsPageContent() {
|
||||
campaign={campaign}
|
||||
/>
|
||||
)}
|
||||
|
||||
<ClearAllParticipantsModal
|
||||
isOpen={showClearAllModal}
|
||||
onClose={() => setShowClearAllModal(false)}
|
||||
onConfirm={handleClearAllParticipants}
|
||||
campaignTitle={campaign?.title}
|
||||
participantCount={participants.length}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -8,6 +8,8 @@ import AddPropositionModal from '@/components/AddPropositionModal';
|
||||
import EditPropositionModal from '@/components/EditPropositionModal';
|
||||
import DeletePropositionModal from '@/components/DeletePropositionModal';
|
||||
import ImportFileModal from '@/components/ImportFileModal';
|
||||
import ExportPropositionsButton from '@/components/ExportPropositionsButton';
|
||||
import ClearAllPropositionsModal from '@/components/ClearAllPropositionsModal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
|
||||
@@ -29,6 +31,7 @@ function CampaignPropositionsPageContent() {
|
||||
const [showEditModal, setShowEditModal] = useState(false);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [showImportModal, setShowImportModal] = useState(false);
|
||||
const [showClearAllModal, setShowClearAllModal] = useState(false);
|
||||
const [selectedProposition, setSelectedProposition] = useState<Proposition | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -84,11 +87,11 @@ function CampaignPropositionsPageContent() {
|
||||
try {
|
||||
const propositionsToCreate = data.map(row => ({
|
||||
campaign_id: campaignId,
|
||||
title: row.title || '',
|
||||
description: row.description || '',
|
||||
author_first_name: row.author_first_name || 'admin',
|
||||
author_last_name: row.author_last_name || 'admin',
|
||||
author_email: row.author_email || 'admin@example.com'
|
||||
title: row.Titre || '',
|
||||
description: row.Description || '',
|
||||
author_first_name: row.Prénom || 'admin',
|
||||
author_last_name: row.Nom || 'admin',
|
||||
author_email: row.Email || 'admin@example.com'
|
||||
}));
|
||||
|
||||
// Créer les propositions une par une
|
||||
@@ -102,7 +105,15 @@ function CampaignPropositionsPageContent() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const handleClearAllPropositions = async () => {
|
||||
try {
|
||||
await propositionService.deleteAllByCampaign(campaignId);
|
||||
loadData();
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la suppression des propositions:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const getInitials = (firstName: string, lastName: string) => {
|
||||
return `${firstName.charAt(0)}${lastName.charAt(0)}`.toUpperCase();
|
||||
@@ -171,6 +182,20 @@ function CampaignPropositionsPageContent() {
|
||||
<Upload className="w-4 h-4 mr-2" />
|
||||
Importer
|
||||
</Button>
|
||||
<ExportPropositionsButton
|
||||
propositions={propositions}
|
||||
campaignTitle={campaign.title}
|
||||
/>
|
||||
{propositions.length > 0 && (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => setShowClearAllModal(true)}
|
||||
className="text-red-600 border-red-200 hover:bg-red-50 hover:border-red-300 dark:text-red-400 dark:border-red-800 dark:hover:bg-red-900/20"
|
||||
>
|
||||
<FileText className="w-4 h-4 mr-2" />
|
||||
Tout effacer
|
||||
</Button>
|
||||
)}
|
||||
<Button onClick={() => setShowAddModal(true)} size="lg">
|
||||
✨ Nouvelle proposition
|
||||
</Button>
|
||||
@@ -299,6 +324,14 @@ function CampaignPropositionsPageContent() {
|
||||
type="propositions"
|
||||
campaignTitle={campaign?.title}
|
||||
/>
|
||||
|
||||
<ClearAllPropositionsModal
|
||||
isOpen={showClearAllModal}
|
||||
onClose={() => setShowClearAllModal(false)}
|
||||
onConfirm={handleClearAllPropositions}
|
||||
campaignTitle={campaign?.title}
|
||||
propositionCount={propositions.length}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -7,6 +7,7 @@ import { authService } from '@/lib/auth';
|
||||
import CreateCampaignModal from '@/components/CreateCampaignModal';
|
||||
import EditCampaignModal from '@/components/EditCampaignModal';
|
||||
import DeleteCampaignModal from '@/components/DeleteCampaignModal';
|
||||
import ShareModal from '@/components/ShareModal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
@@ -14,7 +15,7 @@ import { Badge } from '@/components/ui/badge';
|
||||
|
||||
import AuthGuard from '@/components/AuthGuard';
|
||||
import Footer from '@/components/Footer';
|
||||
import { FolderOpen, Users, FileText, Plus, BarChart3, Settings, Check, Copy, Mail } from 'lucide-react';
|
||||
import { FolderOpen, Users, FileText, Plus, BarChart3, Settings, Check, Copy, Mail, Share2 } from 'lucide-react';
|
||||
import StatusSwitch from '@/components/StatusSwitch';
|
||||
import { MarkdownContent } from '@/components/MarkdownContent';
|
||||
|
||||
@@ -27,6 +28,7 @@ function AdminPageContent() {
|
||||
const [showCreateModal, setShowCreateModal] = useState(false);
|
||||
const [showEditModal, setShowEditModal] = useState(false);
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
const [showShareModal, setShowShareModal] = useState(false);
|
||||
const [selectedCampaign, setSelectedCampaign] = useState<Campaign | null>(null);
|
||||
|
||||
const [copiedCampaignId, setCopiedCampaignId] = useState<string | null>(null);
|
||||
@@ -433,6 +435,18 @@ function AdminPageContent() {
|
||||
<Copy className="w-3 h-3" />
|
||||
)}
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="h-7 w-7 p-0 text-slate-400 hover:text-slate-600"
|
||||
onClick={() => {
|
||||
setSelectedCampaign(campaign);
|
||||
setShowShareModal(true);
|
||||
}}
|
||||
title="Partager le lien"
|
||||
>
|
||||
<Share2 className="w-3 h-3" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -474,6 +488,14 @@ function AdminPageContent() {
|
||||
{selectedCampaign && (
|
||||
<DeleteCampaignModal isOpen={showDeleteModal} onClose={() => setShowDeleteModal(false)} onSuccess={handleCampaignDeleted} campaign={selectedCampaign} />
|
||||
)}
|
||||
{selectedCampaign && (
|
||||
<ShareModal
|
||||
isOpen={showShareModal}
|
||||
onClose={() => setShowShareModal(false)}
|
||||
campaignTitle={selectedCampaign.title}
|
||||
depositUrl={`${window.location.origin}/p/${selectedCampaign.slug || 'campagne'}`}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Footer */}
|
||||
<Footer />
|
||||
|
||||
@@ -12,6 +12,7 @@ import Footer from '@/components/Footer';
|
||||
import SmtpSettingsForm from '@/components/SmtpSettingsForm';
|
||||
import { Settings, Monitor, Save, CheckCircle, Mail, FileText, Download } from 'lucide-react';
|
||||
import { ExportAnonymizationSelect, AnonymizationLevel } from '@/components/ExportAnonymizationSelect';
|
||||
import { ExportFileFormatSelect, ExportFileFormat } from '@/components/ExportFileFormatSelect';
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
@@ -24,6 +25,18 @@ function SettingsPageContent() {
|
||||
const [proposePageMessage, setProposePageMessage] = useState('');
|
||||
const [footerMessage, setFooterMessage] = useState('');
|
||||
const [exportAnonymization, setExportAnonymization] = useState<AnonymizationLevel>('full');
|
||||
const [exportFileFormat, setExportFileFormat] = useState<ExportFileFormat>('ods');
|
||||
|
||||
// États pour la détection des modifications
|
||||
const [hasUnsavedChanges, setHasUnsavedChanges] = useState(false);
|
||||
const [originalValues, setOriginalValues] = useState<{
|
||||
randomizePropositions: boolean;
|
||||
proposePageMessage: string;
|
||||
footerMessage: string;
|
||||
exportAnonymization: AnonymizationLevel;
|
||||
exportFileFormat: ExportFileFormat;
|
||||
} | null>(null);
|
||||
const [autoSaved, setAutoSaved] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// Vérifier la configuration Supabase
|
||||
@@ -42,6 +55,34 @@ function SettingsPageContent() {
|
||||
loadSettings();
|
||||
}, []);
|
||||
|
||||
// Détecter les modifications
|
||||
useEffect(() => {
|
||||
if (!originalValues) return;
|
||||
|
||||
const hasChanges =
|
||||
randomizePropositions !== originalValues.randomizePropositions ||
|
||||
proposePageMessage !== originalValues.proposePageMessage ||
|
||||
footerMessage !== originalValues.footerMessage ||
|
||||
exportAnonymization !== originalValues.exportAnonymization ||
|
||||
exportFileFormat !== originalValues.exportFileFormat;
|
||||
|
||||
setHasUnsavedChanges(hasChanges);
|
||||
}, [randomizePropositions, proposePageMessage, footerMessage, exportAnonymization, exportFileFormat, originalValues]);
|
||||
|
||||
// Avertissement avant de quitter la page
|
||||
useEffect(() => {
|
||||
const handleBeforeUnload = (e: BeforeUnloadEvent) => {
|
||||
if (hasUnsavedChanges) {
|
||||
e.preventDefault();
|
||||
e.returnValue = 'Vous avez des modifications non sauvegardées. Êtes-vous sûr de vouloir quitter ?';
|
||||
return e.returnValue;
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('beforeunload', handleBeforeUnload);
|
||||
return () => window.removeEventListener('beforeunload', handleBeforeUnload);
|
||||
}, [hasUnsavedChanges]);
|
||||
|
||||
const loadSettings = async () => {
|
||||
try {
|
||||
setLoading(true);
|
||||
@@ -63,6 +104,19 @@ function SettingsPageContent() {
|
||||
// Charger le niveau d'anonymisation des exports
|
||||
const anonymizationValue = await settingsService.getStringValue('export_anonymization', 'full') as AnonymizationLevel;
|
||||
setExportAnonymization(anonymizationValue);
|
||||
|
||||
// Charger le format de fichier d'export
|
||||
const fileFormatValue = await settingsService.getStringValue('export_file_format', 'ods') as ExportFileFormat;
|
||||
setExportFileFormat(fileFormatValue);
|
||||
|
||||
// Stocker les valeurs originales pour la détection des modifications
|
||||
setOriginalValues({
|
||||
randomizePropositions: randomizeValue,
|
||||
proposePageMessage: messageValue,
|
||||
footerMessage: footerValue,
|
||||
exportAnonymization: anonymizationValue,
|
||||
exportFileFormat: fileFormatValue
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Erreur lors du chargement des paramètres:', error);
|
||||
} finally {
|
||||
@@ -72,17 +126,82 @@ function SettingsPageContent() {
|
||||
|
||||
const handleRandomizeChange = async (checked: boolean) => {
|
||||
setRandomizePropositions(checked);
|
||||
// Sauvegarde automatique pour ce paramètre
|
||||
try {
|
||||
await settingsService.setBooleanValue('randomize_propositions', checked);
|
||||
// Mettre à jour les valeurs originales
|
||||
if (originalValues) {
|
||||
setOriginalValues({
|
||||
...originalValues,
|
||||
randomizePropositions: checked
|
||||
});
|
||||
}
|
||||
// Afficher la confirmation de sauvegarde automatique
|
||||
setAutoSaved(true);
|
||||
setTimeout(() => setAutoSaved(false), 2000);
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la sauvegarde automatique:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleExportAnonymizationChange = async (value: AnonymizationLevel) => {
|
||||
setExportAnonymization(value);
|
||||
// Sauvegarde automatique pour ce paramètre
|
||||
try {
|
||||
await settingsService.setStringValue('export_anonymization', value);
|
||||
// Mettre à jour les valeurs originales
|
||||
if (originalValues) {
|
||||
setOriginalValues({
|
||||
...originalValues,
|
||||
exportAnonymization: value
|
||||
});
|
||||
}
|
||||
// Afficher la confirmation de sauvegarde automatique
|
||||
setAutoSaved(true);
|
||||
setTimeout(() => setAutoSaved(false), 2000);
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la sauvegarde automatique:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleExportFileFormatChange = async (value: ExportFileFormat) => {
|
||||
setExportFileFormat(value);
|
||||
// Sauvegarde automatique pour ce paramètre
|
||||
try {
|
||||
await settingsService.setStringValue('export_file_format', value);
|
||||
// Mettre à jour les valeurs originales
|
||||
if (originalValues) {
|
||||
setOriginalValues({
|
||||
...originalValues,
|
||||
exportFileFormat: value
|
||||
});
|
||||
}
|
||||
// Afficher la confirmation de sauvegarde automatique
|
||||
setAutoSaved(true);
|
||||
setTimeout(() => setAutoSaved(false), 2000);
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la sauvegarde automatique:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSave = async () => {
|
||||
try {
|
||||
setSaving(true);
|
||||
await settingsService.setBooleanValue('randomize_propositions', randomizePropositions);
|
||||
// Sauvegarder seulement les paramètres qui ne sont pas sauvegardés automatiquement
|
||||
await settingsService.setStringValue('propose_page_message', proposePageMessage);
|
||||
await settingsService.setStringValue('footer_message', footerMessage);
|
||||
await settingsService.setStringValue('export_anonymization', exportAnonymization);
|
||||
|
||||
// Mettre à jour les valeurs originales
|
||||
setOriginalValues({
|
||||
randomizePropositions,
|
||||
proposePageMessage,
|
||||
footerMessage,
|
||||
exportAnonymization,
|
||||
exportFileFormat
|
||||
});
|
||||
|
||||
setSaved(true);
|
||||
setTimeout(() => setSaved(false), 2000);
|
||||
setTimeout(() => setSaved(false), 3000); // Message plus long pour les textes
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la sauvegarde des paramètres:', error);
|
||||
} finally {
|
||||
@@ -115,13 +234,36 @@ function SettingsPageContent() {
|
||||
<div className="mb-8">
|
||||
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
|
||||
<div>
|
||||
<div className="flex items-center gap-3">
|
||||
<h1 className="text-3xl font-bold text-slate-900 dark:text-slate-100">Paramètres</h1>
|
||||
<p className="text-slate-600 dark:text-slate-300 mt-2">Configurez les paramètres de l'application</p>
|
||||
{hasUnsavedChanges && (
|
||||
<div className="flex items-center gap-2 px-3 py-1 bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-300 rounded-full text-sm font-medium">
|
||||
<div className="w-2 h-2 bg-orange-500 rounded-full animate-pulse"></div>
|
||||
Modifications non sauvegardées
|
||||
</div>
|
||||
)}
|
||||
{autoSaved && (
|
||||
<div className="flex items-center gap-2 px-3 py-1 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300 rounded-full text-sm font-medium">
|
||||
<CheckCircle className="w-4 h-4" />
|
||||
Sauvegardé automatiquement
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-slate-600 dark:text-slate-300 mt-2">
|
||||
{hasUnsavedChanges
|
||||
? 'Vous avez des modifications non sauvegardées. N\'oubliez pas de cliquer sur "Sauvegarder".'
|
||||
: 'Configurez les paramètres de l\'application'
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
disabled={saving}
|
||||
className="flex items-center gap-2"
|
||||
disabled={saving || !hasUnsavedChanges}
|
||||
className={`flex items-center gap-2 ${
|
||||
hasUnsavedChanges
|
||||
? 'bg-orange-600 hover:bg-orange-700 text-white'
|
||||
: ''
|
||||
}`}
|
||||
>
|
||||
{saving ? (
|
||||
<>
|
||||
@@ -207,13 +349,25 @@ function SettingsPageContent() {
|
||||
Ce texte apparaît sous le titre de la campagne pour inviter les utilisateurs à déposer des propositions.
|
||||
</p>
|
||||
</div>
|
||||
<div className="relative">
|
||||
<textarea
|
||||
id="propose-page-message"
|
||||
value={proposePageMessage}
|
||||
onChange={(e) => setProposePageMessage(e.target.value)}
|
||||
className="w-full min-h-[100px] p-3 border border-slate-200 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 resize-y"
|
||||
className={`w-full min-h-[100px] p-3 border rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 resize-y ${
|
||||
originalValues && proposePageMessage !== originalValues.proposePageMessage
|
||||
? 'border-orange-300 dark:border-orange-600 bg-orange-50 dark:bg-orange-900/20'
|
||||
: 'border-slate-200 dark:border-slate-700'
|
||||
}`}
|
||||
placeholder="Entrez votre message d'invitation..."
|
||||
/>
|
||||
{originalValues && proposePageMessage !== originalValues.proposePageMessage && (
|
||||
<div className="absolute top-2 right-2 flex items-center gap-1 px-2 py-1 bg-orange-100 dark:bg-orange-900/50 text-orange-700 dark:text-orange-300 rounded text-xs font-medium">
|
||||
<div className="w-1.5 h-1.5 bg-orange-500 rounded-full animate-pulse"></div>
|
||||
Modifié
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Footer Message Setting */}
|
||||
@@ -226,13 +380,25 @@ function SettingsPageContent() {
|
||||
Ce texte apparaît en bas des pages publiques. Vous pouvez utiliser <code className="bg-slate-100 dark:bg-slate-700 px-1 rounded text-xs">[texte du lien](GITURL)</code> pour insérer un lien vers le repository Git.
|
||||
</p>
|
||||
</div>
|
||||
<div className="relative">
|
||||
<textarea
|
||||
id="footer-message"
|
||||
value={footerMessage}
|
||||
onChange={(e) => setFooterMessage(e.target.value)}
|
||||
className="w-full min-h-[80px] p-3 border border-slate-200 dark:border-slate-700 rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 resize-y"
|
||||
className={`w-full min-h-[80px] p-3 border rounded-lg bg-white dark:bg-slate-800 text-slate-900 dark:text-slate-100 resize-y ${
|
||||
originalValues && footerMessage !== originalValues.footerMessage
|
||||
? 'border-orange-300 dark:border-orange-600 bg-orange-50 dark:bg-orange-900/20'
|
||||
: 'border-slate-200 dark:border-slate-700'
|
||||
}`}
|
||||
placeholder="Entrez votre message de bas de page..."
|
||||
/>
|
||||
{originalValues && footerMessage !== originalValues.footerMessage && (
|
||||
<div className="absolute top-2 right-2 flex items-center gap-1 px-2 py-1 bg-orange-100 dark:bg-orange-900/50 text-orange-700 dark:text-orange-300 rounded text-xs font-medium">
|
||||
<div className="w-1.5 h-1.5 bg-orange-500 rounded-full animate-pulse"></div>
|
||||
Modifié
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
@@ -253,10 +419,14 @@ function SettingsPageContent() {
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-6">
|
||||
<div className="p-4 bg-slate-50 dark:bg-slate-800 rounded-lg">
|
||||
<div className="p-4 bg-slate-50 dark:bg-slate-800 rounded-lg space-y-6">
|
||||
<ExportAnonymizationSelect
|
||||
value={exportAnonymization}
|
||||
onValueChange={setExportAnonymization}
|
||||
onValueChange={handleExportAnonymizationChange}
|
||||
/>
|
||||
<ExportFileFormatSelect
|
||||
value={exportFileFormat}
|
||||
onValueChange={handleExportFileFormatChange}
|
||||
/>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
125
src/components/ClearAllParticipantsModal.tsx
Normal file
125
src/components/ClearAllParticipantsModal.tsx
Normal file
@@ -0,0 +1,125 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { AlertTriangle, Trash2 } from 'lucide-react';
|
||||
import { BaseModal } from './base/BaseModal';
|
||||
import { ErrorDisplay } from './base/ErrorDisplay';
|
||||
|
||||
interface ClearAllParticipantsModalProps {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
onConfirm: () => Promise<void>;
|
||||
campaignTitle?: string;
|
||||
participantCount: number;
|
||||
}
|
||||
|
||||
export default function ClearAllParticipantsModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
onConfirm,
|
||||
campaignTitle,
|
||||
participantCount
|
||||
}: ClearAllParticipantsModalProps) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const handleConfirm = async () => {
|
||||
setLoading(true);
|
||||
setError('');
|
||||
|
||||
try {
|
||||
await onConfirm();
|
||||
onClose();
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la suppression des participants:', error);
|
||||
setError('Erreur lors de la suppression des participants.');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
if (!loading) {
|
||||
setError('');
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
const footer = (
|
||||
<>
|
||||
<Button variant="outline" onClick={handleClose} disabled={loading}>
|
||||
Annuler
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
onClick={handleConfirm}
|
||||
disabled={loading}
|
||||
className="bg-red-600 hover:bg-red-700"
|
||||
>
|
||||
{loading ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||
Suppression...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Trash2 className="w-4 h-4 mr-2" />
|
||||
Tout effacer
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<BaseModal
|
||||
isOpen={isOpen}
|
||||
onClose={handleClose}
|
||||
title="Effacer tous les participants"
|
||||
description={`Cette action supprimera définitivement tous les participants de la campagne.${campaignTitle ? ` Campagne : ${campaignTitle}` : ''}`}
|
||||
footer={footer}
|
||||
maxWidth="sm:max-w-md"
|
||||
>
|
||||
<ErrorDisplay error={error} />
|
||||
|
||||
<Alert className="border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800">
|
||||
<AlertTriangle className="h-4 w-4 text-red-600 dark:text-red-400" />
|
||||
<AlertDescription className="text-red-800 dark:text-red-200">
|
||||
<strong>Attention :</strong> Cette action est irréversible.
|
||||
{participantCount > 0 && (
|
||||
<>
|
||||
{' '}Vous êtes sur le point de supprimer <strong>{participantCount} participant{participantCount > 1 ? 's' : ''}</strong>.
|
||||
</>
|
||||
)}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
<div className="mt-4 p-4 bg-slate-50 dark:bg-slate-800 rounded-lg">
|
||||
<h4 className="font-medium text-slate-900 dark:text-slate-100 mb-2">
|
||||
Que sera supprimé :
|
||||
</h4>
|
||||
<ul className="text-sm text-slate-600 dark:text-slate-300 space-y-1">
|
||||
<li>• Tous les participants de la campagne</li>
|
||||
<li>• Les noms et prénoms des participants</li>
|
||||
<li>• Les adresses email des participants</li>
|
||||
<li>• Tous les votes associés aux participants</li>
|
||||
<li>• Les liens de vote personnalisés</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg">
|
||||
<h4 className="font-medium text-blue-900 dark:text-blue-100 mb-2">
|
||||
Ce qui sera conservé :
|
||||
</h4>
|
||||
<ul className="text-sm text-blue-800 dark:text-blue-200 space-y-1">
|
||||
<li>• La campagne elle-même</li>
|
||||
<li>• Les propositions</li>
|
||||
<li>• Les paramètres de la campagne</li>
|
||||
<li>• L'historique des modifications</li>
|
||||
</ul>
|
||||
</div>
|
||||
</BaseModal>
|
||||
);
|
||||
}
|
||||
124
src/components/ClearAllPropositionsModal.tsx
Normal file
124
src/components/ClearAllPropositionsModal.tsx
Normal file
@@ -0,0 +1,124 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { AlertTriangle, Trash2 } from 'lucide-react';
|
||||
import { BaseModal } from './base/BaseModal';
|
||||
import { ErrorDisplay } from './base/ErrorDisplay';
|
||||
|
||||
interface ClearAllPropositionsModalProps {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
onConfirm: () => Promise<void>;
|
||||
campaignTitle?: string;
|
||||
propositionCount: number;
|
||||
}
|
||||
|
||||
export default function ClearAllPropositionsModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
onConfirm,
|
||||
campaignTitle,
|
||||
propositionCount
|
||||
}: ClearAllPropositionsModalProps) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
const handleConfirm = async () => {
|
||||
setLoading(true);
|
||||
setError('');
|
||||
|
||||
try {
|
||||
await onConfirm();
|
||||
onClose();
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la suppression des propositions:', error);
|
||||
setError('Erreur lors de la suppression des propositions.');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
if (!loading) {
|
||||
setError('');
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
const footer = (
|
||||
<>
|
||||
<Button variant="outline" onClick={handleClose} disabled={loading}>
|
||||
Annuler
|
||||
</Button>
|
||||
<Button
|
||||
variant="destructive"
|
||||
onClick={handleConfirm}
|
||||
disabled={loading}
|
||||
className="bg-red-600 hover:bg-red-700"
|
||||
>
|
||||
{loading ? (
|
||||
<>
|
||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||
Suppression...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Trash2 className="w-4 h-4 mr-2" />
|
||||
Tout effacer
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
|
||||
return (
|
||||
<BaseModal
|
||||
isOpen={isOpen}
|
||||
onClose={handleClose}
|
||||
title="Effacer toutes les propositions"
|
||||
description={`Cette action supprimera définitivement toutes les propositions de la campagne.${campaignTitle ? ` Campagne : ${campaignTitle}` : ''}`}
|
||||
footer={footer}
|
||||
maxWidth="sm:max-w-md"
|
||||
>
|
||||
<ErrorDisplay error={error} />
|
||||
|
||||
<Alert className="border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800">
|
||||
<AlertTriangle className="h-4 w-4 text-red-600 dark:text-red-400" />
|
||||
<AlertDescription className="text-red-800 dark:text-red-200">
|
||||
<strong>Attention :</strong> Cette action est irréversible.
|
||||
{propositionCount > 0 && (
|
||||
<>
|
||||
{' '}Vous êtes sur le point de supprimer <strong>{propositionCount} proposition{propositionCount > 1 ? 's' : ''}</strong>.
|
||||
</>
|
||||
)}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
<div className="mt-4 p-4 bg-slate-50 dark:bg-slate-800 rounded-lg">
|
||||
<h4 className="font-medium text-slate-900 dark:text-slate-100 mb-2">
|
||||
Que sera supprimé :
|
||||
</h4>
|
||||
<ul className="text-sm text-slate-600 dark:text-slate-300 space-y-1">
|
||||
<li>• Toutes les propositions de la campagne</li>
|
||||
<li>• Les titres et descriptions des propositions</li>
|
||||
<li>• Les informations des auteurs (noms, emails)</li>
|
||||
<li>• Toutes les données associées</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg">
|
||||
<h4 className="font-medium text-blue-900 dark:text-blue-100 mb-2">
|
||||
Ce qui sera conservé :
|
||||
</h4>
|
||||
<ul className="text-sm text-blue-800 dark:text-blue-200 space-y-1">
|
||||
<li>• La campagne elle-même</li>
|
||||
<li>• Les participants</li>
|
||||
<li>• Les votes déjà effectués</li>
|
||||
<li>• Les paramètres de la campagne</li>
|
||||
</ul>
|
||||
</div>
|
||||
</BaseModal>
|
||||
);
|
||||
}
|
||||
46
src/components/ExportFileFormatSelect.tsx
Normal file
46
src/components/ExportFileFormatSelect.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
'use client';
|
||||
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
export type ExportFileFormat = 'ods' | 'csv' | 'xls';
|
||||
|
||||
interface ExportFileFormatSelectProps {
|
||||
value: ExportFileFormat;
|
||||
onValueChange: (value: ExportFileFormat) => void;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export function ExportFileFormatSelect({
|
||||
value,
|
||||
onValueChange,
|
||||
disabled = false
|
||||
}: ExportFileFormatSelectProps) {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="export-file-format">Format de fichier d'export</Label>
|
||||
<Select value={value} onValueChange={onValueChange} disabled={disabled}>
|
||||
<SelectTrigger id="export-file-format" className="w-full">
|
||||
<SelectValue placeholder="Sélectionner un format" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="ods" className="flex flex-col items-start py-3">
|
||||
<span className="font-medium">ODS (OpenDocument)</span>
|
||||
<span className="text-sm text-slate-500">Recommandé - Libre et compatible</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="csv" className="flex flex-col items-start py-3">
|
||||
<span className="font-medium">CSV (Valeurs séparées par des virgules)</span>
|
||||
<span className="text-sm text-slate-500">Universel - Compatible avec tous les tableurs</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="xls" className="flex flex-col items-start py-3">
|
||||
<span className="font-medium">XLS (Microsoft Office)</span>
|
||||
<span className="text-sm text-slate-500">Propriétaire - Compatible Excel</span>
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<p className="text-sm text-slate-600 dark:text-slate-400">
|
||||
Le format ODS est recommandé car il est libre, ouvert et compatible avec la plupart des tableurs.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
59
src/components/ExportPropositionsButton.tsx
Normal file
59
src/components/ExportPropositionsButton.tsx
Normal file
@@ -0,0 +1,59 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Download } from 'lucide-react';
|
||||
import { Proposition } from '@/types';
|
||||
import { generatePropositionsExport, downloadExportFile, formatPropositionsFilename } from '@/lib/export-utils';
|
||||
|
||||
interface ExportPropositionsButtonProps {
|
||||
propositions: Proposition[];
|
||||
campaignTitle: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
export default function ExportPropositionsButton({
|
||||
propositions,
|
||||
campaignTitle,
|
||||
disabled = false
|
||||
}: ExportPropositionsButtonProps) {
|
||||
const [isExporting, setIsExporting] = useState(false);
|
||||
|
||||
const handleExport = async () => {
|
||||
if (propositions.length === 0) {
|
||||
alert('Aucune proposition à exporter.');
|
||||
return;
|
||||
}
|
||||
|
||||
setIsExporting(true);
|
||||
|
||||
try {
|
||||
// Générer le fichier dans le format configuré
|
||||
const { data, format } = await generatePropositionsExport(propositions, campaignTitle);
|
||||
|
||||
// Créer le nom de fichier avec l'extension appropriée
|
||||
const filename = formatPropositionsFilename(campaignTitle, format);
|
||||
|
||||
// Télécharger le fichier
|
||||
downloadExportFile(data, filename, format);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de l\'export des propositions:', error);
|
||||
alert('Erreur lors de l\'export des propositions. Veuillez réessayer.');
|
||||
} finally {
|
||||
setIsExporting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={handleExport}
|
||||
disabled={disabled || isExporting || propositions.length === 0}
|
||||
className="flex items-center gap-2"
|
||||
>
|
||||
<Download className="w-4 h-4" />
|
||||
{isExporting ? 'Export en cours...' : 'Exporter'}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useState } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Download, FileSpreadsheet } from 'lucide-react';
|
||||
import { generateVoteExportODS, downloadODS, formatFilename, ExportData, AnonymizationLevel } from '@/lib/export-utils';
|
||||
import { generateVoteExport, downloadExportFile, formatFilename, ExportData, AnonymizationLevel } from '@/lib/export-utils';
|
||||
import { settingsService } from '@/lib/services';
|
||||
|
||||
interface ExportStatsButtonProps {
|
||||
@@ -46,10 +46,10 @@ export function ExportStatsButton({
|
||||
anonymizationLevel
|
||||
};
|
||||
|
||||
const odsData = generateVoteExportODS(exportData);
|
||||
const filename = formatFilename(campaignTitle);
|
||||
const { data, format } = await generateVoteExport(exportData);
|
||||
const filename = formatFilename(campaignTitle, format);
|
||||
|
||||
downloadODS(odsData, filename);
|
||||
downloadExportFile(data, filename, format);
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de l\'export:', error);
|
||||
// Ici on pourrait ajouter une notification d'erreur
|
||||
@@ -75,7 +75,7 @@ export function ExportStatsButton({
|
||||
) : (
|
||||
<>
|
||||
<FileSpreadsheet className="h-4 w-4" />
|
||||
Exporter les votes (ODS)
|
||||
Exporter les votes
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
|
||||
@@ -121,7 +121,7 @@ export default function ImportFileModal({
|
||||
Téléchargez le modèle
|
||||
</span>
|
||||
</div>
|
||||
<Button variant="outline" size="sm" onClick={() => downloadTemplate(type)}>
|
||||
<Button variant="outline" size="sm" onClick={async () => await downloadTemplate(type)}>
|
||||
<Download className="w-4 h-4 mr-1" />
|
||||
Modèle
|
||||
</Button>
|
||||
@@ -158,7 +158,7 @@ export default function ImportFileModal({
|
||||
<table className="w-full text-sm table-fixed">
|
||||
<thead className="bg-slate-50 dark:bg-slate-800">
|
||||
<tr>
|
||||
{Object.keys(preview[0] || {}).map((header) => (
|
||||
{getExpectedColumns(type).map((header) => (
|
||||
<th key={header} className="px-2 py-1 text-left font-medium truncate">
|
||||
{header}
|
||||
</th>
|
||||
@@ -168,9 +168,9 @@ export default function ImportFileModal({
|
||||
<tbody>
|
||||
{preview.map((row, index) => (
|
||||
<tr key={index} className="border-t">
|
||||
{Object.values(row).map((value, cellIndex) => (
|
||||
<td key={cellIndex} className="px-2 py-1 text-xs truncate">
|
||||
{String(value)}
|
||||
{getExpectedColumns(type).map((header) => (
|
||||
<td key={header} className="px-2 py-1 text-xs truncate">
|
||||
{String(row[header] || '')}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
|
||||
221
src/components/ShareModal.tsx
Normal file
221
src/components/ShareModal.tsx
Normal file
@@ -0,0 +1,221 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import QRCode from 'qrcode';
|
||||
import { BaseModal } from './base/BaseModal';
|
||||
import { Button } from './ui/button';
|
||||
import { Copy, Check, Share2 } from 'lucide-react';
|
||||
|
||||
interface ShareModalProps {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
campaignTitle: string;
|
||||
depositUrl: string;
|
||||
}
|
||||
|
||||
export default function ShareModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
campaignTitle,
|
||||
depositUrl
|
||||
}: ShareModalProps) {
|
||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [qrCodeError, setQrCodeError] = useState<string | null>(null);
|
||||
const [qrCodeLoading, setQrCodeLoading] = useState(false);
|
||||
const [qrCodeDataUrl, setQrCodeDataUrl] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen && depositUrl) {
|
||||
setQrCodeLoading(true);
|
||||
setQrCodeError(null);
|
||||
setQrCodeDataUrl(null);
|
||||
|
||||
// Essayer d'abord de générer en tant que Data URL
|
||||
QRCode.toDataURL(depositUrl, {
|
||||
width: 300,
|
||||
margin: 2,
|
||||
color: {
|
||||
dark: '#000000',
|
||||
light: '#FFFFFF'
|
||||
},
|
||||
errorCorrectionLevel: 'M'
|
||||
}).then((dataUrl) => {
|
||||
console.log('QR code généré avec succès (DataURL) pour:', depositUrl);
|
||||
setQrCodeDataUrl(dataUrl);
|
||||
setQrCodeLoading(false);
|
||||
}).catch((err) => {
|
||||
console.error('Erreur lors de la génération du QR code (DataURL):', err);
|
||||
|
||||
// Fallback: essayer avec le canvas
|
||||
if (canvasRef.current) {
|
||||
const canvas = canvasRef.current;
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (ctx) {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
QRCode.toCanvas(canvas, depositUrl, {
|
||||
width: 300,
|
||||
margin: 2,
|
||||
color: {
|
||||
dark: '#000000',
|
||||
light: '#FFFFFF'
|
||||
},
|
||||
errorCorrectionLevel: 'M'
|
||||
}).then(() => {
|
||||
console.log('QR code généré avec succès (Canvas) pour:', depositUrl);
|
||||
setQrCodeLoading(false);
|
||||
}).catch((canvasErr) => {
|
||||
console.error('Erreur lors de la génération du QR code (Canvas):', canvasErr);
|
||||
setQrCodeError('Erreur lors de la génération du QR code');
|
||||
setQrCodeLoading(false);
|
||||
});
|
||||
} else {
|
||||
setQrCodeError('Erreur lors de la génération du QR code');
|
||||
setQrCodeLoading(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, [isOpen, depositUrl]);
|
||||
|
||||
const handleCopyLink = async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(depositUrl);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
} catch (err) {
|
||||
console.error('Erreur lors de la copie:', err);
|
||||
}
|
||||
};
|
||||
|
||||
const retryQrCode = () => {
|
||||
if (depositUrl) {
|
||||
setQrCodeLoading(true);
|
||||
setQrCodeError(null);
|
||||
setQrCodeDataUrl(null);
|
||||
|
||||
QRCode.toDataURL(depositUrl, {
|
||||
width: 300,
|
||||
margin: 2,
|
||||
color: {
|
||||
dark: '#000000',
|
||||
light: '#FFFFFF'
|
||||
},
|
||||
errorCorrectionLevel: 'M'
|
||||
}).then((dataUrl) => {
|
||||
setQrCodeDataUrl(dataUrl);
|
||||
setQrCodeLoading(false);
|
||||
}).catch((err) => {
|
||||
console.error('Erreur lors de la génération du QR code:', err);
|
||||
setQrCodeError('Erreur lors de la génération du QR code');
|
||||
setQrCodeLoading(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<BaseModal
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
title={
|
||||
<div className="flex items-center gap-2">
|
||||
<Share2 className="w-5 h-5 text-blue-600" />
|
||||
Partager le lien de dépôt
|
||||
</div>
|
||||
}
|
||||
description={`Pour partager le lien de dépôt public de propositions pour la campagne "${campaignTitle}"`}
|
||||
maxWidth="sm:max-w-[600px]"
|
||||
maxHeight="max-h-[90vh]"
|
||||
>
|
||||
<div className="space-y-6">
|
||||
{/* Lien de dépôt */}
|
||||
<div className="space-y-3">
|
||||
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
|
||||
Lien de dépôt public
|
||||
</h3>
|
||||
<div className="flex items-center gap-2 p-3 bg-slate-50 dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-700">
|
||||
<div className="flex-1 text-sm font-mono text-slate-700 dark:text-slate-300 break-all">
|
||||
{depositUrl}
|
||||
</div>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={handleCopyLink}
|
||||
className="shrink-0"
|
||||
>
|
||||
{copied ? (
|
||||
<>
|
||||
<Check className="w-4 h-4 mr-2" />
|
||||
Copié !
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Copy className="w-4 h-4 mr-2" />
|
||||
Copier
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* QR Code */}
|
||||
<div className="space-y-3">
|
||||
<h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
|
||||
QR Code
|
||||
</h3>
|
||||
<div className="flex justify-center p-6 bg-white dark:bg-slate-900 rounded-lg border border-slate-200 dark:border-slate-700">
|
||||
{qrCodeLoading && (
|
||||
<div className="flex items-center justify-center w-[300px] h-[300px]">
|
||||
<div className="text-slate-500">Génération du QR code...</div>
|
||||
</div>
|
||||
)}
|
||||
{qrCodeError && (
|
||||
<div className="flex items-center justify-center w-[300px] h-[300px]">
|
||||
<div className="text-red-500 text-center">
|
||||
<div className="text-sm">{qrCodeError}</div>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="mt-2"
|
||||
onClick={retryQrCode}
|
||||
>
|
||||
Réessayer
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{qrCodeDataUrl && !qrCodeLoading && !qrCodeError && (
|
||||
<img
|
||||
src={qrCodeDataUrl}
|
||||
alt="QR Code pour le lien de dépôt"
|
||||
className="border border-slate-200 dark:border-slate-600 rounded-lg"
|
||||
width={300}
|
||||
height={300}
|
||||
/>
|
||||
)}
|
||||
<canvas
|
||||
ref={canvasRef}
|
||||
width={300}
|
||||
height={300}
|
||||
className={`border border-slate-200 dark:border-slate-600 rounded-lg ${qrCodeDataUrl || qrCodeLoading || qrCodeError ? 'hidden' : 'block'}`}
|
||||
/>
|
||||
</div>
|
||||
<p className="text-sm text-slate-600 dark:text-slate-400 text-center">
|
||||
Scannez ce QR code pour accéder directement au formulaire de dépôt
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Instructions */}
|
||||
<div className="p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg">
|
||||
<h4 className="font-medium text-blue-900 dark:text-blue-100 mb-2">
|
||||
Comment partager ?
|
||||
</h4>
|
||||
<ul className="text-sm text-blue-800 dark:text-blue-200 space-y-1">
|
||||
<li>• Copiez le lien ci-dessus pour le partager par email, SMS ou message</li>
|
||||
<li>• Imprimez ou affichez le QR code pour un accès rapide</li>
|
||||
<li>• Partagez l'image du QR code sur les réseaux sociaux</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</BaseModal>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,21 @@
|
||||
import * as XLSX from 'xlsx';
|
||||
import { Proposition, Participant, Vote } from '@/types';
|
||||
import { settingsService } from './services';
|
||||
|
||||
export type ExportFileFormat = 'ods' | 'csv' | 'xls';
|
||||
|
||||
/**
|
||||
* Obtient le format de fichier d'export configuré dans les paramètres
|
||||
*/
|
||||
export async function getExportFileFormat(): Promise<ExportFileFormat> {
|
||||
try {
|
||||
const format = await settingsService.getStringValue('export_file_format', 'ods');
|
||||
return format as ExportFileFormat;
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la récupération du format d\'export:', error);
|
||||
return 'ods'; // Format par défaut
|
||||
}
|
||||
}
|
||||
|
||||
export interface ExportData {
|
||||
campaignTitle: string;
|
||||
@@ -25,6 +41,73 @@ export interface PropositionStats {
|
||||
consensusScore: number;
|
||||
}
|
||||
|
||||
export async function generateVoteExport(data: ExportData): Promise<{ data: Uint8Array | string; format: ExportFileFormat }> {
|
||||
const format = await getExportFileFormat();
|
||||
|
||||
// Créer la matrice de données
|
||||
const matrix: (string | number)[][] = [];
|
||||
|
||||
// Pour les formats Excel/ODS, ajouter un titre
|
||||
if (format !== 'csv') {
|
||||
matrix.push([`Statistiques de vote - ${data.campaignTitle}`]);
|
||||
matrix.push([]); // Ligne vide
|
||||
}
|
||||
|
||||
// En-têtes des colonnes : propositions + total
|
||||
const headers = ['Participant', ...data.propositions.map(p => p.title), 'Total voté', 'Budget restant'];
|
||||
matrix.push(headers);
|
||||
|
||||
// Données des participants
|
||||
data.participants.forEach(participant => {
|
||||
const row: (string | number)[] = [];
|
||||
|
||||
// Nom du participant (avec anonymisation)
|
||||
const participantName = anonymizeParticipantName(participant, data.anonymizationLevel || 'full');
|
||||
row.push(participantName);
|
||||
|
||||
// Votes pour chaque proposition
|
||||
let totalVoted = 0;
|
||||
data.propositions.forEach(proposition => {
|
||||
const vote = data.votes.find(v =>
|
||||
v.participant_id === participant.id &&
|
||||
v.proposition_id === proposition.id
|
||||
);
|
||||
const amount = vote ? vote.amount : 0;
|
||||
row.push(amount);
|
||||
totalVoted += amount;
|
||||
});
|
||||
|
||||
// Total voté par le participant
|
||||
row.push(totalVoted);
|
||||
|
||||
// Budget restant
|
||||
const budgetRemaining = data.budgetPerUser - totalVoted;
|
||||
row.push(budgetRemaining);
|
||||
|
||||
matrix.push(row);
|
||||
});
|
||||
|
||||
// Ligne des totaux
|
||||
const totalRow: (string | number)[] = ['TOTAL'];
|
||||
let grandTotal = 0;
|
||||
|
||||
data.propositions.forEach(proposition => {
|
||||
const propositionTotal = data.votes
|
||||
.filter(v => v.proposition_id === proposition.id)
|
||||
.reduce((sum, vote) => sum + vote.amount, 0);
|
||||
totalRow.push(propositionTotal);
|
||||
grandTotal += propositionTotal;
|
||||
});
|
||||
|
||||
totalRow.push(grandTotal);
|
||||
totalRow.push(data.participants.length * data.budgetPerUser - grandTotal);
|
||||
matrix.push(totalRow);
|
||||
|
||||
const exportData = generateExportFile(matrix, format);
|
||||
return { data: exportData, format };
|
||||
}
|
||||
|
||||
// Fonction de compatibilité (à supprimer plus tard)
|
||||
export function generateVoteExportODS(data: ExportData): Uint8Array {
|
||||
const { campaignTitle, propositions, participants, votes, budgetPerUser, propositionStats, anonymizationLevel = 'full' } = data;
|
||||
|
||||
@@ -248,6 +331,66 @@ export function generateVoteExportODS(data: ExportData): Uint8Array {
|
||||
return new Uint8Array(odsBuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Génère un fichier d'export dans le format spécifié
|
||||
*/
|
||||
export function generateExportFile(matrix: (string | number)[][], format: ExportFileFormat): Uint8Array | string {
|
||||
if (format === 'csv') {
|
||||
// Générer du CSV
|
||||
return matrix.map(row =>
|
||||
row.map(cell => {
|
||||
const cellStr = String(cell || '');
|
||||
// Échapper les guillemets et entourer de guillemets si nécessaire
|
||||
if (cellStr.includes(',') || cellStr.includes('"') || cellStr.includes('\n')) {
|
||||
return `"${cellStr.replace(/"/g, '""')}"`;
|
||||
}
|
||||
return cellStr;
|
||||
}).join(',')
|
||||
).join('\n');
|
||||
} else {
|
||||
// Générer un fichier Excel/ODS
|
||||
const workbook = XLSX.utils.book_new();
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(matrix);
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Données');
|
||||
|
||||
const buffer = XLSX.write(workbook, {
|
||||
bookType: format,
|
||||
type: 'array'
|
||||
});
|
||||
|
||||
return new Uint8Array(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Télécharge un fichier d'export
|
||||
*/
|
||||
export function downloadExportFile(data: Uint8Array | string, filename: string, format: ExportFileFormat): void {
|
||||
let blob: Blob;
|
||||
let mimeType: string;
|
||||
|
||||
if (format === 'csv') {
|
||||
mimeType = 'text/csv;charset=utf-8';
|
||||
blob = new Blob([data as string], { type: mimeType });
|
||||
} else {
|
||||
mimeType = format === 'ods'
|
||||
? 'application/vnd.oasis.opendocument.spreadsheet'
|
||||
: 'application/vnd.ms-excel';
|
||||
blob = new Blob([data as Uint8Array], { type: mimeType });
|
||||
}
|
||||
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
export function downloadODS(data: Uint8Array, filename: string): void {
|
||||
const blob = new Blob([data], {
|
||||
type: 'application/vnd.oasis.opendocument.spreadsheet'
|
||||
@@ -280,7 +423,145 @@ export function anonymizeParticipantName(participant: Participant, level: Anonym
|
||||
}
|
||||
}
|
||||
|
||||
export function formatFilename(campaignTitle: string): string {
|
||||
/**
|
||||
* Anonymise le nom d'un auteur de proposition
|
||||
*/
|
||||
export function anonymizeAuthorName(name: string, level: AnonymizationLevel): string {
|
||||
switch (level) {
|
||||
case 'full':
|
||||
return 'XXXX';
|
||||
case 'initials':
|
||||
return name.charAt(0).toUpperCase() + '.';
|
||||
case 'none':
|
||||
return name;
|
||||
default:
|
||||
return 'XXXX';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Anonymise l'email d'un auteur de proposition
|
||||
*/
|
||||
export function anonymizeAuthorEmail(email: string, level: AnonymizationLevel): string {
|
||||
switch (level) {
|
||||
case 'full':
|
||||
return 'xxxx@xxxx.xxx';
|
||||
case 'initials':
|
||||
// Garder le domaine mais anonymiser la partie locale
|
||||
const [localPart, domain] = email.split('@');
|
||||
if (domain) {
|
||||
return `${localPart.charAt(0)}***@${domain}`;
|
||||
}
|
||||
return 'x***@xxxx.xxx';
|
||||
case 'none':
|
||||
return email;
|
||||
default:
|
||||
return 'xxxx@xxxx.xxx';
|
||||
}
|
||||
}
|
||||
|
||||
export async function generatePropositionsExport(propositions: Proposition[], campaignTitle: string): Promise<{ data: Uint8Array | string; format: ExportFileFormat }> {
|
||||
const format = await getExportFileFormat();
|
||||
const anonymizationLevel = await settingsService.getStringValue('export_anonymization', 'full') as AnonymizationLevel;
|
||||
|
||||
// Créer la matrice de données
|
||||
const matrix: (string | number)[][] = [];
|
||||
|
||||
// Pour les formats Excel/ODS, ajouter un titre
|
||||
if (format !== 'csv') {
|
||||
matrix.push([`Liste des propositions - ${campaignTitle}`]);
|
||||
matrix.push([]); // Ligne vide
|
||||
}
|
||||
|
||||
// En-têtes des colonnes (en français)
|
||||
const headers = ['Titre', 'Description', 'Prénom', 'Nom', 'Email'];
|
||||
matrix.push(headers);
|
||||
|
||||
// Données des propositions avec anonymisation
|
||||
propositions.forEach(proposition => {
|
||||
const row: (string | number)[] = [
|
||||
proposition.title,
|
||||
proposition.description,
|
||||
anonymizeAuthorName(proposition.author_first_name, anonymizationLevel),
|
||||
anonymizeAuthorName(proposition.author_last_name, anonymizationLevel),
|
||||
anonymizeAuthorEmail(proposition.author_email, anonymizationLevel)
|
||||
];
|
||||
matrix.push(row);
|
||||
});
|
||||
|
||||
const data = generateExportFile(matrix, format);
|
||||
return { data, format };
|
||||
}
|
||||
|
||||
// Fonction de compatibilité (à supprimer plus tard)
|
||||
export function generatePropositionsExportODS(propositions: Proposition[], campaignTitle: string): Uint8Array {
|
||||
// Créer la matrice de données
|
||||
const matrix: (string | number)[][] = [];
|
||||
|
||||
// En-têtes : Titre de la campagne
|
||||
matrix.push([`Liste des propositions - ${campaignTitle}`]);
|
||||
matrix.push([]); // Ligne vide
|
||||
|
||||
// En-têtes des colonnes (en français)
|
||||
const headers = ['Titre', 'Description', 'Prénom', 'Nom', 'Email'];
|
||||
matrix.push(headers);
|
||||
|
||||
// Données des propositions (sans anonymisation pour la compatibilité - utiliser la nouvelle fonction)
|
||||
propositions.forEach(proposition => {
|
||||
const row: (string | number)[] = [
|
||||
proposition.title,
|
||||
proposition.description,
|
||||
proposition.author_first_name,
|
||||
proposition.author_last_name,
|
||||
proposition.author_email
|
||||
];
|
||||
matrix.push(row);
|
||||
});
|
||||
|
||||
// Créer le workbook et worksheet
|
||||
const workbook = XLSX.utils.book_new();
|
||||
const worksheet = XLSX.utils.aoa_to_sheet(matrix);
|
||||
|
||||
// Ajouter des styles pour les colonnes
|
||||
worksheet['!cols'] = [
|
||||
{ width: 30 }, // Titre
|
||||
{ width: 50 }, // Description
|
||||
{ width: 15 }, // Prénom
|
||||
{ width: 15 }, // Nom
|
||||
{ width: 25 }, // Email
|
||||
{ width: 15 } // Date de création
|
||||
];
|
||||
|
||||
// Style pour les en-têtes (texte en gras)
|
||||
for (let col = 0; col < headers.length; col++) {
|
||||
const cellRef = XLSX.utils.encode_cell({ r: 2, c: col }); // Ligne 3 (index 2) pour les en-têtes
|
||||
if (!worksheet[cellRef]) {
|
||||
worksheet[cellRef] = { v: matrix[2][col] };
|
||||
}
|
||||
worksheet[cellRef].s = {
|
||||
font: { bold: true },
|
||||
border: {
|
||||
top: { style: 'thick' },
|
||||
bottom: { style: 'thick' },
|
||||
left: { style: 'thin' },
|
||||
right: { style: 'thin' }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Ajouter le worksheet au workbook
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, 'Propositions');
|
||||
|
||||
// Générer le fichier ODS
|
||||
const odsBuffer = XLSX.write(workbook, {
|
||||
bookType: 'ods',
|
||||
type: 'array'
|
||||
});
|
||||
|
||||
return new Uint8Array(odsBuffer);
|
||||
}
|
||||
|
||||
export function formatFilename(campaignTitle: string, format: ExportFileFormat = 'ods'): string {
|
||||
const sanitizedTitle = campaignTitle
|
||||
.replace(/[^a-zA-Z0-9\s]/g, '')
|
||||
.replace(/\s+/g, '_')
|
||||
@@ -290,7 +571,23 @@ export function formatFilename(campaignTitle: string): string {
|
||||
|
||||
const date = new Date().toISOString().split('T')[0];
|
||||
const prefix = sanitizedTitle ? `statistiques_vote_${sanitizedTitle}_` : 'statistiques_vote_';
|
||||
const filename = `${prefix}${date}.ods`;
|
||||
const filename = `${prefix}${date}.${format}`;
|
||||
|
||||
// Nettoyer les underscores multiples à la fin
|
||||
return filename.replace(/_+/g, '_');
|
||||
}
|
||||
|
||||
export function formatPropositionsFilename(campaignTitle: string, format: ExportFileFormat = 'ods'): string {
|
||||
const sanitizedTitle = campaignTitle
|
||||
.replace(/[^a-zA-Z0-9\s]/g, '')
|
||||
.replace(/\s+/g, '_')
|
||||
.replace(/_+/g, '_') // Remplacer les underscores multiples par un seul
|
||||
.toLowerCase()
|
||||
.trim();
|
||||
|
||||
const date = new Date().toISOString().split('T')[0];
|
||||
const prefix = sanitizedTitle ? `propositions_${sanitizedTitle}_` : 'propositions_';
|
||||
const filename = `${prefix}${date}.${format}`;
|
||||
|
||||
// Nettoyer les underscores multiples à la fin
|
||||
return filename.replace(/_+/g, '_');
|
||||
|
||||
@@ -23,14 +23,33 @@ export function parseCSV(file: File): Promise<ParsedFileData> {
|
||||
return;
|
||||
}
|
||||
|
||||
const headers = lines[0].split(',').map(h => h.trim().replace(/"/g, ''));
|
||||
const data = lines.slice(1).map(line => {
|
||||
// Trouver la ligne d'en-têtes (ignorer les lignes de titre et vides)
|
||||
let headerLineIndex = 0;
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i].trim();
|
||||
// Si la ligne contient des virgules et ressemble à des en-têtes
|
||||
if (line.includes(',') && !line.toLowerCase().includes('modèle') && !line.toLowerCase().includes('liste')) {
|
||||
headerLineIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const headers = lines[headerLineIndex].split(',').map(h => h.trim().replace(/"/g, ''));
|
||||
const dataLines = lines.slice(headerLineIndex + 1);
|
||||
|
||||
const data = dataLines
|
||||
.filter(line => line.trim()) // Ignorer les lignes vides
|
||||
.map(line => {
|
||||
const values = line.split(',').map(v => v.trim().replace(/"/g, ''));
|
||||
const row: any = {};
|
||||
headers.forEach((header, index) => {
|
||||
row[header] = values[index] || '';
|
||||
});
|
||||
return row;
|
||||
})
|
||||
.filter(row => {
|
||||
// Ignorer les lignes où tous les champs sont vides
|
||||
return Object.values(row).some(value => value && value.toString().trim());
|
||||
});
|
||||
|
||||
resolve({ data, headers });
|
||||
@@ -62,15 +81,38 @@ export function parseExcel(file: File): Promise<ParsedFileData> {
|
||||
return;
|
||||
}
|
||||
|
||||
const headers = jsonData[0] as string[];
|
||||
const rows = jsonData.slice(1) as any[][];
|
||||
// Trouver la ligne d'en-têtes (ignorer les lignes de titre et vides)
|
||||
let headerLineIndex = 0;
|
||||
for (let i = 0; i < jsonData.length; i++) {
|
||||
const row = jsonData[i] as any[];
|
||||
if (row && row.length > 0) {
|
||||
const firstCell = row[0];
|
||||
// Si la première cellule ressemble à un en-tête et pas à un titre
|
||||
if (firstCell && typeof firstCell === 'string' &&
|
||||
!firstCell.toLowerCase().includes('modèle') &&
|
||||
!firstCell.toLowerCase().includes('liste') &&
|
||||
!firstCell.toLowerCase().includes('propositions')) {
|
||||
headerLineIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const parsedData = rows.map(row => {
|
||||
const headers = (jsonData[headerLineIndex] as string[]).filter(h => h && h.toString().trim());
|
||||
const rows = jsonData.slice(headerLineIndex + 1) as any[][];
|
||||
|
||||
const parsedData = rows
|
||||
.filter(row => row && row.length > 0) // Ignorer les lignes vides
|
||||
.map(row => {
|
||||
const rowData: any = {};
|
||||
headers.forEach((header, index) => {
|
||||
rowData[header] = row[index] || '';
|
||||
});
|
||||
return rowData;
|
||||
})
|
||||
.filter(rowData => {
|
||||
// Ignorer les lignes où tous les champs sont vides
|
||||
return Object.values(rowData).some(value => value && value.toString().trim());
|
||||
});
|
||||
|
||||
resolve({ data: parsedData, headers });
|
||||
@@ -84,22 +126,47 @@ export function parseExcel(file: File): Promise<ParsedFileData> {
|
||||
|
||||
export function getExpectedColumns(type: 'propositions' | 'participants'): string[] {
|
||||
if (type === 'propositions') {
|
||||
return ['title', 'description', 'author_first_name', 'author_last_name', 'author_email'];
|
||||
return ['Titre', 'Description', 'Prénom', 'Nom', 'Email'];
|
||||
} else {
|
||||
return ['first_name', 'last_name', 'email'];
|
||||
return ['Prénom', 'Nom', 'Email'];
|
||||
}
|
||||
}
|
||||
|
||||
export function downloadTemplate(type: 'propositions' | 'participants'): void {
|
||||
export async function downloadTemplate(type: 'propositions' | 'participants'): Promise<void> {
|
||||
const columns = getExpectedColumns(type);
|
||||
const csvContent = columns.join(',') + '\n';
|
||||
const blob = new Blob([csvContent], { type: 'text/csv' });
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `template_${type}.csv`;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
// Importer dynamiquement la fonction pour éviter les dépendances circulaires
|
||||
const { getExportFileFormat, generateExportFile, downloadExportFile } = await import('./export-utils');
|
||||
const format = await getExportFileFormat();
|
||||
|
||||
// Créer la matrice de données avec les en-têtes
|
||||
const matrix: string[][] = [];
|
||||
|
||||
// Pour les formats Excel/ODS, ajouter un titre
|
||||
if (format !== 'csv') {
|
||||
matrix.push([`Modèle d'import - ${type === 'propositions' ? 'Propositions' : 'Participants'}`]);
|
||||
matrix.push([]); // Ligne vide
|
||||
}
|
||||
|
||||
matrix.push(columns); // En-têtes des colonnes
|
||||
|
||||
// Ajouter quelques lignes d'exemple
|
||||
if (type === 'propositions') {
|
||||
matrix.push(['Exemple de proposition', 'Description de la proposition', 'Jean', 'Dupont', 'jean.dupont@example.com']);
|
||||
matrix.push(['Autre proposition', 'Autre description', 'Marie', 'Martin', 'marie.martin@example.com']);
|
||||
} else {
|
||||
matrix.push(['Jean', 'Dupont', 'jean.dupont@example.com']);
|
||||
matrix.push(['Marie', 'Martin', 'marie.martin@example.com']);
|
||||
}
|
||||
|
||||
// Générer le fichier dans le format configuré
|
||||
const data = generateExportFile(matrix, format);
|
||||
|
||||
// Créer le nom de fichier avec l'extension appropriée
|
||||
const filename = `template_${type}.${format}`;
|
||||
|
||||
// Télécharger le fichier
|
||||
downloadExportFile(data, filename, format);
|
||||
}
|
||||
|
||||
export function validateFileType(file: File): { isValid: boolean; error?: string } {
|
||||
|
||||
@@ -276,6 +276,15 @@ export const propositionService = {
|
||||
.delete()
|
||||
.eq('id', id);
|
||||
|
||||
if (error) throw error;
|
||||
},
|
||||
|
||||
async deleteAllByCampaign(campaignId: string): Promise<void> {
|
||||
const { error } = await supabase
|
||||
.from('propositions')
|
||||
.delete()
|
||||
.eq('campaign_id', campaignId);
|
||||
|
||||
if (error) throw error;
|
||||
}
|
||||
};
|
||||
@@ -363,6 +372,15 @@ export const participantService = {
|
||||
if (error) throw error;
|
||||
},
|
||||
|
||||
async deleteAllByCampaign(campaignId: string): Promise<void> {
|
||||
const { error } = await supabase
|
||||
.from('participants')
|
||||
.delete()
|
||||
.eq('campaign_id', campaignId);
|
||||
|
||||
if (error) throw error;
|
||||
},
|
||||
|
||||
// Nouvelle méthode pour récupérer un participant par short_id
|
||||
async getByShortId(shortId: string): Promise<Participant | null> {
|
||||
const { data, error } = await supabase
|
||||
|
||||
Reference in New Issue
Block a user