donation component
This commit is contained in:
264
web/package-lock.json
generated
264
web/package-lock.json
generated
@@ -32,6 +32,7 @@
|
|||||||
"lodash-es": "4.17.21",
|
"lodash-es": "4.17.21",
|
||||||
"mime-types": "3.0.1",
|
"mime-types": "3.0.1",
|
||||||
"object-to-formdata": "4.5.1",
|
"object-to-formdata": "4.5.1",
|
||||||
|
"qrcode": "1.5.4",
|
||||||
"react": "19.1.0",
|
"react": "19.1.0",
|
||||||
"redis": "5.0.1",
|
"redis": "5.0.1",
|
||||||
"schema-dts": "1.1.5",
|
"schema-dts": "1.1.5",
|
||||||
@@ -56,6 +57,7 @@
|
|||||||
"@tailwindcss/typography": "0.5.16",
|
"@tailwindcss/typography": "0.5.16",
|
||||||
"@types/eslint__js": "9.14.0",
|
"@types/eslint__js": "9.14.0",
|
||||||
"@types/lodash-es": "4.17.12",
|
"@types/lodash-es": "4.17.12",
|
||||||
|
"@types/qrcode": "1.5.5",
|
||||||
"@types/react": "19.1.4",
|
"@types/react": "19.1.4",
|
||||||
"@types/seedrandom": "3.0.8",
|
"@types/seedrandom": "3.0.8",
|
||||||
"@typescript-eslint/parser": "8.32.1",
|
"@typescript-eslint/parser": "8.32.1",
|
||||||
@@ -3160,6 +3162,16 @@
|
|||||||
"pg-types": "^2.2.0"
|
"pg-types": "^2.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"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==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/react": {
|
"node_modules/@types/react": {
|
||||||
"version": "19.1.4",
|
"version": "19.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.4.tgz",
|
||||||
@@ -5686,6 +5698,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/decode-named-character-reference": {
|
"node_modules/decode-named-character-reference": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz",
|
||||||
@@ -5907,6 +5928,12 @@
|
|||||||
"node": ">=0.3.1"
|
"node": ">=0.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"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/dlv": {
|
"node_modules/dlv": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
|
||||||
@@ -11110,6 +11137,15 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/p-try": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/package-manager-detector": {
|
"node_modules/package-manager-detector": {
|
||||||
"version": "0.2.9",
|
"version": "0.2.9",
|
||||||
"resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-0.2.9.tgz",
|
"resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-0.2.9.tgz",
|
||||||
@@ -11238,7 +11274,6 @@
|
|||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
@@ -11349,6 +11384,15 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"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": {
|
"node_modules/possible-typed-array-names": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
|
||||||
@@ -11724,6 +11768,206 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"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/ansi-regex": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/camelcase": {
|
||||||
|
"version": "5.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||||
|
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"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/emoji-regex": {
|
||||||
|
"version": "8.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
|
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"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/string-width": {
|
||||||
|
"version": "4.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||||
|
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"emoji-regex": "^8.0.0",
|
||||||
|
"is-fullwidth-code-point": "^3.0.0",
|
||||||
|
"strip-ansi": "^6.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/strip-ansi": {
|
||||||
|
"version": "6.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||||
|
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-regex": "^5.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qrcode/node_modules/wrap-ansi": {
|
||||||
|
"version": "6.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
|
||||||
|
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^4.0.0",
|
||||||
|
"string-width": "^4.1.0",
|
||||||
|
"strip-ansi": "^6.0.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/queue-microtask": {
|
"node_modules/queue-microtask": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||||
@@ -12168,6 +12412,12 @@
|
|||||||
"node": ">=0.10.0"
|
"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/resolve": {
|
"node_modules/resolve": {
|
||||||
"version": "1.22.10",
|
"version": "1.22.10",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
|
||||||
@@ -12539,6 +12789,12 @@
|
|||||||
"integrity": "sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==",
|
"integrity": "sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"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": {
|
"node_modules/set-function-length": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
||||||
@@ -14550,6 +14806,12 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"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-pm-runs": {
|
"node_modules/which-pm-runs": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.1.0.tgz",
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
"@astrojs/node": "9.2.1",
|
"@astrojs/node": "9.2.1",
|
||||||
"@astrojs/sitemap": "3.4.0",
|
"@astrojs/sitemap": "3.4.0",
|
||||||
"@fontsource-variable/space-grotesk": "5.2.7",
|
"@fontsource-variable/space-grotesk": "5.2.7",
|
||||||
"@fontsource/space-grotesk": "5.2.7",
|
|
||||||
"@fontsource/inter": "5.2.5",
|
"@fontsource/inter": "5.2.5",
|
||||||
|
"@fontsource/space-grotesk": "5.2.7",
|
||||||
"@prisma/client": "6.8.2",
|
"@prisma/client": "6.8.2",
|
||||||
"@tailwindcss/vite": "4.1.7",
|
"@tailwindcss/vite": "4.1.7",
|
||||||
"@types/mime-types": "2.1.4",
|
"@types/mime-types": "2.1.4",
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
"lodash-es": "4.17.21",
|
"lodash-es": "4.17.21",
|
||||||
"mime-types": "3.0.1",
|
"mime-types": "3.0.1",
|
||||||
"object-to-formdata": "4.5.1",
|
"object-to-formdata": "4.5.1",
|
||||||
|
"qrcode": "1.5.4",
|
||||||
"react": "19.1.0",
|
"react": "19.1.0",
|
||||||
"redis": "5.0.1",
|
"redis": "5.0.1",
|
||||||
"schema-dts": "1.1.5",
|
"schema-dts": "1.1.5",
|
||||||
@@ -68,6 +69,7 @@
|
|||||||
"@tailwindcss/typography": "0.5.16",
|
"@tailwindcss/typography": "0.5.16",
|
||||||
"@types/eslint__js": "9.14.0",
|
"@types/eslint__js": "9.14.0",
|
||||||
"@types/lodash-es": "4.17.12",
|
"@types/lodash-es": "4.17.12",
|
||||||
|
"@types/qrcode": "1.5.5",
|
||||||
"@types/react": "19.1.4",
|
"@types/react": "19.1.4",
|
||||||
"@types/seedrandom": "3.0.8",
|
"@types/seedrandom": "3.0.8",
|
||||||
"@typescript-eslint/parser": "8.32.1",
|
"@typescript-eslint/parser": "8.32.1",
|
||||||
|
|||||||
@@ -2,75 +2,50 @@
|
|||||||
import { Icon } from 'astro-icon/components'
|
import { Icon } from 'astro-icon/components'
|
||||||
import { Markdown } from 'astro-remote'
|
import { Markdown } from 'astro-remote'
|
||||||
|
|
||||||
import type { AnnouncementType } from '@prisma/client'
|
import { getAnnouncementTypeInfo } from '../constants/announcementTypes'
|
||||||
|
import { cn } from '../lib/cn'
|
||||||
|
|
||||||
export type Announcement = {
|
import type { Prisma } from '@prisma/client'
|
||||||
id: number
|
|
||||||
title: string
|
|
||||||
content: string
|
|
||||||
type: AnnouncementType
|
|
||||||
startDate: Date
|
|
||||||
endDate: Date | null
|
|
||||||
isActive: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Props = {
|
type Props = {
|
||||||
announcements: Announcement[]
|
announcements:
|
||||||
|
| Prisma.AnnouncementGetPayload<{
|
||||||
|
select: {
|
||||||
|
id: true
|
||||||
|
title: true
|
||||||
|
content: true
|
||||||
|
type: true
|
||||||
|
startDate: true
|
||||||
|
endDate: true
|
||||||
|
isActive: true
|
||||||
|
}
|
||||||
|
}>[]
|
||||||
|
| null
|
||||||
|
| undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const { announcements } = Astro.props
|
const { announcements } = Astro.props
|
||||||
|
|
||||||
// Get icon and class based on announcement type
|
|
||||||
const getTypeInfo = (type: AnnouncementType) => {
|
|
||||||
switch (type) {
|
|
||||||
case 'INFO':
|
|
||||||
return {
|
|
||||||
icon: 'ri:information-line',
|
|
||||||
containerClass: 'bg-blue-900/40 border-blue-500/30',
|
|
||||||
titleClass: 'text-blue-400',
|
|
||||||
contentClass: 'text-blue-300',
|
|
||||||
}
|
|
||||||
case 'WARNING':
|
|
||||||
return {
|
|
||||||
icon: 'ri:alert-line',
|
|
||||||
containerClass: 'bg-yellow-900/40 border-yellow-500/30',
|
|
||||||
titleClass: 'text-yellow-400',
|
|
||||||
contentClass: 'text-yellow-300',
|
|
||||||
}
|
|
||||||
case 'ALERT':
|
|
||||||
return {
|
|
||||||
icon: 'ri:error-warning-line',
|
|
||||||
containerClass: 'bg-red-900/40 border-red-500/30',
|
|
||||||
titleClass: 'text-red-400',
|
|
||||||
contentClass: 'text-red-300',
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return {
|
|
||||||
icon: 'ri:information-line',
|
|
||||||
containerClass: 'bg-blue-900/40 border-blue-500/30',
|
|
||||||
titleClass: 'text-blue-400',
|
|
||||||
contentClass: 'text-blue-300',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
---
|
---
|
||||||
|
|
||||||
{
|
{
|
||||||
announcements.length > 0 && (
|
!!announcements && announcements.length > 0 && (
|
||||||
<div class="mb-4 flex flex-col items-center space-y-1">
|
<div class="mb-4 flex flex-col items-center space-y-1">
|
||||||
{announcements.map((announcement) => {
|
{announcements.map((announcement) => {
|
||||||
const typeInfo = getTypeInfo(announcement.type)
|
const typeInfo = getAnnouncementTypeInfo(announcement.type)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={`flex flex-row items-center rounded border ${typeInfo.containerClass} mx-auto w-auto max-w-full px-3 py-2`}
|
class={cn(
|
||||||
|
'mx-auto flex w-auto max-w-full flex-row items-center rounded border px-3 py-2',
|
||||||
|
typeInfo.classNames.container
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<Icon name={typeInfo.icon} class={`size-4 flex-shrink-0 ${typeInfo.titleClass} mr-2`} />
|
<Icon name={typeInfo.icon} class={cn('mr-2 size-4 flex-shrink-0', typeInfo.classNames.title)} />
|
||||||
<div class="flex min-w-0 flex-col">
|
<div class="flex min-w-0 flex-col">
|
||||||
<span class={`text-sm leading-tight font-bold ${typeInfo.titleClass} truncate`}>
|
<span class={cn('truncate text-sm leading-tight font-bold', typeInfo.classNames.title)}>
|
||||||
{announcement.title}
|
{announcement.title}
|
||||||
</span>
|
</span>
|
||||||
<span class={`text-xs ${typeInfo.contentClass} truncate leading-snug [&_a]:underline`}>
|
<span class={cn('truncate text-xs leading-snug [&_a]:underline', typeInfo.classNames.content)}>
|
||||||
<Markdown content={announcement.content} />
|
<Markdown content={announcement.content} />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
60
web/src/components/DonationAddress.astro
Normal file
60
web/src/components/DonationAddress.astro
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
import { Icon } from 'astro-icon/components'
|
||||||
|
import QRCode from 'qrcode'
|
||||||
|
|
||||||
|
import { cn } from '../lib/cn'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
cryptoName: string
|
||||||
|
cryptoIcon: string
|
||||||
|
address: string
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const { cryptoName, cryptoIcon, address, className } = Astro.props
|
||||||
|
|
||||||
|
function getAddressURI(address: string, cryptoName: string) {
|
||||||
|
if (cryptoName.toLowerCase() === 'monero') {
|
||||||
|
return `monero:${address}?tx_description=KYCnot.me%20Donation`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cryptoName.toLowerCase() === 'bitcoin') {
|
||||||
|
return `bitcoin:${address}?label=KYCnot.me%20Donation`
|
||||||
|
}
|
||||||
|
|
||||||
|
return address
|
||||||
|
}
|
||||||
|
|
||||||
|
const qrCodeDataURL = await QRCode.toDataURL(getAddressURI(address, cryptoName), {
|
||||||
|
width: 128,
|
||||||
|
margin: 1,
|
||||||
|
color: {
|
||||||
|
dark: '#ffffff',
|
||||||
|
light: '#171721',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
---
|
||||||
|
|
||||||
|
<div class={cn('bg-night-800 border-night-600 flex items-center gap-2 rounded-lg border px-3', className)}>
|
||||||
|
<div class="flex flex-1 flex-col gap-1 py-3">
|
||||||
|
<div class="flex items-center gap-2 px-4 pt-3">
|
||||||
|
<Icon name={cryptoIcon} class="size-6 text-white" />
|
||||||
|
<span class="font-title text-base font-semibold text-white">{cryptoName}</span>
|
||||||
|
</div>
|
||||||
|
<p class="px-7 font-mono text-base leading-snug tracking-wide break-all text-white">
|
||||||
|
<span
|
||||||
|
class="cursor-pointer select-all"
|
||||||
|
set:html={address.length > 12
|
||||||
|
? `<span class="font-bold mr-0.5 text-green-500">${address.substring(0, 6)}</span>${address.substring(6, address.length - 6)}<span class="font-bold ml-0.5 text-green-500">${address.substring(address.length - 6)}</span>`
|
||||||
|
: `<span class="font-bold">${address}</span>`}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<img
|
||||||
|
src={qrCodeDataURL}
|
||||||
|
alt={`${cryptoName} QR code`}
|
||||||
|
width="128"
|
||||||
|
height="128"
|
||||||
|
class="mr-4 hidden size-36 rounded sm:block"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
65
web/src/constants/announcementTypes.ts
Normal file
65
web/src/constants/announcementTypes.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import { makeHelpersForOptions } from '../lib/makeHelpersForOptions'
|
||||||
|
import { transformCase } from '../lib/strings'
|
||||||
|
|
||||||
|
import type { AnnouncementType } from '@prisma/client'
|
||||||
|
|
||||||
|
type AnnouncementTypeInfo<T extends string | null | undefined = string> = {
|
||||||
|
value: T
|
||||||
|
label: string
|
||||||
|
icon: string
|
||||||
|
classNames: {
|
||||||
|
container: string
|
||||||
|
title: string
|
||||||
|
content: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const {
|
||||||
|
dataArray: announcementTypes,
|
||||||
|
dataObject: announcementTypesById,
|
||||||
|
getFn: getAnnouncementTypeInfo,
|
||||||
|
} = makeHelpersForOptions(
|
||||||
|
'value',
|
||||||
|
(value): AnnouncementTypeInfo<typeof value> => ({
|
||||||
|
value,
|
||||||
|
label: value ? transformCase(value.replaceAll('_', ' '), 'title') : String(value),
|
||||||
|
icon: 'ri:information-line',
|
||||||
|
classNames: {
|
||||||
|
container: 'bg-blue-900/40 border-blue-500/30',
|
||||||
|
title: 'text-blue-400',
|
||||||
|
content: 'text-blue-300',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
value: 'INFO',
|
||||||
|
label: 'Info',
|
||||||
|
icon: 'ri:information-line',
|
||||||
|
classNames: {
|
||||||
|
container: 'bg-blue-900/40 border-blue-500/30',
|
||||||
|
title: 'text-blue-400',
|
||||||
|
content: 'text-blue-300',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'WARNING',
|
||||||
|
label: 'Warning',
|
||||||
|
icon: 'ri:alert-line',
|
||||||
|
classNames: {
|
||||||
|
container: 'bg-yellow-900/40 border-yellow-500/30',
|
||||||
|
title: 'text-yellow-400',
|
||||||
|
content: 'text-yellow-300',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'ALERT',
|
||||||
|
label: 'Alert',
|
||||||
|
icon: 'ri:error-warning-line',
|
||||||
|
classNames: {
|
||||||
|
container: 'bg-red-900/40 border-red-500/30',
|
||||||
|
title: 'text-red-400',
|
||||||
|
content: 'text-red-300',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
] as const satisfies AnnouncementTypeInfo<AnnouncementType>[]
|
||||||
|
)
|
||||||
@@ -7,6 +7,8 @@ description: 'Learn how KYCnot.me website works and about our mission to protect
|
|||||||
icon: 'ri:information-line'
|
icon: 'ri:information-line'
|
||||||
---
|
---
|
||||||
|
|
||||||
|
import DonationAddress from '../components/DonationAddress.astro'
|
||||||
|
|
||||||
## What is this page?
|
## What is this page?
|
||||||
|
|
||||||
KYCnot.me is a directory of trustworthy alternatives for buying, exchanging, trading, and using cryptocurrencies without having to disclose your identity, thus preserving your right to privacy.
|
KYCnot.me is a directory of trustworthy alternatives for buying, exchanging, trading, and using cryptocurrencies without having to disclose your identity, thus preserving your right to privacy.
|
||||||
@@ -190,10 +192,13 @@ To **see comments waiting for moderation**, toggle the switch in the comments se
|
|||||||
|
|
||||||
## Support the project
|
## Support the project
|
||||||
|
|
||||||
If you like this project, you can support it through these methods:
|
If you like this project, you can **support** it through these methods:
|
||||||
|
|
||||||
- Monero:
|
<DonationAddress
|
||||||
- `88V2Xi2mvcu3NdnHkVeZGyPtACg2w3iXZdUMJugUiPvFQHv5mVkih3o43ceVGz6cVs9uTBMt4MRMVW2xFgfGdh8DTCQ7vtp`
|
cryptoName="Monero"
|
||||||
|
cryptoIcon="monero"
|
||||||
|
address="86nkJeHWarEYZJh3gcPGKcQeueKbq2uRRC2NX6kopBpdHFfY1j4vmrVAwRG1T4pNBwBwfJ4U4USLUZ6CjDtacp8x4y8v3rq"
|
||||||
|
/>
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
||||||
@@ -202,8 +207,7 @@ You can contact via direct chat or via email.
|
|||||||
- [SimpleX Chat](https://simplex.chat/contact#/?v=2&smp=smp%3A%2F%2F0YuTwO05YJWS8rkjn9eLJDjQhFKvIYd8d4xG8X1blIU%3D%40smp8.simplex.im%2FcgKHYUYnpAIVoGb9lxb0qEMEpvYIvc1O%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAIW_JSq8wOsLKG4Xv4O54uT2D_l8MJBYKQIFj1FjZpnU%253D%26srv%3Dbeccx4yfxxbvyhqypaavemqurytl6hozr47wfc7uuecacjqdvwpw2xid.onion)
|
- [SimpleX Chat](https://simplex.chat/contact#/?v=2&smp=smp%3A%2F%2F0YuTwO05YJWS8rkjn9eLJDjQhFKvIYd8d4xG8X1blIU%3D%40smp8.simplex.im%2FcgKHYUYnpAIVoGb9lxb0qEMEpvYIvc1O%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAIW_JSq8wOsLKG4Xv4O54uT2D_l8MJBYKQIFj1FjZpnU%253D%26srv%3Dbeccx4yfxxbvyhqypaavemqurytl6hozr47wfc7uuecacjqdvwpw2xid.onion)
|
||||||
|
|
||||||
- If you use ProtonMail or Tutanota, you can have E2E encrypted communications with us directly. We also offer a [PGP Key](/pgp). Otherwise, we recommend reaching out via SimpleX chat for encrypted communications.
|
- If you use ProtonMail or Tutanota, you can have E2E encrypted communications with us directly. We also offer a [PGP Key](/pgp). Otherwise, we recommend reaching out via SimpleX chat for encrypted communications.
|
||||||
- [tuta.io](https://tuta.io) - <kycnotme@tuta.io>
|
|
||||||
- [proton.me](https://proton.me) - <contact@kycnot.me>
|
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
@@ -4,6 +4,12 @@ import { actions, isInputError } from 'astro:actions'
|
|||||||
import { z } from 'astro:schema'
|
import { z } from 'astro:schema'
|
||||||
|
|
||||||
import { adminAnnouncementActions } from '../../../actions/admin/announcement'
|
import { adminAnnouncementActions } from '../../../actions/admin/announcement'
|
||||||
|
import Button from '../../../components/Button.astro'
|
||||||
|
import InputCardGroup from '../../../components/InputCardGroup.astro'
|
||||||
|
import InputSelect from '../../../components/InputSelect.astro'
|
||||||
|
import InputSubmitButton from '../../../components/InputSubmitButton.astro'
|
||||||
|
import InputText from '../../../components/InputText.astro'
|
||||||
|
import InputTextArea from '../../../components/InputTextArea.astro'
|
||||||
import SortArrowIcon from '../../../components/SortArrowIcon.astro'
|
import SortArrowIcon from '../../../components/SortArrowIcon.astro'
|
||||||
import TimeFormatted from '../../../components/TimeFormatted.astro'
|
import TimeFormatted from '../../../components/TimeFormatted.astro'
|
||||||
import Tooltip from '../../../components/Tooltip.astro'
|
import Tooltip from '../../../components/Tooltip.astro'
|
||||||
@@ -99,6 +105,8 @@ const updateResult = Astro.getActionResult(adminAnnouncementActions.update)
|
|||||||
const deleteResult = Astro.getActionResult(adminAnnouncementActions.delete)
|
const deleteResult = Astro.getActionResult(adminAnnouncementActions.delete)
|
||||||
const toggleResult = Astro.getActionResult(adminAnnouncementActions.toggleActive)
|
const toggleResult = Astro.getActionResult(adminAnnouncementActions.toggleActive)
|
||||||
|
|
||||||
|
const createInputErrors = isInputError(createResult?.error) ? createResult.error.fields : {}
|
||||||
|
|
||||||
// Add success messages to banners
|
// Add success messages to banners
|
||||||
Astro.locals.banners.addIfSuccess(createResult, 'Announcement created successfully!')
|
Astro.locals.banners.addIfSuccess(createResult, 'Announcement created successfully!')
|
||||||
Astro.locals.banners.addIfSuccess(updateResult, 'Announcement updated successfully!')
|
Astro.locals.banners.addIfSuccess(updateResult, 'Announcement updated successfully!')
|
||||||
@@ -221,100 +229,85 @@ if (toggleResult?.error) {
|
|||||||
<h2 class="font-title mb-4 text-lg font-semibold text-blue-400">Create New Announcement</h2>
|
<h2 class="font-title mb-4 text-lg font-semibold text-blue-400">Create New Announcement</h2>
|
||||||
<form method="POST" action={actions.admin.announcement.create} class="grid gap-4 md:grid-cols-2">
|
<form method="POST" action={actions.admin.announcement.create} class="grid gap-4 md:grid-cols-2">
|
||||||
<div class="space-y-3 md:col-span-2">
|
<div class="space-y-3 md:col-span-2">
|
||||||
<div>
|
<InputText
|
||||||
<label for="title" class="block text-xs font-medium text-zinc-400">Title*</label>
|
label="Title*"
|
||||||
<input
|
name="title"
|
||||||
type="text"
|
error={createInputErrors.title}
|
||||||
name="title"
|
inputProps={{
|
||||||
id="title"
|
required: true,
|
||||||
required
|
maxlength: 255,
|
||||||
maxlength="255"
|
placeholder: 'Announcement Title',
|
||||||
placeholder="Announcement Title"
|
value: newAnnouncement.title,
|
||||||
value={newAnnouncement.title}
|
}}
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<InputTextArea
|
||||||
<label for="content" class="block text-xs font-medium text-zinc-400">Content*</label>
|
label="Content*"
|
||||||
<textarea
|
name="content"
|
||||||
name="content"
|
error={createInputErrors.content}
|
||||||
id="content"
|
value={newAnnouncement.content}
|
||||||
required
|
inputProps={{
|
||||||
maxlength="1000"
|
required: true,
|
||||||
rows="3"
|
maxlength: 1000,
|
||||||
placeholder="Announcement Content"
|
rows: 3,
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
placeholder: 'Announcement Content',
|
||||||
>{newAnnouncement.content}</textarea
|
}}
|
||||||
>
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<div>
|
<InputSelect
|
||||||
<label for="type" class="block text-xs font-medium text-zinc-400">Type*</label>
|
label="Type*"
|
||||||
<select
|
name="type"
|
||||||
name="type"
|
error={createInputErrors.type}
|
||||||
id="type"
|
options={[
|
||||||
required
|
{ label: 'Info', value: 'INFO' },
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
{ label: 'Warning', value: 'WARNING' },
|
||||||
>
|
{ label: 'Alert', value: 'ALERT' },
|
||||||
<option value="INFO" selected={true}>Info</option>
|
]}
|
||||||
<option value="WARNING" selected={false}>Warning</option>
|
selectProps={{
|
||||||
<option value="ALERT" selected={false}>Alert</option>
|
required: true,
|
||||||
</select>
|
value: newAnnouncement.type,
|
||||||
</div>
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<div>
|
<InputText
|
||||||
<label for="startDate" class="block text-xs font-medium text-zinc-400">Start Date & Time*</label>
|
label="Start Date & Time*"
|
||||||
<input
|
name="startDate"
|
||||||
type="datetime-local"
|
error={createInputErrors.startDate}
|
||||||
name="startDate"
|
inputProps={{
|
||||||
id="startDate"
|
type: 'datetime-local',
|
||||||
required
|
required: true,
|
||||||
min={currentDate}
|
value: newAnnouncement.startDate,
|
||||||
value={newAnnouncement.startDate}
|
}}
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
<InputText
|
||||||
<label for="endDate" class="block text-xs font-medium text-zinc-400"
|
label="End Date & Time (Optional)"
|
||||||
>End Date & Time (Optional)</label
|
name="endDate"
|
||||||
>
|
error={createInputErrors.endDate}
|
||||||
<input
|
inputProps={{
|
||||||
type="datetime-local"
|
type: 'datetime-local',
|
||||||
name="endDate"
|
value: newAnnouncement.endDate,
|
||||||
id="endDate"
|
}}
|
||||||
min={currentDate}
|
/>
|
||||||
value={newAnnouncement.endDate}
|
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<div class="flex items-center">
|
<InputCardGroup
|
||||||
<input
|
name="isActive"
|
||||||
type="checkbox"
|
label="Status"
|
||||||
name="isActive"
|
error={createInputErrors.isActive}
|
||||||
id="isActive"
|
options={[
|
||||||
value="true"
|
{ label: 'Active', value: 'true' },
|
||||||
checked={newAnnouncement.isActive}
|
{ label: 'Inactive', value: 'false' },
|
||||||
class="h-4 w-4 rounded border-zinc-700 bg-zinc-900 text-blue-600 focus:ring-blue-500"
|
]}
|
||||||
/>
|
selectedValue={newAnnouncement.isActive ? 'true' : 'false'}
|
||||||
<label for="isActive" class="ml-2 block text-sm text-zinc-400">Active</label>
|
cardSize="sm"
|
||||||
</div>
|
/>
|
||||||
|
|
||||||
<div class="pt-4">
|
<div class="pt-4">
|
||||||
<button
|
<InputSubmitButton label="Create Announcement" icon="ri:save-line" />
|
||||||
type="submit"
|
|
||||||
class="inline-flex items-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-zinc-900 focus:outline-none"
|
|
||||||
>
|
|
||||||
<Icon name="ri:save-line" class="mr-1 h-4 w-4" />
|
|
||||||
Create Announcement
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
id="cancel-create"
|
id="cancel-create"
|
||||||
@@ -328,127 +321,6 @@ if (toggleResult?.error) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Edit Announcement Modal -->
|
|
||||||
<dialog
|
|
||||||
id="edit-announcement-modal"
|
|
||||||
class="m-auto w-full max-w-2xl rounded-lg border border-zinc-700 bg-zinc-800 p-0 backdrop:bg-black/70"
|
|
||||||
>
|
|
||||||
<div class="p-4">
|
|
||||||
<div class="mb-4 flex items-center justify-between border-b border-zinc-700 pb-3">
|
|
||||||
<h3 class="font-title text-lg font-semibold text-blue-400">Edit Announcement</h3>
|
|
||||||
<button type="button" class="close-modal text-zinc-400 hover:text-zinc-200">
|
|
||||||
<Icon name="ri:close-line" class="h-6 w-6" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<form
|
|
||||||
method="POST"
|
|
||||||
action={actions.admin.announcement.update}
|
|
||||||
id="edit-form"
|
|
||||||
class="grid gap-4 md:grid-cols-2"
|
|
||||||
>
|
|
||||||
<input type="hidden" name="id" id="edit-id" />
|
|
||||||
|
|
||||||
<div class="space-y-3 md:col-span-2">
|
|
||||||
<div>
|
|
||||||
<label for="edit-title" class="block text-xs font-medium text-zinc-400">Title*</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="title"
|
|
||||||
id="edit-title"
|
|
||||||
required
|
|
||||||
maxlength="255"
|
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="edit-content" class="block text-xs font-medium text-zinc-400">Content*</label>
|
|
||||||
<textarea
|
|
||||||
name="content"
|
|
||||||
id="edit-content"
|
|
||||||
required
|
|
||||||
maxlength="1000"
|
|
||||||
rows="3"
|
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
|
||||||
></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-3">
|
|
||||||
<div>
|
|
||||||
<label for="edit-type" class="block text-xs font-medium text-zinc-400">Type*</label>
|
|
||||||
<select
|
|
||||||
name="type"
|
|
||||||
id="edit-type"
|
|
||||||
required
|
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
|
||||||
>
|
|
||||||
<option value="INFO" selected={true}>Info</option>
|
|
||||||
<option value="WARNING" selected={false}>Warning</option>
|
|
||||||
<option value="ALERT" selected={false}>Alert</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="edit-startDate" class="block text-xs font-medium text-zinc-400"
|
|
||||||
>Start Date & Time*</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="datetime-local"
|
|
||||||
name="startDate"
|
|
||||||
id="edit-startDate"
|
|
||||||
required
|
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="edit-endDate" class="block text-xs font-medium text-zinc-400"
|
|
||||||
>End Date & Time (Optional)</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="datetime-local"
|
|
||||||
name="endDate"
|
|
||||||
id="edit-endDate"
|
|
||||||
class="mt-1 w-full rounded-md border border-zinc-700 bg-zinc-900 px-3 py-2 text-sm text-zinc-200 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-3">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="isActive"
|
|
||||||
id="edit-isActive"
|
|
||||||
value="true"
|
|
||||||
class="h-4 w-4 rounded border-zinc-700 bg-zinc-900 text-blue-600 focus:ring-blue-500"
|
|
||||||
/>
|
|
||||||
<label for="edit-isActive" class="ml-2 block text-sm text-zinc-400">Active</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="pt-4">
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
class="inline-flex items-center rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-zinc-900 focus:outline-none"
|
|
||||||
>
|
|
||||||
<Icon name="ri:save-line" class="mr-1 h-4 w-4" />
|
|
||||||
Update Announcement
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="close-modal ml-2 inline-flex items-center rounded-md border border-zinc-600 bg-zinc-800 px-4 py-2 text-sm font-medium text-zinc-300 hover:bg-zinc-700 focus:ring-2 focus:ring-zinc-500 focus:ring-offset-2 focus:ring-offset-zinc-900 focus:outline-none"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</dialog>
|
|
||||||
|
|
||||||
<!-- Delete Confirmation Modal -->
|
<!-- Delete Confirmation Modal -->
|
||||||
<dialog
|
<dialog
|
||||||
id="delete-confirmation-modal"
|
id="delete-confirmation-modal"
|
||||||
@@ -584,95 +456,196 @@ if (toggleResult?.error) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
announcements.map((announcement) => (
|
announcements.map((announcement) => (
|
||||||
<tr class="group hover:bg-zinc-700/30">
|
<>
|
||||||
<td class="px-4 py-3 text-sm">
|
<tr class="group hover:bg-zinc-700/30">
|
||||||
<div class="font-medium text-zinc-200">{announcement.title}</div>
|
<td class="px-4 py-3 text-sm">
|
||||||
<div class="mt-1 line-clamp-1 text-xs text-zinc-400">{announcement.content}</div>
|
<div class="font-medium text-zinc-200">{announcement.title}</div>
|
||||||
</td>
|
<div class="mt-1 line-clamp-1 text-xs text-zinc-400">{announcement.content}</div>
|
||||||
<td class="px-4 py-3 text-left text-sm">
|
</td>
|
||||||
<span
|
<td class="px-4 py-3 text-left text-sm">
|
||||||
class={`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-medium ${getTypeBadgeClass(announcement.type)}`}
|
<span
|
||||||
>
|
class={`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-medium ${getTypeBadgeClass(announcement.type)}`}
|
||||||
{announcement.type}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-3 text-left text-sm text-zinc-300">
|
|
||||||
<TimeFormatted date={announcement.startDate} hourPrecision={false} prefix={false} />
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-3 text-left text-sm text-zinc-300">
|
|
||||||
{announcement.endDate ? (
|
|
||||||
<TimeFormatted date={announcement.endDate} hourPrecision={false} prefix={false} />
|
|
||||||
) : (
|
|
||||||
<span class="text-zinc-500">—</span>
|
|
||||||
)}
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-3 text-center text-sm">
|
|
||||||
<span
|
|
||||||
class={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${announcement.isActive ? 'bg-green-900/30 text-green-400' : 'bg-zinc-700/50 text-zinc-400'}`}
|
|
||||||
>
|
|
||||||
{announcement.isActive ? 'Active' : 'Inactive'}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-3 text-left text-sm text-zinc-400">
|
|
||||||
<TimeFormatted date={announcement.createdAt} hourPrecision hoursShort prefix={false} />
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-3">
|
|
||||||
<div class="flex justify-center gap-2">
|
|
||||||
<Tooltip
|
|
||||||
as="button"
|
|
||||||
type="button"
|
|
||||||
data-id={announcement.id}
|
|
||||||
class="edit-button inline-flex items-center rounded-md border border-blue-500/50 bg-blue-500/20 px-1 py-1 text-xs text-blue-400 transition-colors hover:bg-blue-500/30"
|
|
||||||
text="Edit"
|
|
||||||
data-announcement={JSON.stringify(announcement)}
|
|
||||||
>
|
>
|
||||||
<Icon name="ri:edit-line" class="size-4" />
|
{announcement.type}
|
||||||
</Tooltip>
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="px-4 py-3 text-left text-sm text-zinc-300">
|
||||||
|
<TimeFormatted date={announcement.startDate} hourPrecision={false} prefix={false} />
|
||||||
|
</td>
|
||||||
|
<td class="px-4 py-3 text-left text-sm text-zinc-300">
|
||||||
|
{announcement.endDate ? (
|
||||||
|
<TimeFormatted date={announcement.endDate} hourPrecision={false} prefix={false} />
|
||||||
|
) : (
|
||||||
|
<span class="text-zinc-500">—</span>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td class="px-4 py-3 text-center text-sm">
|
||||||
|
<span
|
||||||
|
class={`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ${announcement.isActive ? 'bg-green-900/30 text-green-400' : 'bg-zinc-700/50 text-zinc-400'}`}
|
||||||
|
>
|
||||||
|
{announcement.isActive ? 'Active' : 'Inactive'}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="px-4 py-3 text-left text-sm text-zinc-400">
|
||||||
|
<TimeFormatted date={announcement.createdAt} hourPrecision hoursShort prefix={false} />
|
||||||
|
</td>
|
||||||
|
<td class="px-4 py-3">
|
||||||
|
<div class="flex justify-center gap-2">
|
||||||
|
<Tooltip
|
||||||
|
as="button"
|
||||||
|
type="button"
|
||||||
|
data-id={announcement.id}
|
||||||
|
class="edit-button inline-flex items-center rounded-md border border-blue-500/50 bg-blue-500/20 px-1 py-1 text-xs text-blue-400 transition-colors hover:bg-blue-500/30"
|
||||||
|
text="Edit"
|
||||||
|
onclick={`document.getElementById('edit-announcement-form-${announcement.id}').classList.toggle('hidden')`}
|
||||||
|
>
|
||||||
|
<Icon name="ri:edit-line" class="size-4" />
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
|
<form
|
||||||
|
method="POST"
|
||||||
|
action={actions.admin.announcement.toggleActive}
|
||||||
|
class="inline-block"
|
||||||
|
data-confirm={`Are you sure you want to ${announcement.isActive ? 'deactivate' : 'activate'} this announcement?`}
|
||||||
|
>
|
||||||
|
<input type="hidden" name="id" value={announcement.id} />
|
||||||
|
<input type="hidden" name="isActive" value={String(!announcement.isActive)} />
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class={`rounded-md border px-1 py-1 text-xs transition-colors ${
|
||||||
|
announcement.isActive
|
||||||
|
? 'border-yellow-500/50 bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/30'
|
||||||
|
: 'border-green-500/50 bg-green-500/20 text-green-400 hover:bg-green-500/30'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<Tooltip text={announcement.isActive ? 'Deactivate' : 'Activate'}>
|
||||||
|
<Icon
|
||||||
|
name={announcement.isActive ? 'ri:pause-circle-line' : 'ri:play-circle-line'}
|
||||||
|
class="size-4"
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form
|
||||||
|
method="POST"
|
||||||
|
action={actions.admin.announcement.delete}
|
||||||
|
class="inline-block"
|
||||||
|
data-confirm="Are you sure you want to delete this announcement?"
|
||||||
|
>
|
||||||
|
<input type="hidden" name="id" value={announcement.id} />
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class="rounded-md border border-red-500/50 bg-red-500/20 px-1 py-1 text-xs text-red-400 transition-colors hover:bg-red-500/30"
|
||||||
|
>
|
||||||
|
<Tooltip text="Delete">
|
||||||
|
<Icon name="ri:delete-bin-line" class="size-4" />
|
||||||
|
</Tooltip>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id={`edit-announcement-form-${announcement.id}`} class="hidden bg-zinc-700/20">
|
||||||
|
<td colspan="7" class="p-4">
|
||||||
|
<h3 class="font-title text-md mb-3 font-semibold text-blue-300">
|
||||||
|
Edit: {announcement.title}
|
||||||
|
</h3>
|
||||||
<form
|
<form
|
||||||
method="POST"
|
method="POST"
|
||||||
action={actions.admin.announcement.toggleActive}
|
action={actions.admin.announcement.update}
|
||||||
class="inline-block"
|
class="grid gap-4 md:grid-cols-2"
|
||||||
data-confirm={`Are you sure you want to ${announcement.isActive ? 'deactivate' : 'activate'} this announcement?`}
|
|
||||||
>
|
>
|
||||||
<input type="hidden" name="id" value={announcement.id} />
|
<input type="hidden" name="id" value={announcement.id} />
|
||||||
<input type="hidden" name="isActive" value={String(!announcement.isActive)} />
|
|
||||||
<button
|
<div class="space-y-3 md:col-span-2">
|
||||||
type="submit"
|
<InputText
|
||||||
class={`rounded-md border px-1 py-1 text-xs transition-colors ${
|
label="Title*"
|
||||||
announcement.isActive
|
name="title"
|
||||||
? 'border-yellow-500/50 bg-yellow-500/20 text-yellow-400 hover:bg-yellow-500/30'
|
inputProps={{
|
||||||
: 'border-green-500/50 bg-green-500/20 text-green-400 hover:bg-green-500/30'
|
id: `edit-title-${announcement.id}`,
|
||||||
}`}
|
required: true,
|
||||||
>
|
maxlength: 255,
|
||||||
<Tooltip text={announcement.isActive ? 'Deactivate' : 'Activate'}>
|
value: announcement.title,
|
||||||
<Icon
|
}}
|
||||||
name={announcement.isActive ? 'ri:pause-circle-line' : 'ri:play-circle-line'}
|
/>
|
||||||
class="size-4"
|
<InputTextArea
|
||||||
|
label="Content*"
|
||||||
|
name="content"
|
||||||
|
value={announcement.content}
|
||||||
|
inputProps={{
|
||||||
|
id: `edit-content-${announcement.id}`,
|
||||||
|
required: true,
|
||||||
|
maxlength: 1000,
|
||||||
|
rows: 3,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-3">
|
||||||
|
<InputSelect
|
||||||
|
label="Type*"
|
||||||
|
name="type"
|
||||||
|
options={[
|
||||||
|
{ label: 'Info', value: 'INFO' },
|
||||||
|
{ label: 'Warning', value: 'WARNING' },
|
||||||
|
{ label: 'Alert', value: 'ALERT' },
|
||||||
|
]}
|
||||||
|
selectProps={{
|
||||||
|
id: `edit-type-${announcement.id}`,
|
||||||
|
required: true,
|
||||||
|
value: announcement.type,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputText
|
||||||
|
label="Start Date & Time*"
|
||||||
|
name="startDate"
|
||||||
|
inputProps={{
|
||||||
|
id: `edit-startDate-${announcement.id}`,
|
||||||
|
type: 'datetime-local',
|
||||||
|
required: true,
|
||||||
|
value: new Date(announcement.startDate).toISOString().slice(0, 16),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputText
|
||||||
|
label="End Date & Time (Optional)"
|
||||||
|
name="endDate"
|
||||||
|
inputProps={{
|
||||||
|
id: `edit-endDate-${announcement.id}`,
|
||||||
|
type: 'datetime-local',
|
||||||
|
value: announcement.endDate
|
||||||
|
? new Date(announcement.endDate).toISOString().slice(0, 16)
|
||||||
|
: '',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-3">
|
||||||
|
<InputCardGroup
|
||||||
|
name="isActive"
|
||||||
|
label="Status"
|
||||||
|
options={[
|
||||||
|
{ label: 'Active', value: 'true' },
|
||||||
|
{ label: 'Inactive', value: 'false' },
|
||||||
|
]}
|
||||||
|
selectedValue={announcement.isActive ? 'true' : 'false'}
|
||||||
|
cardSize="sm"
|
||||||
|
/>
|
||||||
|
<div class="pt-4">
|
||||||
|
<InputSubmitButton label="Save Changes" icon="ri:save-line" hideCancel={true} />
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
label="Cancel"
|
||||||
|
color="gray"
|
||||||
|
onclick={`document.getElementById('edit-announcement-form-${announcement.id}').classList.toggle('hidden')`}
|
||||||
|
class="ml-2"
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</div>
|
||||||
</button>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
</td>
|
||||||
<form
|
</tr>
|
||||||
method="POST"
|
</>
|
||||||
action={actions.admin.announcement.delete}
|
|
||||||
class="inline-block"
|
|
||||||
data-confirm="Are you sure you want to delete this announcement?"
|
|
||||||
>
|
|
||||||
<input type="hidden" name="id" value={announcement.id} />
|
|
||||||
<button
|
|
||||||
type="submit"
|
|
||||||
class="rounded-md border border-red-500/50 bg-red-500/20 px-1 py-1 text-xs text-red-400 transition-colors hover:bg-red-500/30"
|
|
||||||
>
|
|
||||||
<Tooltip text="Delete">
|
|
||||||
<Icon name="ri:delete-bin-line" class="size-4" />
|
|
||||||
</Tooltip>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -714,6 +687,9 @@ if (toggleResult?.error) {
|
|||||||
input[type='date'] {
|
input[type='date'] {
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
|
input[type='datetime-local'] {
|
||||||
|
color-scheme: dark;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -730,53 +706,18 @@ if (toggleResult?.error) {
|
|||||||
newAnnouncementForm?.classList.add('hidden')
|
newAnnouncementForm?.classList.add('hidden')
|
||||||
})
|
})
|
||||||
|
|
||||||
// Edit Modal functionality
|
|
||||||
const editModal = document.getElementById('edit-announcement-modal') as HTMLDialogElement
|
|
||||||
const editButtons = document.querySelectorAll('.edit-button')
|
|
||||||
const editForm = document.getElementById('edit-form') as HTMLFormElement
|
|
||||||
|
|
||||||
editButtons.forEach((button) => {
|
|
||||||
button.addEventListener('click', () => {
|
|
||||||
const announcementData = JSON.parse(button.getAttribute('data-announcement') || '{}')
|
|
||||||
|
|
||||||
const idInput = document.getElementById('edit-id') as HTMLInputElement
|
|
||||||
const titleInput = document.getElementById('edit-title') as HTMLInputElement
|
|
||||||
const contentInput = document.getElementById('edit-content') as HTMLTextAreaElement
|
|
||||||
const typeSelect = document.getElementById('edit-type') as HTMLSelectElement
|
|
||||||
const startDateInput = document.getElementById('edit-startDate') as HTMLInputElement
|
|
||||||
const endDateInput = document.getElementById('edit-endDate') as HTMLInputElement
|
|
||||||
const isActiveCheckbox = document.getElementById('edit-isActive') as HTMLInputElement
|
|
||||||
|
|
||||||
idInput.value = announcementData.id.toString()
|
|
||||||
titleInput.value = announcementData.title
|
|
||||||
contentInput.value = announcementData.content
|
|
||||||
typeSelect.value = announcementData.type
|
|
||||||
|
|
||||||
// Format dates for the date inputs (YYYY-MM-DDThh:mm)
|
|
||||||
const formatDateForInput = (dateString: string | null) => {
|
|
||||||
if (!dateString) return ''
|
|
||||||
const date = new Date(dateString)
|
|
||||||
return date.toISOString().slice(0, 16)
|
|
||||||
}
|
|
||||||
|
|
||||||
startDateInput.value = formatDateForInput(announcementData.startDate) ?? ''
|
|
||||||
endDateInput.value = formatDateForInput(announcementData.endDate) ?? ''
|
|
||||||
isActiveCheckbox.checked = announcementData.isActive
|
|
||||||
|
|
||||||
editModal?.showModal()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
// Delete Modal functionality
|
// Delete Modal functionality
|
||||||
const deleteModal = document.getElementById('delete-confirmation-modal') as HTMLDialogElement
|
const deleteModal = document.getElementById('delete-confirmation-modal') as HTMLDialogElement
|
||||||
const deleteButtons = document.querySelectorAll('.delete-button')
|
const deleteButtons = document.querySelectorAll('.delete-button')
|
||||||
const deleteForm = document.getElementById('delete-form') as HTMLFormElement
|
// const deleteForm = document.getElementById('delete-form') as HTMLFormElement // Not strictly needed if not manipulating it
|
||||||
|
|
||||||
deleteButtons.forEach((button) => {
|
deleteButtons.forEach((button) => {
|
||||||
button.addEventListener('click', () => {
|
button.addEventListener('click', () => {
|
||||||
const id = button.getAttribute('data-id')
|
const id = button.getAttribute('data-id')
|
||||||
const deleteIdInput = document.getElementById('delete-id') as HTMLInputElement
|
const deleteIdInput = document.getElementById('delete-id') as HTMLInputElement
|
||||||
deleteIdInput.value = id || ''
|
if (deleteIdInput) {
|
||||||
|
deleteIdInput.value = id || ''
|
||||||
|
}
|
||||||
deleteModal?.showModal()
|
deleteModal?.showModal()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -186,7 +186,8 @@ if (redirectUrl) return Astro.redirect(redirectUrl.toString())
|
|||||||
|
|
||||||
export type ServicesFiltersObject = typeof filters
|
export type ServicesFiltersObject = typeof filters
|
||||||
|
|
||||||
const [categories, [services, totalServices, hadToIncludeCommunityContributed]] =
|
const currentDate = new Date()
|
||||||
|
const [categories, [services, totalServices, hadToIncludeCommunityContributed], activeAnnouncements] =
|
||||||
await Astro.locals.banners.tryMany([
|
await Astro.locals.banners.tryMany([
|
||||||
[
|
[
|
||||||
'Unable to load category filters.',
|
'Unable to load category filters.',
|
||||||
@@ -410,6 +411,28 @@ const [categories, [services, totalServices, hadToIncludeCommunityContributed]]
|
|||||||
},
|
},
|
||||||
[[] as [], 0, false] as const,
|
[[] as [], 0, false] as const,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'Unable to load announcements.',
|
||||||
|
() =>
|
||||||
|
prisma.announcement.findMany({
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
startDate: { lte: currentDate },
|
||||||
|
OR: [{ endDate: null }, { endDate: { gt: currentDate } }],
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
title: true,
|
||||||
|
content: true,
|
||||||
|
type: true,
|
||||||
|
startDate: true,
|
||||||
|
endDate: true,
|
||||||
|
isActive: true,
|
||||||
|
},
|
||||||
|
orderBy: [{ type: 'desc' }, { createdAt: 'desc' }],
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
],
|
||||||
])
|
])
|
||||||
|
|
||||||
const attributes = await Astro.locals.banners.try(
|
const attributes = await Astro.locals.banners.try(
|
||||||
@@ -489,18 +512,7 @@ const filtersOptions = {
|
|||||||
|
|
||||||
export type ServicesFiltersOptions = typeof filtersOptions
|
export type ServicesFiltersOptions = typeof filtersOptions
|
||||||
|
|
||||||
const currentDate = new Date()
|
//
|
||||||
const activeAnnouncements = await prisma.announcement.findMany({
|
|
||||||
where: {
|
|
||||||
isActive: true,
|
|
||||||
startDate: { lte: currentDate },
|
|
||||||
OR: [{ endDate: null }, { endDate: { gt: currentDate } }],
|
|
||||||
},
|
|
||||||
orderBy: [
|
|
||||||
{ type: 'desc' }, // ALERT first, then WARNING, then INFO
|
|
||||||
{ createdAt: 'desc' },
|
|
||||||
],
|
|
||||||
})
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout
|
<BaseLayout
|
||||||
@@ -516,7 +528,6 @@ const activeAnnouncements = await prisma.announcement.findMany({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<!-- Display announcements at the top of the page -->
|
|
||||||
<AnnouncementBanner announcements={activeAnnouncements} />
|
<AnnouncementBanner announcements={activeAnnouncements} />
|
||||||
|
|
||||||
<div class="flex flex-col gap-4 sm:flex-row sm:gap-8">
|
<div class="flex flex-col gap-4 sm:flex-row sm:gap-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user