Compare commits
8 Commits
release-20
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed86f863e3 | ||
|
|
845aa1185c | ||
|
|
17b3642f7e | ||
|
|
d64268d396 | ||
|
|
9c289753dd | ||
|
|
8bdbe8ea36 | ||
|
|
af7ebe813b | ||
|
|
dabc4e5c47 |
@@ -1,4 +1,6 @@
|
|||||||
DATABASE_URL="postgresql://kycnot:kycnot@localhost:3399/kycnot?schema=public"
|
DATABASE_URL="postgresql://kycnot:kycnot@localhost:3399/kycnot?schema=public"
|
||||||
REDIS_URL="redis://localhost:6379"
|
REDIS_URL="redis://localhost:6379"
|
||||||
SOURCE_CODE_URL="https://github.com"
|
SOURCE_CODE_URL="https://github.com"
|
||||||
SITE_URL="https://localhost:4321"
|
SITE_URL="https://localhost:4321"
|
||||||
|
ONION_ADDRESS="http://kycnotmezdiftahfmc34pqbpicxlnx3jbf5p7jypge7gdvduu7i6qjqd.onion"
|
||||||
|
I2P_ADDRESS="http://nti3rj4j4disjcm2kvp4eno7otcejbbxv3ggxwr5tpfk4jucah7q.b32.i2p"
|
||||||
|
|||||||
@@ -74,6 +74,18 @@ export default defineConfig({
|
|||||||
url: true,
|
url: true,
|
||||||
optional: false,
|
optional: false,
|
||||||
}),
|
}),
|
||||||
|
I2P_ADDRESS: envField.string({
|
||||||
|
context: 'server',
|
||||||
|
access: 'public',
|
||||||
|
url: true,
|
||||||
|
optional: false,
|
||||||
|
}),
|
||||||
|
ONION_ADDRESS: envField.string({
|
||||||
|
context: 'server',
|
||||||
|
access: 'public',
|
||||||
|
url: true,
|
||||||
|
optional: false,
|
||||||
|
}),
|
||||||
|
|
||||||
REDIS_URL: envField.string({
|
REDIS_URL: envField.string({
|
||||||
context: 'server',
|
context: 'server',
|
||||||
|
|||||||
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",
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Announcement" ADD COLUMN "link" TEXT;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the column `title` on the `Announcement` table. All the data in the column will be lost.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Announcement" DROP COLUMN "title";
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Announcement" ADD COLUMN "linkText" TEXT;
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
-- AlterEnum
|
||||||
|
ALTER TYPE "NotificationType" ADD VALUE 'KARMA_CHANGE';
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "Notification" ADD COLUMN "aboutKarmaTransactionId" INTEGER;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "NotificationPreferences" ADD COLUMN "karmaNotificationThreshold" INTEGER NOT NULL DEFAULT 10;
|
||||||
|
|
||||||
|
-- AddForeignKey
|
||||||
|
ALTER TABLE "Notification" ADD CONSTRAINT "Notification_aboutKarmaTransactionId_fkey" FOREIGN KEY ("aboutKarmaTransactionId") REFERENCES "KarmaTransaction"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||||
@@ -135,6 +135,7 @@ enum NotificationType {
|
|||||||
SUGGESTION_MESSAGE
|
SUGGESTION_MESSAGE
|
||||||
SUGGESTION_STATUS_CHANGE
|
SUGGESTION_STATUS_CHANGE
|
||||||
// KARMA_UNLOCK // TODO: [KARMA_UNLOCK] Will be added later, when karma unloks are in the database, not in the code.
|
// KARMA_UNLOCK // TODO: [KARMA_UNLOCK] Will be added later, when karma unloks are in the database, not in the code.
|
||||||
|
KARMA_CHANGE
|
||||||
/// Marked as spammer, promoted to admin, etc.
|
/// Marked as spammer, promoted to admin, etc.
|
||||||
ACCOUNT_STATUS_CHANGE
|
ACCOUNT_STATUS_CHANGE
|
||||||
EVENT_CREATED
|
EVENT_CREATED
|
||||||
@@ -207,6 +208,8 @@ model Notification {
|
|||||||
aboutCommentStatusChange CommentStatusChange?
|
aboutCommentStatusChange CommentStatusChange?
|
||||||
aboutServiceVerificationStatusChange ServiceVerificationStatusChange?
|
aboutServiceVerificationStatusChange ServiceVerificationStatusChange?
|
||||||
aboutSuggestionStatusChange ServiceSuggestionStatusChange?
|
aboutSuggestionStatusChange ServiceSuggestionStatusChange?
|
||||||
|
aboutKarmaTransaction KarmaTransaction? @relation(fields: [aboutKarmaTransactionId], references: [id])
|
||||||
|
aboutKarmaTransactionId Int?
|
||||||
|
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@index([read])
|
@@index([read])
|
||||||
@@ -229,6 +232,7 @@ model NotificationPreferences {
|
|||||||
enableOnMyCommentStatusChange Boolean @default(true)
|
enableOnMyCommentStatusChange Boolean @default(true)
|
||||||
enableAutowatchMyComments Boolean @default(true)
|
enableAutowatchMyComments Boolean @default(true)
|
||||||
enableNotifyPendingRepliesOnWatch Boolean @default(false)
|
enableNotifyPendingRepliesOnWatch Boolean @default(false)
|
||||||
|
karmaNotificationThreshold Int @default(10)
|
||||||
|
|
||||||
onEventCreatedForServices Service[] @relation("onEventCreatedForServices")
|
onEventCreatedForServices Service[] @relation("onEventCreatedForServices")
|
||||||
onRootCommentCreatedForServices Service[] @relation("onRootCommentCreatedForServices")
|
onRootCommentCreatedForServices Service[] @relation("onRootCommentCreatedForServices")
|
||||||
@@ -522,6 +526,7 @@ model KarmaTransaction {
|
|||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
grantedBy User? @relation("KarmaGrantedBy", fields: [grantedByUserId], references: [id], onDelete: SetNull)
|
grantedBy User? @relation("KarmaGrantedBy", fields: [grantedByUserId], references: [id], onDelete: SetNull)
|
||||||
grantedByUserId Int?
|
grantedByUserId Int?
|
||||||
|
Notification Notification[]
|
||||||
|
|
||||||
@@index([createdAt])
|
@@index([createdAt])
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
@@ -613,9 +618,10 @@ model ServiceUser {
|
|||||||
|
|
||||||
model Announcement {
|
model Announcement {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
title String
|
|
||||||
content String
|
content String
|
||||||
type AnnouncementType
|
type AnnouncementType
|
||||||
|
link String?
|
||||||
|
linkText String?
|
||||||
startDate DateTime
|
startDate DateTime
|
||||||
endDate DateTime?
|
endDate DateTime?
|
||||||
isActive Boolean @default(true)
|
isActive Boolean @default(true)
|
||||||
|
|||||||
29
web/prisma/triggers/11_notifications_karma.sql
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
CREATE OR REPLACE FUNCTION trigger_karma_notifications()
|
||||||
|
RETURNS TRIGGER AS $$
|
||||||
|
BEGIN
|
||||||
|
-- Only create notification if the user has enabled karma notifications
|
||||||
|
-- and the karma change exceeds their threshold
|
||||||
|
INSERT INTO "Notification" ("userId", "type", "aboutKarmaTransactionId")
|
||||||
|
SELECT NEW."userId", 'KARMA_CHANGE', NEW.id
|
||||||
|
FROM "NotificationPreferences" np
|
||||||
|
WHERE np."userId" = NEW."userId"
|
||||||
|
AND ABS(NEW.points) >= COALESCE(np."karmaNotificationThreshold", 10)
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1 FROM "Notification" n
|
||||||
|
WHERE n."userId" = NEW."userId"
|
||||||
|
AND n."type" = 'KARMA_CHANGE'
|
||||||
|
AND n."aboutKarmaTransactionId" = NEW.id
|
||||||
|
);
|
||||||
|
|
||||||
|
RETURN NEW;
|
||||||
|
END;
|
||||||
|
$$ LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
-- Drop the trigger if it exists to ensure a clean setup
|
||||||
|
DROP TRIGGER IF EXISTS karma_notifications_trigger ON "KarmaTransaction";
|
||||||
|
|
||||||
|
-- Create the trigger to fire after inserts
|
||||||
|
CREATE TRIGGER karma_notifications_trigger
|
||||||
|
AFTER INSERT ON "KarmaTransaction"
|
||||||
|
FOR EACH ROW
|
||||||
|
EXECUTE FUNCTION trigger_karma_notifications();
|
||||||
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 566 B |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 566 B |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 692 B |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 566 B |
@@ -14,6 +14,7 @@ import {
|
|||||||
EventType,
|
EventType,
|
||||||
type User,
|
type User,
|
||||||
ServiceUserRole,
|
ServiceUserRole,
|
||||||
|
AnnouncementType,
|
||||||
} from '@prisma/client'
|
} from '@prisma/client'
|
||||||
import { uniqBy } from 'lodash-es'
|
import { uniqBy } from 'lodash-es'
|
||||||
import { generateUsername } from 'unique-username-generator'
|
import { generateUsername } from 'unique-username-generator'
|
||||||
@@ -981,6 +982,22 @@ const generateFakeInternalNote = (userId: number, addedByUserId?: number) =>
|
|||||||
addedByUser: addedByUserId ? { connect: { id: addedByUserId } } : undefined,
|
addedByUser: addedByUserId ? { connect: { id: addedByUserId } } : undefined,
|
||||||
}) satisfies Prisma.InternalUserNoteCreateInput
|
}) satisfies Prisma.InternalUserNoteCreateInput
|
||||||
|
|
||||||
|
const generateFakeAnnouncement = () => {
|
||||||
|
const type = faker.helpers.arrayElement(Object.values(AnnouncementType))
|
||||||
|
const startDate = faker.date.past()
|
||||||
|
const endDate = faker.helpers.maybe(() => faker.date.future(), { probability: 0.3 })
|
||||||
|
|
||||||
|
return {
|
||||||
|
content: faker.lorem.sentence(),
|
||||||
|
type,
|
||||||
|
link: faker.internet.url(),
|
||||||
|
linkText: faker.lorem.word({ length: 2 }),
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
isActive: true,
|
||||||
|
} as const satisfies Prisma.AnnouncementCreateInput
|
||||||
|
}
|
||||||
|
|
||||||
async function runFaker() {
|
async function runFaker() {
|
||||||
await prisma.$transaction(
|
await prisma.$transaction(
|
||||||
async (tx) => {
|
async (tx) => {
|
||||||
@@ -1004,6 +1021,7 @@ async function runFaker() {
|
|||||||
await tx.category.deleteMany()
|
await tx.category.deleteMany()
|
||||||
await tx.internalUserNote.deleteMany()
|
await tx.internalUserNote.deleteMany()
|
||||||
await tx.user.deleteMany()
|
await tx.user.deleteMany()
|
||||||
|
await tx.announcement.deleteMany()
|
||||||
console.info('✅ Existing data cleaned up')
|
console.info('✅ Existing data cleaned up')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Error cleaning up data:', error)
|
console.error('❌ Error cleaning up data:', error)
|
||||||
@@ -1307,6 +1325,11 @@ async function runFaker() {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ---- Create announcement ----
|
||||||
|
await tx.announcement.create({
|
||||||
|
data: generateFakeAnnouncement(),
|
||||||
|
})
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
timeout: 1000 * 60 * 10, // 10 minutes
|
timeout: 1000 * 60 * 10, // 10 minutes
|
||||||
|
|||||||
@@ -151,15 +151,10 @@ export const accountActions = {
|
|||||||
permissions: 'user',
|
permissions: 'user',
|
||||||
input: z.object({
|
input: z.object({
|
||||||
id: z.coerce.number().int().positive(),
|
id: z.coerce.number().int().positive(),
|
||||||
displayName: z.string().max(100, 'Display name must be 100 characters or less').optional().nullable(),
|
displayName: z.string().max(100, 'Display name must be 100 characters or less').nullable(),
|
||||||
link: z
|
link: z.string().url('Must be a valid URL').max(255, 'URL must be 255 characters or less').nullable(),
|
||||||
.string()
|
|
||||||
.url('Must be a valid URL')
|
|
||||||
.max(255, 'URL must be 255 characters or less')
|
|
||||||
.optional()
|
|
||||||
.nullable(),
|
|
||||||
pictureFile: imageFileSchema,
|
pictureFile: imageFileSchema,
|
||||||
removePicture: z.coerce.boolean().default(false),
|
removePicture: z.coerce.boolean(),
|
||||||
}),
|
}),
|
||||||
handler: async (input, context) => {
|
handler: async (input, context) => {
|
||||||
if (input.id !== context.locals.user.id) {
|
if (input.id !== context.locals.user.id) {
|
||||||
@@ -170,7 +165,7 @@ export const accountActions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
input.displayName !== undefined &&
|
input.displayName !== null &&
|
||||||
input.displayName !== context.locals.user.displayName &&
|
input.displayName !== context.locals.user.displayName &&
|
||||||
!context.locals.user.karmaUnlocks.displayName
|
!context.locals.user.karmaUnlocks.displayName
|
||||||
) {
|
) {
|
||||||
@@ -181,7 +176,7 @@ export const accountActions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
input.link !== undefined &&
|
input.link !== null &&
|
||||||
input.link !== context.locals.user.link &&
|
input.link !== context.locals.user.link &&
|
||||||
!context.locals.user.karmaUnlocks.websiteLink
|
!context.locals.user.karmaUnlocks.websiteLink
|
||||||
) {
|
) {
|
||||||
@@ -198,6 +193,13 @@ export const accountActions = {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input.removePicture && !context.locals.user.karmaUnlocks.profilePicture) {
|
||||||
|
throw new ActionError({
|
||||||
|
code: 'FORBIDDEN',
|
||||||
|
message: makeKarmaUnlockMessage(karmaUnlocksById.profilePicture),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const pictureUrl =
|
const pictureUrl =
|
||||||
input.pictureFile && input.pictureFile.size > 0
|
input.pictureFile && input.pictureFile.size > 0
|
||||||
? await saveFileLocally(
|
? await saveFileLocally(
|
||||||
@@ -210,9 +212,13 @@ export const accountActions = {
|
|||||||
const user = await prisma.user.update({
|
const user = await prisma.user.update({
|
||||||
where: { id: context.locals.user.id },
|
where: { id: context.locals.user.id },
|
||||||
data: {
|
data: {
|
||||||
displayName: input.displayName ?? null,
|
displayName: context.locals.user.karmaUnlocks.displayName ? (input.displayName ?? null) : undefined,
|
||||||
link: input.link ?? null,
|
link: context.locals.user.karmaUnlocks.websiteLink ? (input.link ?? null) : undefined,
|
||||||
picture: input.removePicture ? null : (pictureUrl ?? undefined),
|
picture: context.locals.user.karmaUnlocks.profilePicture
|
||||||
|
? input.removePicture
|
||||||
|
? null
|
||||||
|
: (pictureUrl ?? undefined)
|
||||||
|
: undefined,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { type Prisma, type PrismaClient, type AnnouncementType } from '@prisma/client'
|
import { type Prisma, type PrismaClient } from '@prisma/client'
|
||||||
import { ActionError } from 'astro:actions'
|
import { ActionError } from 'astro:actions'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
|
|
||||||
@@ -9,9 +9,10 @@ const prisma = prismaInstance as PrismaClient
|
|||||||
|
|
||||||
const selectAnnouncementReturnFields = {
|
const selectAnnouncementReturnFields = {
|
||||||
id: true,
|
id: true,
|
||||||
title: true,
|
|
||||||
content: true,
|
content: true,
|
||||||
type: true,
|
type: true,
|
||||||
|
link: true,
|
||||||
|
linkText: true,
|
||||||
startDate: true,
|
startDate: true,
|
||||||
endDate: true,
|
endDate: true,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
@@ -24,12 +25,18 @@ export const adminAnnouncementActions = {
|
|||||||
accept: 'form',
|
accept: 'form',
|
||||||
permissions: 'admin',
|
permissions: 'admin',
|
||||||
input: z.object({
|
input: z.object({
|
||||||
title: z.string().min(1, 'Title is required').max(255, 'Title must be less than 255 characters'),
|
|
||||||
content: z
|
content: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, 'Content is required')
|
.min(1, 'Content is required')
|
||||||
.max(1000, 'Content must be less than 1000 characters'),
|
.max(1000, 'Content must be less than 1000 characters'),
|
||||||
type: z.enum(['INFO', 'WARNING', 'ALERT']),
|
type: z.enum(['INFO', 'WARNING', 'ALERT']),
|
||||||
|
link: z.string().url().nullable().optional(),
|
||||||
|
linkText: z
|
||||||
|
.string()
|
||||||
|
.min(1, 'Link text is required')
|
||||||
|
.max(255, 'Link text must be less than 255 characters')
|
||||||
|
.nullable()
|
||||||
|
.optional(),
|
||||||
startDate: z.coerce.date(),
|
startDate: z.coerce.date(),
|
||||||
endDate: z.coerce.date().nullable().optional(),
|
endDate: z.coerce.date().nullable().optional(),
|
||||||
isActive: z.coerce.boolean().default(true),
|
isActive: z.coerce.boolean().default(true),
|
||||||
@@ -37,8 +44,13 @@ export const adminAnnouncementActions = {
|
|||||||
handler: async (input) => {
|
handler: async (input) => {
|
||||||
const announcement = await prisma.announcement.create({
|
const announcement = await prisma.announcement.create({
|
||||||
data: {
|
data: {
|
||||||
...input,
|
content: input.content,
|
||||||
endDate: input.endDate || null,
|
type: input.type,
|
||||||
|
startDate: input.startDate,
|
||||||
|
isActive: input.isActive,
|
||||||
|
link: input.link ?? null,
|
||||||
|
linkText: input.linkText ?? null,
|
||||||
|
endDate: input.endDate ?? null,
|
||||||
},
|
},
|
||||||
select: selectAnnouncementReturnFields,
|
select: selectAnnouncementReturnFields,
|
||||||
})
|
})
|
||||||
@@ -52,12 +64,18 @@ export const adminAnnouncementActions = {
|
|||||||
permissions: 'admin',
|
permissions: 'admin',
|
||||||
input: z.object({
|
input: z.object({
|
||||||
id: z.coerce.number().int().positive(),
|
id: z.coerce.number().int().positive(),
|
||||||
title: z.string().min(1, 'Title is required').max(255, 'Title must be less than 255 characters'),
|
|
||||||
content: z
|
content: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, 'Content is required')
|
.min(1, 'Content is required')
|
||||||
.max(1000, 'Content must be less than 1000 characters'),
|
.max(1000, 'Content must be less than 1000 characters'),
|
||||||
type: z.enum(['INFO', 'WARNING', 'ALERT']),
|
type: z.enum(['INFO', 'WARNING', 'ALERT']),
|
||||||
|
link: z.string().url().nullable().optional(),
|
||||||
|
linkText: z
|
||||||
|
.string()
|
||||||
|
.min(1, 'Link text is required')
|
||||||
|
.max(255, 'Link text must be less than 255 characters')
|
||||||
|
.nullable()
|
||||||
|
.optional(),
|
||||||
startDate: z.coerce.date(),
|
startDate: z.coerce.date(),
|
||||||
endDate: z.coerce.date().nullable().optional(),
|
endDate: z.coerce.date().nullable().optional(),
|
||||||
isActive: z.coerce.boolean().default(true),
|
isActive: z.coerce.boolean().default(true),
|
||||||
@@ -82,8 +100,13 @@ export const adminAnnouncementActions = {
|
|||||||
const updatedAnnouncement = await prisma.announcement.update({
|
const updatedAnnouncement = await prisma.announcement.update({
|
||||||
where: { id: announcement.id },
|
where: { id: announcement.id },
|
||||||
data: {
|
data: {
|
||||||
...input,
|
content: input.content,
|
||||||
endDate: input.endDate || null,
|
type: input.type,
|
||||||
|
startDate: input.startDate,
|
||||||
|
isActive: input.isActive,
|
||||||
|
link: input.link ?? null,
|
||||||
|
linkText: input.linkText ?? null,
|
||||||
|
endDate: input.endDate ?? null,
|
||||||
},
|
},
|
||||||
select: selectAnnouncementReturnFields,
|
select: selectAnnouncementReturnFields,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export const notificationActions = {
|
|||||||
enableOnMyCommentStatusChange: z.coerce.boolean().optional(),
|
enableOnMyCommentStatusChange: z.coerce.boolean().optional(),
|
||||||
enableAutowatchMyComments: z.coerce.boolean().optional(),
|
enableAutowatchMyComments: z.coerce.boolean().optional(),
|
||||||
enableNotifyPendingRepliesOnWatch: z.coerce.boolean().optional(),
|
enableNotifyPendingRepliesOnWatch: z.coerce.boolean().optional(),
|
||||||
|
karmaNotificationThreshold: z.coerce.number().int().min(1).optional(),
|
||||||
}),
|
}),
|
||||||
handler: async (input, context) => {
|
handler: async (input, context) => {
|
||||||
await prisma.notificationPreferences.upsert({
|
await prisma.notificationPreferences.upsert({
|
||||||
@@ -39,12 +40,14 @@ export const notificationActions = {
|
|||||||
enableOnMyCommentStatusChange: input.enableOnMyCommentStatusChange,
|
enableOnMyCommentStatusChange: input.enableOnMyCommentStatusChange,
|
||||||
enableAutowatchMyComments: input.enableAutowatchMyComments,
|
enableAutowatchMyComments: input.enableAutowatchMyComments,
|
||||||
enableNotifyPendingRepliesOnWatch: input.enableNotifyPendingRepliesOnWatch,
|
enableNotifyPendingRepliesOnWatch: input.enableNotifyPendingRepliesOnWatch,
|
||||||
|
karmaNotificationThreshold: input.karmaNotificationThreshold,
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
userId: context.locals.user.id,
|
userId: context.locals.user.id,
|
||||||
enableOnMyCommentStatusChange: input.enableOnMyCommentStatusChange,
|
enableOnMyCommentStatusChange: input.enableOnMyCommentStatusChange,
|
||||||
enableAutowatchMyComments: input.enableAutowatchMyComments,
|
enableAutowatchMyComments: input.enableAutowatchMyComments,
|
||||||
enableNotifyPendingRepliesOnWatch: input.enableNotifyPendingRepliesOnWatch,
|
enableNotifyPendingRepliesOnWatch: input.enableNotifyPendingRepliesOnWatch,
|
||||||
|
karmaNotificationThreshold: input.karmaNotificationThreshold,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,82 +1,92 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from 'astro-icon/components'
|
import { Icon } from 'astro-icon/components'
|
||||||
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
|
import type { HTMLAttributes } from 'astro/types'
|
||||||
title: string
|
|
||||||
content: string
|
type Props = HTMLAttributes<'div'> & {
|
||||||
type: AnnouncementType
|
announcement: Prisma.AnnouncementGetPayload<{
|
||||||
startDate: Date
|
select: {
|
||||||
endDate: Date | null
|
id: true
|
||||||
isActive: boolean
|
content: true
|
||||||
|
type: true
|
||||||
|
link: true
|
||||||
|
linkText: true
|
||||||
|
startDate: true
|
||||||
|
endDate: true
|
||||||
|
isActive: true
|
||||||
|
}
|
||||||
|
}>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Props = {
|
const { announcement, class: className, ...props } = Astro.props
|
||||||
announcements: Announcement[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const { announcements } = Astro.props
|
const typeInfo = getAnnouncementTypeInfo(announcement.type)
|
||||||
|
|
||||||
// Get icon and class based on announcement type
|
const Tag = announcement.link ? 'a' : 'div'
|
||||||
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',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
---
|
---
|
||||||
|
|
||||||
{
|
<Tag
|
||||||
announcements.length > 0 && (
|
href={announcement.link}
|
||||||
<div class="mb-4 flex flex-col items-center space-y-1">
|
target={announcement.link ? '_blank' : undefined}
|
||||||
{announcements.map((announcement) => {
|
rel="noopener noreferrer"
|
||||||
const typeInfo = getTypeInfo(announcement.type)
|
class={cn(
|
||||||
|
'group xs:px-6 2xs:px-4 relative isolate z-50 flex items-center justify-center gap-x-2 overflow-hidden border-b border-zinc-800 bg-black px-2 py-2 focus-visible:outline-none sm:gap-x-6 sm:px-3.5',
|
||||||
return (
|
className
|
||||||
<div
|
)}
|
||||||
class={`flex flex-row items-center rounded border ${typeInfo.containerClass} mx-auto w-auto max-w-full px-3 py-2`}
|
{...props}
|
||||||
>
|
>
|
||||||
<Icon name={typeInfo.icon} class={`size-4 flex-shrink-0 ${typeInfo.titleClass} mr-2`} />
|
<div
|
||||||
<div class="flex min-w-0 flex-col">
|
aria-hidden="true"
|
||||||
<span class={`text-sm leading-tight font-bold ${typeInfo.titleClass} truncate`}>
|
class="pointer-events-none absolute top-1/2 left-[max(-7rem,calc(50%-52rem))] -z-10 -translate-y-1/2 transform-gpu blur-2xl"
|
||||||
{announcement.title}
|
>
|
||||||
</span>
|
<div
|
||||||
<span class={`text-xs ${typeInfo.contentClass} truncate leading-snug [&_a]:underline`}>
|
class={cn(
|
||||||
<Markdown content={announcement.content} />
|
'aspect-[577/310] w-[36.0625rem] bg-gradient-to-r from-green-500 to-green-700 opacity-20',
|
||||||
</span>
|
typeInfo.classNames.bg
|
||||||
</div>
|
)}
|
||||||
</div>
|
style="clip-path:polygon(74.8% 41.9%, 97.2% 73.2%, 100% 34.9%, 92.5% 0.4%, 87.5% 0%, 75% 28.6%, 58.5% 54.6%, 50.1% 56.8%, 46.9% 44%, 48.3% 17.4%, 24.7% 53.9%, 0% 27.9%, 11.9% 74.2%, 24.9% 54.1%, 68.6% 100%, 74.8% 41.9%)"
|
||||||
)
|
>
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
</div>
|
||||||
}
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
class="pointer-events-none absolute top-1/2 left-[max(45rem,calc(50%+8rem))] -z-10 -translate-y-1/2 transform-gpu blur-2xl"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class={cn(
|
||||||
|
'aspect-[577/310] w-[36.0625rem] bg-gradient-to-r from-green-500 to-green-700 opacity-30',
|
||||||
|
typeInfo.classNames.bg
|
||||||
|
)}
|
||||||
|
style="clip-path:polygon(74.8% 41.9%, 97.2% 73.2%, 100% 34.9%, 92.5% 0.4%, 87.5% 0%, 75% 28.6%, 58.5% 54.6%, 50.1% 56.8%, 46.9% 44%, 48.3% 17.4%, 24.7% 53.9%, 0% 27.9%, 11.9% 74.2%, 24.9% 54.1%, 68.6% 100%, 74.8% 41.9%)"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class={cn('flex items-center justify-between gap-x-3 md:justify-center', typeInfo.classNames.icon)}>
|
||||||
|
<Icon name={typeInfo.icon} class={cn('size-5 flex-shrink-0')} />
|
||||||
|
<span
|
||||||
|
class={cn(
|
||||||
|
'font-title animate-text-gradient line-clamp-3 bg-[linear-gradient(90deg,var(--gradient-edge,#FFEBF9)_0%,var(--gradient-center,#8a56cc)_50%,var(--gradient-edge,#FFEBF9)_100%)] bg-size-[200%] bg-clip-text text-sm leading-tight text-pretty text-transparent [&_a]:underline',
|
||||||
|
typeInfo.classNames.content
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{announcement.content}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="text-day-300 group-focus-visible:outline-primary transition-background 2xs:px-4 relative inline-flex h-full shrink-0 cursor-pointer items-center justify-center gap-1.5 overflow-hidden rounded-full border border-white/20 bg-black/10 p-[1px] px-1 py-1 text-sm font-medium shadow-sm backdrop-blur-3xl transition-colors group-hover:bg-white/5 group-focus-visible:ring-2 group-focus-visible:ring-blue-500 group-focus-visible:ring-offset-2 group-focus-visible:ring-offset-black/80 sm:min-w-[120px]"
|
||||||
|
>
|
||||||
|
<span class="2xs:inline-block hidden">
|
||||||
|
{announcement.linkText}
|
||||||
|
</span>
|
||||||
|
<Icon
|
||||||
|
name="ri:arrow-right-line"
|
||||||
|
class="size-4 shrink-0 transition-transform group-hover:translate-x-0.5"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Tag>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from 'astro-icon/components'
|
import { Icon } from 'astro-icon/components'
|
||||||
import { isInputError, type ActionAccept, type ActionClient } from 'astro:actions'
|
import { isInputError, type ActionAccept, type ActionClient } from 'astro:actions'
|
||||||
|
import { Image } from 'astro:assets'
|
||||||
|
|
||||||
import { CAPTCHA_LENGTH, generateCaptcha } from '../lib/captcha'
|
import { CAPTCHA_LENGTH, generateCaptcha } from '../lib/captcha'
|
||||||
import { cn } from '../lib/cn'
|
import { cn } from '../lib/cn'
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ const { messages, userId, class: className, ...htmlProps } = Astro.props
|
|||||||
{!!message.user.picture && (
|
{!!message.user.picture && (
|
||||||
<MyPicture
|
<MyPicture
|
||||||
src={message.user.picture}
|
src={message.user.picture}
|
||||||
height={16}
|
height={20}
|
||||||
width={16}
|
width={20}
|
||||||
class="inline-block rounded-full align-[-0.33em]"
|
class="inline-block size-5 rounded-full align-[-0.5em]"
|
||||||
alt=""
|
alt=""
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@@ -86,16 +86,15 @@ const { messages, userId, class: className, ...htmlProps } = Astro.props
|
|||||||
)}
|
)}
|
||||||
<p
|
<p
|
||||||
class={cn(
|
class={cn(
|
||||||
'rounded-xl p-3 text-sm whitespace-pre-wrap',
|
'rounded-xl p-3 text-sm wrap-anywhere whitespace-pre-wrap',
|
||||||
isCurrentUser ? 'bg-blue-900 text-white' : 'bg-night-500 text-day-300',
|
isCurrentUser ? 'bg-blue-900 text-white' : 'bg-night-500 text-day-300',
|
||||||
isCurrentUser ? 'rounded-br-xs' : 'rounded-bl-xs',
|
isCurrentUser ? 'rounded-br-xs' : 'rounded-bl-xs',
|
||||||
isCurrentUser && isNextFromSameUser && isNextSameDate && 'rounded-tr-xs',
|
isCurrentUser && isNextFromSameUser && isNextSameDate && 'rounded-tr-xs',
|
||||||
!isCurrentUser && isNextFromSameUser && isNextSameDate && 'rounded-tl-xs'
|
!isCurrentUser && isNextFromSameUser && isNextSameDate && 'rounded-tl-xs'
|
||||||
)}
|
)}
|
||||||
id={`message-${message.id.toString()}`}
|
id={`message-${message.id.toString()}`}
|
||||||
>
|
set:text={message.content}
|
||||||
{message.content}
|
/>
|
||||||
</p>
|
|
||||||
{(!isPrevFromSameUser || !isPrevSameDate) && (
|
{(!isPrevFromSameUser || !isPrevSameDate) && (
|
||||||
<p class="text-day-500 mt-0.5 mb-2 text-xs">{message.formattedCreatedAt}</p>
|
<p class="text-day-500 mt-0.5 mb-2 text-xs">{message.formattedCreatedAt}</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -371,8 +371,9 @@ const commentUrl = makeCommentUrl({ serviceSlug, commentId: comment.id, origin:
|
|||||||
comment.communityNote && (
|
comment.communityNote && (
|
||||||
<div class="mt-2 peer-checked/collapse:hidden">
|
<div class="mt-2 peer-checked/collapse:hidden">
|
||||||
<div class="border-l-2 border-zinc-600 bg-zinc-900/30 py-0.5 pl-2 text-xs">
|
<div class="border-l-2 border-zinc-600 bg-zinc-900/30 py-0.5 pl-2 text-xs">
|
||||||
<span class="font-medium text-zinc-400">Added context:</span>
|
<span class="prose prose-sm prose-invert prose-strong:text-zinc-300/90 text-xs text-zinc-300">
|
||||||
<span class="text-zinc-300">{comment.communityNote}</span>
|
<Markdown content={`**Added context:** ${comment.communityNote}`} />
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -110,16 +110,18 @@ if (!user || !user.admin || !user.verifier) return null
|
|||||||
<button
|
<button
|
||||||
class={cn(
|
class={cn(
|
||||||
'rounded-sm px-1.5 py-0.5 text-xs transition-colors',
|
'rounded-sm px-1.5 py-0.5 text-xs transition-colors',
|
||||||
comment.status === 'PENDING'
|
comment.status === 'PENDING' || comment.status === 'HUMAN_PENDING'
|
||||||
? 'border border-blue-500/30 bg-blue-500/20 text-blue-400'
|
? 'border border-blue-500/30 bg-blue-500/20 text-blue-400'
|
||||||
: 'bg-night-700 hover:bg-blue-500/20 hover:text-blue-400'
|
: 'bg-night-700 hover:bg-blue-500/20 hover:text-blue-400'
|
||||||
)}
|
)}
|
||||||
data-action="status"
|
data-action="status"
|
||||||
data-value={comment.status === 'PENDING' ? 'APPROVED' : 'PENDING'}
|
data-value={comment.status === 'PENDING' || comment.status === 'HUMAN_PENDING'
|
||||||
|
? 'APPROVED'
|
||||||
|
: 'PENDING'}
|
||||||
data-comment-id={comment.id}
|
data-comment-id={comment.id}
|
||||||
data-user-id={user.id}
|
data-user-id={user.id}
|
||||||
>
|
>
|
||||||
{comment.status === 'PENDING' ? 'Approve' : 'Pending'}
|
{comment.status === 'PENDING' || comment.status === 'HUMAN_PENDING' ? 'Approve' : 'Pending'}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
65
web/src/components/DonationAddress.astro
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
import { Icon } from 'astro-icon/components'
|
||||||
|
import * as 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: 256,
|
||||||
|
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="cursor-pointer px-7 font-mono text-base leading-snug tracking-wide break-all text-white select-all"
|
||||||
|
>
|
||||||
|
{
|
||||||
|
address.length > 12
|
||||||
|
? [
|
||||||
|
<span class="mr-0.5 font-bold text-green-500">{address.substring(0, 6)}</span>,
|
||||||
|
address.substring(6, address.length - 6),
|
||||||
|
<span class="ml-0.5 font-bold text-green-500">{address.substring(address.length - 6)}</span>,
|
||||||
|
]
|
||||||
|
: address
|
||||||
|
}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<img
|
||||||
|
src={qrCodeDataURL}
|
||||||
|
alt={`${cryptoName} QR code`}
|
||||||
|
width="128"
|
||||||
|
height="128"
|
||||||
|
class="mr-4 hidden size-32 rounded sm:block"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from 'astro-icon/components'
|
import { Icon } from 'astro-icon/components'
|
||||||
import { SOURCE_CODE_URL } from 'astro:env/server'
|
import { SOURCE_CODE_URL, I2P_ADDRESS, ONION_ADDRESS } from 'astro:env/server'
|
||||||
|
|
||||||
import { cn } from '../lib/cn'
|
import { cn } from '../lib/cn'
|
||||||
|
|
||||||
@@ -11,10 +11,22 @@ type Props = HTMLAttributes<'footer'>
|
|||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
href: SOURCE_CODE_URL,
|
href: SOURCE_CODE_URL,
|
||||||
label: 'Source Code',
|
label: 'Code',
|
||||||
icon: 'ri:git-repository-line',
|
icon: 'ri:git-repository-line',
|
||||||
external: true,
|
external: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
href: ONION_ADDRESS,
|
||||||
|
label: 'Tor',
|
||||||
|
icon: 'onion',
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: I2P_ADDRESS,
|
||||||
|
label: 'I2P',
|
||||||
|
icon: 'i2p',
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
href: '/about',
|
href: '/about',
|
||||||
label: 'About',
|
label: 'About',
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ const splashText = showSplashText ? sample(splashTexts) : null
|
|||||||
'border-red-900 bg-red-500/60': !!actualUser,
|
'border-red-900 bg-red-500/60': !!actualUser,
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
|
transition:name="header-container"
|
||||||
>
|
>
|
||||||
<nav class={cn('container mx-auto flex h-full w-full items-stretch justify-between px-4', classNames?.nav)}>
|
<nav class={cn('container mx-auto flex h-full w-full items-stretch justify-between px-4', classNames?.nav)}>
|
||||||
<div class="@container -ml-4 flex max-w-[192px] grow-99999 items-center">
|
<div class="@container -ml-4 flex max-w-[192px] grow-99999 items-center">
|
||||||
@@ -158,17 +159,15 @@ const splashText = showSplashText ? sample(splashTexts) : null
|
|||||||
<Icon name="ri:user-shared-2-line" class="size-4" />
|
<Icon name="ri:user-shared-2-line" class="size-4" />
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
DEPLOYMENT_MODE !== 'production' && (
|
<a
|
||||||
<a
|
href="/account/logout"
|
||||||
href="/account/logout"
|
data-astro-prefetch="tap"
|
||||||
data-astro-prefetch="tap"
|
class="xs:px-3 2xs:px-2 last:xs:-mr-3 last:2xs:-mr-2 flex h-full items-center px-1 text-sm text-stone-100 transition-colors last:-mr-1 hover:text-stone-200"
|
||||||
class="xs:px-3 2xs:px-2 last:xs:-mr-3 last:2xs:-mr-2 flex h-full items-center px-1 text-sm text-stone-100 transition-colors last:-mr-1 hover:text-stone-200"
|
transition:name="header-logout-link"
|
||||||
transition:name="header-logout-link"
|
aria-label="Logout"
|
||||||
aria-label="Logout"
|
>
|
||||||
>
|
<Icon name="ri:logout-box-r-line" class="size-4" />
|
||||||
<Icon name="ri:logout-box-r-line" class="size-4" />
|
</a>
|
||||||
</a>
|
|
||||||
)
|
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -25,8 +25,19 @@ const hasError = !!wrapperProps.error && wrapperProps.error.length > 0
|
|||||||
<InputWrapper inputId={inputId} {...wrapperProps}>
|
<InputWrapper inputId={inputId} {...wrapperProps}>
|
||||||
{
|
{
|
||||||
!!removeCheckbox && (
|
!!removeCheckbox && (
|
||||||
<label class="flex cursor-pointer items-center gap-2 py-1 pl-1 text-sm leading-none">
|
<label
|
||||||
<input transition:persist type="checkbox" name={removeCheckbox.name} data-remove-checkbox />
|
class={cn(
|
||||||
|
'flex cursor-pointer items-center gap-2 py-1 pl-1 text-sm leading-none',
|
||||||
|
disabled && 'cursor-not-allowed opacity-50'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
transition:persist
|
||||||
|
type="checkbox"
|
||||||
|
name={removeCheckbox.name}
|
||||||
|
data-remove-checkbox
|
||||||
|
disabled={disabled}
|
||||||
|
/>
|
||||||
{removeCheckbox.label || 'Remove'}
|
{removeCheckbox.label || 'Remove'}
|
||||||
</label>
|
</label>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ const hasError = !!wrapperProps.error && wrapperProps.error.length > 0
|
|||||||
hasError && baseInputClassNames.error,
|
hasError && baseInputClassNames.error,
|
||||||
!!inputProps?.disabled && baseInputClassNames.disabled
|
!!inputProps?.disabled && baseInputClassNames.disabled
|
||||||
)}
|
)}
|
||||||
name={wrapperProps.name}>{value}</textarea
|
name={wrapperProps.name}
|
||||||
>
|
set:text={value}
|
||||||
|
/>
|
||||||
</InputWrapper>
|
</InputWrapper>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { ComponentProps } from 'react'
|
|||||||
import { Picture } from 'astro:assets'
|
import { Picture } from 'astro:assets'
|
||||||
|
|
||||||
import defaultServiceImage from '../assets/fallback-service-image.jpg'
|
import defaultServiceImage from '../assets/fallback-service-image.jpg'
|
||||||
|
import { cn } from '../lib/cn'
|
||||||
|
|
||||||
const fallbackImages = {
|
const fallbackImages = {
|
||||||
service: defaultServiceImage,
|
service: defaultServiceImage,
|
||||||
@@ -20,6 +21,7 @@ const {
|
|||||||
fallback = undefined as keyof typeof fallbackImages | undefined,
|
fallback = undefined as keyof typeof fallbackImages | undefined,
|
||||||
height,
|
height,
|
||||||
width,
|
width,
|
||||||
|
pictureAttributes,
|
||||||
...props
|
...props
|
||||||
} = Astro.props
|
} = Astro.props
|
||||||
|
|
||||||
@@ -36,6 +38,10 @@ const fallbackImage = fallback ? fallbackImages[fallback] : undefined
|
|||||||
formats={formats}
|
formats={formats}
|
||||||
height={height ? Number(height) * 2 : undefined}
|
height={height ? Number(height) * 2 : undefined}
|
||||||
width={width ? Number(width) * 2 : undefined}
|
width={width ? Number(width) * 2 : undefined}
|
||||||
|
pictureAttributes={{
|
||||||
|
...pictureAttributes,
|
||||||
|
class: cn('shrink-0', pictureAttributes?.class),
|
||||||
|
}}
|
||||||
{...(props as any)}
|
{...(props as any)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const {
|
|||||||
class={cn(
|
class={cn(
|
||||||
'pointer-events-none hidden select-none group-hover/tooltip:flex',
|
'pointer-events-none hidden select-none group-hover/tooltip:flex',
|
||||||
'ease-out-cubic scale-75 opacity-0 transition-all transition-discrete duration-100 group-hover/tooltip:scale-100 group-hover/tooltip:opacity-100 starting:group-hover/tooltip:scale-75 starting:group-hover/tooltip:opacity-0',
|
'ease-out-cubic scale-75 opacity-0 transition-all transition-discrete duration-100 group-hover/tooltip:scale-100 group-hover/tooltip:opacity-100 starting:group-hover/tooltip:scale-75 starting:group-hover/tooltip:opacity-0',
|
||||||
'z-1000 w-max max-w-sm rounded-lg px-3 py-2 font-sans text-sm font-normal tracking-normal text-pretty whitespace-pre-wrap',
|
'z-1000 w-max max-w-sm rounded-lg px-3 py-2 font-sans text-sm font-normal tracking-normal text-pretty wrap-anywhere whitespace-pre-wrap',
|
||||||
// Position classes
|
// Position classes
|
||||||
{
|
{
|
||||||
'absolute -top-2 left-1/2 origin-bottom -translate-x-1/2 translate-y-[calc(-100%+0.5rem)] text-center group-hover/tooltip:-translate-y-full starting:group-hover/tooltip:translate-y-[calc(-100%+0.25rem)]':
|
'absolute -top-2 left-1/2 origin-bottom -translate-x-1/2 translate-y-[calc(-100%+0.5rem)] text-center group-hover/tooltip:-translate-y-full starting:group-hover/tooltip:translate-y-[calc(-100%+0.25rem)]':
|
||||||
@@ -85,9 +85,8 @@ const {
|
|||||||
},
|
},
|
||||||
classNames?.tooltip
|
classNames?.tooltip
|
||||||
)}
|
)}
|
||||||
>
|
set:text={text}
|
||||||
{text}
|
/>
|
||||||
</span>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</Component>
|
</Component>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const wasRecentlyAdded = isPast(listedDate) && differenceInDays(new Date(), list
|
|||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
{!!service.verificationSummary && (
|
{!!service.verificationSummary && (
|
||||||
<div class="mt-2 whitespace-pre-wrap">{service.verificationSummary}</div>
|
<div class="mt-2 wrap-anywhere whitespace-pre-wrap" set:text={service.verificationSummary} />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : service.verificationStatus === 'COMMUNITY_CONTRIBUTED' ? (
|
) : service.verificationStatus === 'COMMUNITY_CONTRIBUTED' ? (
|
||||||
|
|||||||
75
web/src/constants/announcementTypes.ts
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
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
|
||||||
|
bg: string
|
||||||
|
content: string
|
||||||
|
icon: string
|
||||||
|
badge: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export const {
|
||||||
|
dataArray: announcementTypes,
|
||||||
|
dataObject: announcementTypesById,
|
||||||
|
getFn: getAnnouncementTypeInfo,
|
||||||
|
zodEnumById: zodAnnouncementTypesById,
|
||||||
|
} = makeHelpersForOptions(
|
||||||
|
'value',
|
||||||
|
(value): AnnouncementTypeInfo<typeof value> => ({
|
||||||
|
value,
|
||||||
|
label: value ? transformCase(value.replaceAll('_', ' '), 'title') : String(value),
|
||||||
|
icon: 'ri:question-line',
|
||||||
|
classNames: {
|
||||||
|
container: 'bg-cyan-950',
|
||||||
|
bg: 'from-cyan-400 to-cyan-700',
|
||||||
|
content: '[--gradient-edge:var(--color-green-100)] [--gradient-center:var(--color-cyan-400)]',
|
||||||
|
icon: 'text-cyan-300/80',
|
||||||
|
badge: 'bg-blue-900/30 text-blue-400',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
value: 'INFO',
|
||||||
|
label: 'Info',
|
||||||
|
icon: 'ri:information-line',
|
||||||
|
classNames: {
|
||||||
|
container: 'bg-cyan-950',
|
||||||
|
bg: 'from-cyan-400 to-cyan-700',
|
||||||
|
content: '[--gradient-edge:var(--color-green-100)] [--gradient-center:var(--color-cyan-400)]',
|
||||||
|
icon: 'text-cyan-300/80',
|
||||||
|
badge: 'bg-blue-900/30 text-blue-400',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'WARNING',
|
||||||
|
label: 'Warning',
|
||||||
|
icon: 'ri:alert-fill',
|
||||||
|
classNames: {
|
||||||
|
container: 'bg-yellow-950',
|
||||||
|
bg: 'from-yellow-400 to-yellow-700',
|
||||||
|
content: '[--gradient-edge:var(--color-lime-100)] [--gradient-center:var(--color-yellow-400)]',
|
||||||
|
icon: 'text-yellow-400/80',
|
||||||
|
badge: 'bg-yellow-900/30 text-yellow-400',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: 'ALERT',
|
||||||
|
label: 'Alert',
|
||||||
|
icon: 'ri:spam-fill',
|
||||||
|
classNames: {
|
||||||
|
container: 'bg-red-950',
|
||||||
|
bg: 'from-red-400 to-red-700',
|
||||||
|
content: '[--gradient-edge:var(--color-red-100)] [--gradient-center:var(--color-rose-400)]',
|
||||||
|
icon: 'text-red-400/80',
|
||||||
|
badge: 'bg-red-900/30 text-red-400',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
] as const satisfies AnnouncementTypeInfo<AnnouncementType>[]
|
||||||
|
)
|
||||||
@@ -32,7 +32,7 @@ export const {
|
|||||||
{
|
{
|
||||||
id: 'HUMAN_PENDING',
|
id: 'HUMAN_PENDING',
|
||||||
icon: 'ri:question-line',
|
icon: 'ri:question-line',
|
||||||
label: 'Pending 2',
|
label: 'Pending',
|
||||||
creativeWorkStatus: 'Deleted',
|
creativeWorkStatus: 'Deleted',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,6 +50,15 @@ export const {
|
|||||||
badge: 'rounded-sm bg-blue-500/20 px-2 py-0.5 text-[12px] font-medium text-blue-500',
|
badge: 'rounded-sm bg-blue-500/20 px-2 py-0.5 text-[12px] font-medium text-blue-500',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Human Pending',
|
||||||
|
value: 'human-pending',
|
||||||
|
whereClause: { status: 'HUMAN_PENDING' },
|
||||||
|
styles: {
|
||||||
|
filter: 'border-blue-500 bg-blue-500/20 text-blue-400',
|
||||||
|
badge: 'rounded-sm bg-blue-500/20 px-2 py-0.5 text-[12px] font-medium text-blue-500',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Rejected',
|
label: 'Rejected',
|
||||||
value: 'rejected',
|
value: 'rejected',
|
||||||
@@ -123,10 +132,12 @@ export function getCommentStatusFilterValue(
|
|||||||
if (comment.suspicious) return 'suspicious'
|
if (comment.suspicious) return 'suspicious'
|
||||||
|
|
||||||
switch (comment.status) {
|
switch (comment.status) {
|
||||||
case 'PENDING':
|
case 'PENDING': {
|
||||||
case 'HUMAN_PENDING': {
|
|
||||||
return 'pending'
|
return 'pending'
|
||||||
}
|
}
|
||||||
|
case 'HUMAN_PENDING': {
|
||||||
|
return 'human-pending'
|
||||||
|
}
|
||||||
case 'VERIFIED': {
|
case 'VERIFIED': {
|
||||||
return 'verified'
|
return 'verified'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ export const {
|
|||||||
icon: 'ri:lightbulb-line',
|
icon: 'ri:lightbulb-line',
|
||||||
},
|
},
|
||||||
// TODO: [KARMA_UNLOCK] Will be added later, when karma unloks are in the database, not in the code.
|
// TODO: [KARMA_UNLOCK] Will be added later, when karma unloks are in the database, not in the code.
|
||||||
// {
|
{
|
||||||
// id: 'KARMA_UNLOCK',
|
id: 'KARMA_CHANGE',
|
||||||
// label: 'Karma unlock',
|
label: 'Karma recieved',
|
||||||
// icon: 'ri:award-line',
|
icon: 'ri:award-line',
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
id: 'ACCOUNT_STATUS_CHANGE',
|
id: 'ACCOUNT_STATUS_CHANGE',
|
||||||
label: 'Change in account status',
|
label: 'Change in account status',
|
||||||
|
|||||||
@@ -14,4 +14,7 @@ export const splashTexts: string[] = [
|
|||||||
'Ditch the gatekeepers.',
|
'Ditch the gatekeepers.',
|
||||||
'Own your identity.',
|
'Own your identity.',
|
||||||
'Financial privacy matters.',
|
'Financial privacy matters.',
|
||||||
|
'Surveillance is the enemy of the soul.',
|
||||||
|
'Privacy is freedom.',
|
||||||
|
'Privacy is the freedom to try things out.',
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export const {
|
|||||||
description:
|
description:
|
||||||
'Thoroughly tested and verified by the team. But things might change, this is not a guarantee.',
|
'Thoroughly tested and verified by the team. But things might change, this is not a guarantee.',
|
||||||
privacyPoints: 0,
|
privacyPoints: 0,
|
||||||
trustPoints: 5,
|
trustPoints: 10,
|
||||||
classNames: {
|
classNames: {
|
||||||
icon: 'text-[#40e6c2]',
|
icon: 'text-[#40e6c2]',
|
||||||
badgeBig: 'bg-green-800/50 text-green-100',
|
badgeBig: 'bg-green-800/50 text-green-100',
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
---
|
---
|
||||||
|
import AnnouncementBanner from '../components/AnnouncementBanner.astro'
|
||||||
import BaseHead from '../components/BaseHead.astro'
|
import BaseHead from '../components/BaseHead.astro'
|
||||||
import Footer from '../components/Footer.astro'
|
import Footer from '../components/Footer.astro'
|
||||||
import Header from '../components/Header.astro'
|
import Header from '../components/Header.astro'
|
||||||
import { cn } from '../lib/cn'
|
import { cn } from '../lib/cn'
|
||||||
|
import { prisma } from '../lib/prisma'
|
||||||
|
|
||||||
import type { AstroChildren } from '../lib/astro'
|
import type { AstroChildren } from '../lib/astro'
|
||||||
import type { ComponentProps } from 'astro/types'
|
import type { ComponentProps } from 'astro/types'
|
||||||
@@ -42,6 +44,31 @@ const {
|
|||||||
|
|
||||||
const actualErrors = [...errors, ...Astro.locals.banners.errors]
|
const actualErrors = [...errors, ...Astro.locals.banners.errors]
|
||||||
const actualSuccess = [...success, ...Astro.locals.banners.successes]
|
const actualSuccess = [...success, ...Astro.locals.banners.successes]
|
||||||
|
|
||||||
|
const currentDate = new Date()
|
||||||
|
const announcement = await Astro.locals.banners.try(
|
||||||
|
'Unable to load announcements.',
|
||||||
|
() =>
|
||||||
|
prisma.announcement.findFirst({
|
||||||
|
where: {
|
||||||
|
isActive: true,
|
||||||
|
startDate: { lte: currentDate },
|
||||||
|
OR: [{ endDate: null }, { endDate: { gt: currentDate } }],
|
||||||
|
},
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
content: true,
|
||||||
|
type: true,
|
||||||
|
link: true,
|
||||||
|
linkText: true,
|
||||||
|
startDate: true,
|
||||||
|
endDate: true,
|
||||||
|
isActive: true,
|
||||||
|
},
|
||||||
|
orderBy: [{ type: 'desc' }, { createdAt: 'desc' }],
|
||||||
|
}),
|
||||||
|
null
|
||||||
|
)
|
||||||
---
|
---
|
||||||
|
|
||||||
<html lang="en" transition:name="root" transition:animate="none">
|
<html lang="en" transition:name="root" transition:animate="none">
|
||||||
@@ -51,6 +78,7 @@ const actualSuccess = [...success, ...Astro.locals.banners.successes]
|
|||||||
<BaseHead {...baseHeadProps} />
|
<BaseHead {...baseHeadProps} />
|
||||||
</head>
|
</head>
|
||||||
<body class={cn('bg-night-700 text-day-300 flex min-h-dvh flex-col *:shrink-0', className?.body)}>
|
<body class={cn('bg-night-700 text-day-300 flex min-h-dvh flex-col *:shrink-0', className?.body)}>
|
||||||
|
{announcement && <AnnouncementBanner announcement={announcement} transition:name="header-announcement" />}
|
||||||
<Header
|
<Header
|
||||||
classNames={{
|
classNames={{
|
||||||
nav: cn(
|
nav: cn(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { accountStatusChangesById } from '../constants/accountStatusChange'
|
import { accountStatusChangesById } from '../constants/accountStatusChange'
|
||||||
import { commentStatusChangesById } from '../constants/commentStatusChange'
|
import { commentStatusChangesById } from '../constants/commentStatusChange'
|
||||||
import { eventTypesById } from '../constants/eventTypes'
|
import { eventTypesById } from '../constants/eventTypes'
|
||||||
|
import { getKarmaTransactionActionInfo } from '../constants/karmaTransactionActions'
|
||||||
import { serviceVerificationStatusChangesById } from '../constants/serviceStatusChange'
|
import { serviceVerificationStatusChangesById } from '../constants/serviceStatusChange'
|
||||||
import { serviceSuggestionStatusChangesById } from '../constants/suggestionStatusChange'
|
import { serviceSuggestionStatusChangesById } from '../constants/suggestionStatusChange'
|
||||||
|
|
||||||
@@ -16,6 +17,12 @@ export function makeNotificationTitle(
|
|||||||
aboutCommentStatusChange: true
|
aboutCommentStatusChange: true
|
||||||
aboutServiceVerificationStatusChange: true
|
aboutServiceVerificationStatusChange: true
|
||||||
aboutSuggestionStatusChange: true
|
aboutSuggestionStatusChange: true
|
||||||
|
aboutKarmaTransaction: {
|
||||||
|
select: {
|
||||||
|
points: true
|
||||||
|
action: true
|
||||||
|
}
|
||||||
|
}
|
||||||
aboutComment: {
|
aboutComment: {
|
||||||
select: {
|
select: {
|
||||||
author: { select: { id: true } }
|
author: { select: { id: true } }
|
||||||
@@ -137,6 +144,13 @@ export function makeNotificationTitle(
|
|||||||
// case 'KARMA_UNLOCK': {
|
// case 'KARMA_UNLOCK': {
|
||||||
// return 'New karma level unlocked'
|
// return 'New karma level unlocked'
|
||||||
// }
|
// }
|
||||||
|
case 'KARMA_CHANGE': {
|
||||||
|
if (!notification.aboutKarmaTransaction) return 'Your karma has changed'
|
||||||
|
const { points, action } = notification.aboutKarmaTransaction
|
||||||
|
const sign = points > 0 ? '+' : ''
|
||||||
|
const karmaInfo = getKarmaTransactionActionInfo(action)
|
||||||
|
return `${sign}${points.toLocaleString()} karma for ${karmaInfo.label}`
|
||||||
|
}
|
||||||
case 'ACCOUNT_STATUS_CHANGE': {
|
case 'ACCOUNT_STATUS_CHANGE': {
|
||||||
if (!notification.aboutAccountStatusChange) return 'Your account status has been updated'
|
if (!notification.aboutAccountStatusChange) return 'Your account status has been updated'
|
||||||
const accountStatusChange = accountStatusChangesById[notification.aboutAccountStatusChange]
|
const accountStatusChange = accountStatusChangesById[notification.aboutAccountStatusChange]
|
||||||
@@ -165,6 +179,11 @@ export function makeNotificationContent(
|
|||||||
notification: Prisma.NotificationGetPayload<{
|
notification: Prisma.NotificationGetPayload<{
|
||||||
select: {
|
select: {
|
||||||
type: true
|
type: true
|
||||||
|
aboutKarmaTransaction: {
|
||||||
|
select: {
|
||||||
|
description: true
|
||||||
|
}
|
||||||
|
}
|
||||||
aboutComment: {
|
aboutComment: {
|
||||||
select: {
|
select: {
|
||||||
content: true
|
content: true
|
||||||
@@ -187,6 +206,10 @@ export function makeNotificationContent(
|
|||||||
switch (notification.type) {
|
switch (notification.type) {
|
||||||
// TODO: [KARMA_UNLOCK] Will be added later, when karma unloks are in the database, not in the code.
|
// TODO: [KARMA_UNLOCK] Will be added later, when karma unloks are in the database, not in the code.
|
||||||
// case 'KARMA_UNLOCK':
|
// case 'KARMA_UNLOCK':
|
||||||
|
case 'KARMA_CHANGE': {
|
||||||
|
if (!notification.aboutKarmaTransaction) return null
|
||||||
|
return notification.aboutKarmaTransaction.description
|
||||||
|
}
|
||||||
case 'SUGGESTION_STATUS_CHANGE':
|
case 'SUGGESTION_STATUS_CHANGE':
|
||||||
case 'ACCOUNT_STATUS_CHANGE':
|
case 'ACCOUNT_STATUS_CHANGE':
|
||||||
case 'SERVICE_VERIFICATION_STATUS_CHANGE': {
|
case 'SERVICE_VERIFICATION_STATUS_CHANGE': {
|
||||||
@@ -280,6 +303,9 @@ export function makeNotificationLink(
|
|||||||
// case 'KARMA_UNLOCK': {
|
// case 'KARMA_UNLOCK': {
|
||||||
// return `${origin}/account#karma-unlocks`
|
// return `${origin}/account#karma-unlocks`
|
||||||
// }
|
// }
|
||||||
|
case 'KARMA_CHANGE': {
|
||||||
|
return `${origin}/account#karma-transactions`
|
||||||
|
}
|
||||||
case 'ACCOUNT_STATUS_CHANGE': {
|
case 'ACCOUNT_STATUS_CHANGE': {
|
||||||
return `${origin}/account#account-status`
|
return `${origin}/account#account-status`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,16 +39,19 @@ const {
|
|||||||
</p>
|
</p>
|
||||||
{
|
{
|
||||||
(DEPLOYMENT_MODE !== 'production' || Astro.locals.user?.admin) && (
|
(DEPLOYMENT_MODE !== 'production' || Astro.locals.user?.admin) && (
|
||||||
<div class="bg-night-800 mt-4 block max-h-96 min-h-32 w-full max-w-4xl overflow-auto rounded-lg p-4 text-left text-sm break-words whitespace-pre-wrap">
|
<div
|
||||||
{error instanceof Error
|
class="bg-night-800 mt-4 block max-h-96 min-h-32 w-full max-w-4xl overflow-auto rounded-lg p-4 text-left text-sm wrap-anywhere whitespace-pre-wrap"
|
||||||
? error.message
|
set:text={
|
||||||
: error === undefined
|
error instanceof Error
|
||||||
? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
? error.message
|
||||||
message || 'undefined'
|
: error === undefined
|
||||||
: typeof error === 'object'
|
? // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
? JSON.stringify(error, null, 2)
|
message || 'undefined'
|
||||||
: String(error as unknown)}
|
: typeof error === 'object'
|
||||||
</div>
|
? JSON.stringify(error, null, 2)
|
||||||
|
: String(error as unknown)
|
||||||
|
}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
@@ -188,22 +190,22 @@ Some reviews may be spam or fake. Read comments carefully and **always do your o
|
|||||||
|
|
||||||
To **see comments waiting for moderation**, toggle the switch in the comments section. These comments show up with a yellow background and a "pending" label.
|
To **see comments waiting for moderation**, toggle the switch in the comments section. These comments show up with a yellow background and a "pending" label.
|
||||||
|
|
||||||
## Support the project
|
## Support
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
You can contact via direct chat or via email.
|
You can contact via direct chat:
|
||||||
|
|
||||||
- [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.
|
|
||||||
- [tuta.io](https://tuta.io) - <kycnotme@tuta.io>
|
|
||||||
- [proton.me](https://proton.me) - <contact@kycnot.me>
|
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
@@ -34,9 +34,10 @@ if (reasonType === 'admin-required' && Astro.locals.user?.admin) {
|
|||||||
<h1 class="font-title mt-8 text-3xl font-semibold tracking-wide text-white sm:mt-12 sm:text-5xl">
|
<h1 class="font-title mt-8 text-3xl font-semibold tracking-wide text-white sm:mt-12 sm:text-5xl">
|
||||||
Access denied
|
Access denied
|
||||||
</h1>
|
</h1>
|
||||||
<p class="mt-8 text-lg leading-7 text-balance whitespace-pre-wrap text-red-400">
|
<p
|
||||||
{reason}
|
class="mt-8 text-lg leading-7 text-balance wrap-anywhere whitespace-pre-wrap text-red-400"
|
||||||
</p>
|
set:text={reason}
|
||||||
|
/>
|
||||||
|
|
||||||
<div class="mt-12 flex flex-wrap items-center justify-center">
|
<div class="mt-12 flex flex-wrap items-center justify-center">
|
||||||
<a href="/" class="focus-visible:outline-primary group flex items-center gap-2 px-3.5 py-2.5 text-white">
|
<a href="/" class="focus-visible:outline-primary group flex items-center gap-2 px-3.5 py-2.5 text-white">
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {}
|
|||||||
name="displayName"
|
name="displayName"
|
||||||
error={inputErrors.displayName}
|
error={inputErrors.displayName}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
value: user.displayName ?? '',
|
value: user.displayName,
|
||||||
maxlength: 100,
|
maxlength: 100,
|
||||||
disabled: !user.karmaUnlocks.displayName,
|
disabled: !user.karmaUnlocks.displayName,
|
||||||
}}
|
}}
|
||||||
@@ -62,7 +62,7 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {}
|
|||||||
name="link"
|
name="link"
|
||||||
error={inputErrors.link}
|
error={inputErrors.link}
|
||||||
inputProps={{
|
inputProps={{
|
||||||
value: user.link ?? '',
|
value: user.link,
|
||||||
type: 'url',
|
type: 'url',
|
||||||
placeholder: 'https://example.com',
|
placeholder: 'https://example.com',
|
||||||
disabled: !user.karmaUnlocks.websiteLink,
|
disabled: !user.karmaUnlocks.websiteLink,
|
||||||
|
|||||||
@@ -181,50 +181,50 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<section class="border-night-400 bg-night-400/5 rounded-lg border p-6 shadow-sm backdrop-blur-xs">
|
<section class="border-night-400 bg-night-400/5 rounded-lg border p-6 shadow-sm backdrop-blur-xs">
|
||||||
<header class="flex items-center gap-4">
|
<header class="flex flex-wrap items-center justify-center gap-4">
|
||||||
{
|
<div class="flex grow flex-wrap items-center justify-center gap-4">
|
||||||
user.picture ? (
|
{
|
||||||
<MyPicture
|
user.picture ? (
|
||||||
src={user.picture}
|
<MyPicture
|
||||||
alt=""
|
src={user.picture}
|
||||||
class="ring-day-500/30 size-16 rounded-full ring-2"
|
alt=""
|
||||||
width={64}
|
class="ring-day-500/30 xs:size-14 size-12 rounded-full ring-2 sm:size-16"
|
||||||
height={64}
|
width={64}
|
||||||
/>
|
height={64}
|
||||||
) : (
|
/>
|
||||||
<div class="bg-day-500/10 ring-day-500/30 text-day-400 flex size-16 items-center justify-center rounded-full ring-2">
|
) : (
|
||||||
<Icon name="ri:user-3-line" class="size-8" />
|
<div class="bg-day-500/10 ring-day-500/30 text-day-400 flex size-16 items-center justify-center rounded-full ring-2">
|
||||||
</div>
|
<Icon name="ri:user-3-line" class="size-8" />
|
||||||
)
|
</div>
|
||||||
}
|
)
|
||||||
<div>
|
}
|
||||||
<h1 class="font-title text-lg font-bold tracking-wider text-white">{user.name}</h1>
|
<div class="grow">
|
||||||
{user.displayName && <p class="text-day-200">{user.displayName}</p>}
|
<h1 class="font-title text-lg font-bold tracking-wider text-white">{user.name}</h1>
|
||||||
<div class="mt-1 flex gap-2">
|
{user.displayName && <p class="text-day-200">{user.displayName}</p>}
|
||||||
{
|
{
|
||||||
user.admin && (
|
(user.admin || user.verified || user.verifier) && (
|
||||||
<span class="rounded-full border border-red-500/50 bg-red-500/20 px-2 py-0.5 text-xs text-red-400">
|
<div class="mt-1 flex gap-2">
|
||||||
admin
|
{user.admin && (
|
||||||
</span>
|
<span class="rounded-full border border-red-500/50 bg-red-500/20 px-2 py-0.5 text-xs text-red-400">
|
||||||
)
|
admin
|
||||||
}
|
</span>
|
||||||
{
|
)}
|
||||||
user.verified && (
|
{user.verified && (
|
||||||
<span class="rounded-full border border-blue-500/50 bg-blue-500/20 px-2 py-0.5 text-xs text-blue-400">
|
<span class="rounded-full border border-blue-500/50 bg-blue-500/20 px-2 py-0.5 text-xs text-blue-400">
|
||||||
verified
|
verified
|
||||||
</span>
|
</span>
|
||||||
)
|
)}
|
||||||
}
|
{user.verifier && (
|
||||||
{
|
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
||||||
user.verifier && (
|
verifier
|
||||||
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
</span>
|
||||||
verifier
|
)}
|
||||||
</span>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<nav class="ml-auto flex items-center gap-2">
|
<nav class="flex flex-wrap items-center justify-center gap-2">
|
||||||
<Tooltip
|
<Tooltip
|
||||||
as="a"
|
as="a"
|
||||||
href={`/u/${user.name}`}
|
href={`/u/${user.name}`}
|
||||||
@@ -534,77 +534,38 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
|
|
||||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<h3 class="font-title border-day-700/20 text-day-200 border-b pb-2 text-sm">Positive unlocks</h3>
|
<input type="checkbox" id="positive-unlocks-toggle" class="peer sr-only md:hidden" checked />
|
||||||
|
<label
|
||||||
|
for="positive-unlocks-toggle"
|
||||||
|
class="flex cursor-pointer items-center justify-between border-b border-green-500/20 pb-2 md:cursor-default peer-checked:[&_[data-expand-arrow]]:rotate-180"
|
||||||
|
>
|
||||||
|
<h3 class="font-title text-day-200 text-sm">Positive unlocks</h3>
|
||||||
|
<Icon name="ri:arrow-down-s-line" class="text-day-400 size-5 md:hidden" data-expand-arrow />
|
||||||
|
</label>
|
||||||
|
|
||||||
{
|
<div class="mt-3 hidden space-y-3 peer-checked:block md:block">
|
||||||
sortBy(
|
{
|
||||||
karmaUnlocks.filter((unlock) => unlock.karma >= 0),
|
sortBy(
|
||||||
'karma'
|
karmaUnlocks.filter((unlock) => unlock.karma >= 0),
|
||||||
).map((unlock) => (
|
'karma'
|
||||||
<div
|
).map((unlock) => (
|
||||||
class={cn(
|
|
||||||
'flex items-center justify-between rounded-md border p-3',
|
|
||||||
user.karmaUnlocks[unlock.id]
|
|
||||||
? 'border-green-500/30 bg-green-500/10'
|
|
||||||
: 'border-night-500 bg-night-800'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div class="flex items-center">
|
|
||||||
<span class={cn('mr-3', user.karmaUnlocks[unlock.id] ? 'text-day-400' : 'text-day-500')}>
|
|
||||||
<Icon name={unlock.icon} class="size-5" />
|
|
||||||
</span>
|
|
||||||
<div>
|
|
||||||
<p
|
|
||||||
class={cn('font-medium', user.karmaUnlocks[unlock.id] ? 'text-day-300' : 'text-day-400')}
|
|
||||||
>
|
|
||||||
{unlock.name}
|
|
||||||
</p>
|
|
||||||
<p class="text-day-500 text-sm">{unlock.karma.toLocaleString()} karma</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
{user.karmaUnlocks[unlock.id] ? (
|
|
||||||
<span class="bg-day-500/20 text-day-300 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
|
||||||
<Icon name="ri:check-line" class="mr-1 size-3" /> Unlocked
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span class="bg-night-800 text-day-400 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
|
||||||
<Icon name="ri:lock-line" class="mr-1 size-3" /> Locked
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-3">
|
|
||||||
<h3 class="font-title border-b border-red-500/20 pb-2 text-sm text-red-400">Negative unlocks</h3>
|
|
||||||
|
|
||||||
{
|
|
||||||
sortBy(
|
|
||||||
karmaUnlocks.filter((unlock) => unlock.karma < 0),
|
|
||||||
'karma'
|
|
||||||
)
|
|
||||||
.reverse()
|
|
||||||
.map((unlock) => (
|
|
||||||
<div
|
<div
|
||||||
class={cn(
|
class={cn(
|
||||||
'flex items-center justify-between rounded-md border p-3',
|
'flex items-center justify-between rounded-md border p-3',
|
||||||
user.karmaUnlocks[unlock.id]
|
user.karmaUnlocks[unlock.id]
|
||||||
? 'border-red-500/30 bg-red-500/10'
|
? 'border-green-500/30 bg-green-500/10'
|
||||||
: 'border-night-500 bg-night-800'
|
: 'border-night-500 bg-night-800'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<span class={cn('mr-3', user.karmaUnlocks[unlock.id] ? 'text-red-400' : 'text-day-500')}>
|
<span class={cn('mr-3', user.karmaUnlocks[unlock.id] ? 'text-day-400' : 'text-day-500')}>
|
||||||
<Icon name={unlock.icon} class="size-5" />
|
<Icon name={unlock.icon} class="size-5" />
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
class={cn(
|
class={cn(
|
||||||
'font-medium',
|
'font-medium',
|
||||||
user.karmaUnlocks[unlock.id] ? 'text-red-400' : 'text-day-400'
|
user.karmaUnlocks[unlock.id] ? 'text-day-300' : 'text-day-400'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{unlock.name}
|
{unlock.name}
|
||||||
@@ -614,24 +575,85 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{user.karmaUnlocks[unlock.id] ? (
|
{user.karmaUnlocks[unlock.id] ? (
|
||||||
<span class="inline-flex items-center rounded-full bg-red-500/20 px-2 py-1 text-xs text-red-400">
|
<span class="bg-day-500/20 text-day-300 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
||||||
<Icon name="ri:alert-line" class="mr-1 size-3" /> Active
|
<Icon name="ri:check-line" class="mr-1 size-3" /> Unlocked
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<span class="bg-night-800 text-day-400 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
<span class="bg-night-800 text-day-400 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
||||||
<Icon name="ri:shield-check-line" class="mr-1 size-3" /> Avoided
|
<Icon name="ri:lock-line" class="mr-1 size-3" /> Locked
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="text-day-400 border-night-500/30 bg-night-800/70 mt-4 rounded-md border p-3 text-xs">
|
<div class="space-y-3">
|
||||||
<Icon name="ri:information-line" class="inline-block size-4" />
|
<input type="checkbox" id="negative-unlocks-toggle" class="peer sr-only md:hidden" />
|
||||||
Negative karma leads to restrictions. <br class="hidden sm:block" />Keep interactions positive to
|
|
||||||
avoid penalties.
|
<label
|
||||||
</p>
|
for="negative-unlocks-toggle"
|
||||||
|
class="flex cursor-pointer items-center justify-between border-b border-red-500/20 pb-2 md:cursor-default peer-checked:[&_[data-expand-arrow]]:rotate-180"
|
||||||
|
>
|
||||||
|
<h3 class="font-title text-sm text-red-400">Negative unlocks</h3>
|
||||||
|
<Icon name="ri:arrow-down-s-line" class="text-day-400 size-5 md:hidden" data-expand-arrow />
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="mt-3 hidden space-y-3 peer-checked:block md:block">
|
||||||
|
{
|
||||||
|
sortBy(
|
||||||
|
karmaUnlocks.filter((unlock) => unlock.karma < 0),
|
||||||
|
'karma'
|
||||||
|
)
|
||||||
|
.reverse()
|
||||||
|
.map((unlock) => (
|
||||||
|
<div
|
||||||
|
class={cn(
|
||||||
|
'flex items-center justify-between rounded-md border p-3',
|
||||||
|
user.karmaUnlocks[unlock.id]
|
||||||
|
? 'border-red-500/30 bg-red-500/10'
|
||||||
|
: 'border-night-500 bg-night-800'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<span class={cn('mr-3', user.karmaUnlocks[unlock.id] ? 'text-red-400' : 'text-day-500')}>
|
||||||
|
<Icon name={unlock.icon} class="size-5" />
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<p
|
||||||
|
class={cn(
|
||||||
|
'font-medium',
|
||||||
|
user.karmaUnlocks[unlock.id] ? 'text-red-400' : 'text-day-400'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{unlock.name}
|
||||||
|
</p>
|
||||||
|
<p class="text-day-500 text-sm">{unlock.karma.toLocaleString()} karma</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{user.karmaUnlocks[unlock.id] ? (
|
||||||
|
<span class="inline-flex items-center rounded-full bg-red-500/20 px-2 py-1 text-xs text-red-400">
|
||||||
|
<Icon name="ri:alert-line" class="mr-1 size-3" /> Active
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span class="bg-night-800 text-day-400 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
||||||
|
<Icon name="ri:shield-check-line" class="mr-1 size-3" /> Avoided
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
<p class="text-day-400 border-night-500/30 bg-night-800/70 mt-4 rounded-md border p-3 text-xs">
|
||||||
|
<Icon name="ri:information-line" class="inline-block size-4" />
|
||||||
|
Negative karma leads to restrictions. <br class="hidden sm:block" />Keep interactions positive to
|
||||||
|
avoid penalties.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@@ -858,7 +880,10 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
}
|
}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="border-night-400 bg-night-400/5 rounded-lg border p-6 shadow-sm backdrop-blur-xs">
|
<section
|
||||||
|
class="border-night-400 bg-night-400/5 rounded-lg border p-6 shadow-sm backdrop-blur-xs"
|
||||||
|
id="karma-transactions"
|
||||||
|
>
|
||||||
<header class="flex items-center justify-between">
|
<header class="flex items-center justify-between">
|
||||||
<h2 class="font-title text-day-200 mb-4 text-xl font-bold">
|
<h2 class="font-title text-day-200 mb-4 text-xl font-bold">
|
||||||
<Icon name="ri:exchange-line" class="mr-2 inline-block size-5" />
|
<Icon name="ri:exchange-line" class="mr-2 inline-block size-5" />
|
||||||
|
|||||||
@@ -4,9 +4,19 @@ 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 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'
|
||||||
|
import {
|
||||||
|
announcementTypes,
|
||||||
|
getAnnouncementTypeInfo,
|
||||||
|
zodAnnouncementTypesById,
|
||||||
|
} from '../../../constants/announcementTypes'
|
||||||
import BaseLayout from '../../../layouts/BaseLayout.astro'
|
import BaseLayout from '../../../layouts/BaseLayout.astro'
|
||||||
import { zodParseQueryParamsStoringErrors } from '../../../lib/parseUrlFilters'
|
import { zodParseQueryParamsStoringErrors } from '../../../lib/parseUrlFilters'
|
||||||
import { prisma } from '../../../lib/prisma'
|
import { prisma } from '../../../lib/prisma'
|
||||||
@@ -20,7 +30,7 @@ const { data: filters } = zodParseQueryParamsStoringErrors(
|
|||||||
.default('createdAt'),
|
.default('createdAt'),
|
||||||
'sort-order': z.enum(['asc', 'desc']).default('desc'),
|
'sort-order': z.enum(['asc', 'desc']).default('desc'),
|
||||||
search: z.string().optional(),
|
search: z.string().optional(),
|
||||||
type: z.enum(['INFO', 'WARNING', 'ALERT']).optional(),
|
type: zodAnnouncementTypesById.optional(),
|
||||||
status: z.enum(['active', 'inactive']).optional(),
|
status: z.enum(['active', 'inactive']).optional(),
|
||||||
},
|
},
|
||||||
Astro
|
Astro
|
||||||
@@ -35,10 +45,7 @@ const prismaOrderBy = {
|
|||||||
const whereClause: Prisma.AnnouncementWhereInput = {}
|
const whereClause: Prisma.AnnouncementWhereInput = {}
|
||||||
|
|
||||||
if (filters.search) {
|
if (filters.search) {
|
||||||
whereClause.OR = [
|
whereClause.OR = [{ content: { contains: filters.search, mode: 'insensitive' } }]
|
||||||
{ title: { contains: filters.search, mode: 'insensitive' } },
|
|
||||||
{ content: { contains: filters.search, mode: 'insensitive' } },
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.type) {
|
if (filters.type) {
|
||||||
@@ -66,32 +73,19 @@ const makeSortUrl = (slug: NonNullable<(typeof filters)['sort-by']>) => {
|
|||||||
return `/admin/announcements?${searchParams.toString()}`
|
return `/admin/announcements?${searchParams.toString()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get type badge class based on announcement type
|
|
||||||
const getTypeBadgeClass = (type: AnnouncementType) => {
|
|
||||||
switch (type) {
|
|
||||||
case 'INFO':
|
|
||||||
return 'bg-blue-900/30 text-blue-400'
|
|
||||||
case 'WARNING':
|
|
||||||
return 'bg-yellow-900/30 text-yellow-400'
|
|
||||||
case 'ALERT':
|
|
||||||
return 'bg-red-900/30 text-red-400'
|
|
||||||
default:
|
|
||||||
return 'bg-zinc-900/30 text-zinc-400'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Current date for form min values
|
// Current date for form min values
|
||||||
const currentDate = new Date().toISOString().slice(0, 16) // Format: YYYY-MM-DDThh:mm
|
const currentDate = new Date().toISOString().slice(0, 16) // Format: YYYY-MM-DDThh:mm
|
||||||
|
|
||||||
// Default new announcement
|
// Default new announcement
|
||||||
const newAnnouncement = {
|
const newAnnouncement = {
|
||||||
title: '',
|
|
||||||
content: '',
|
content: '',
|
||||||
type: 'INFO' as const,
|
type: 'INFO' as const,
|
||||||
|
link: null,
|
||||||
|
linkText: null,
|
||||||
startDate: currentDate,
|
startDate: currentDate,
|
||||||
endDate: '',
|
endDate: '',
|
||||||
isActive: true,
|
isActive: true as boolean,
|
||||||
}
|
} satisfies Prisma.AnnouncementCreateInput
|
||||||
|
|
||||||
// Get action results
|
// Get action results
|
||||||
const createResult = Astro.getActionResult(adminAnnouncementActions.create)
|
const createResult = Astro.getActionResult(adminAnnouncementActions.create)
|
||||||
@@ -99,6 +93,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!')
|
||||||
@@ -176,9 +172,13 @@ if (toggleResult?.error) {
|
|||||||
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"
|
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="" selected={!filters.type}>All Types</option>
|
<option value="" selected={!filters.type}>All Types</option>
|
||||||
<option value="INFO" selected={filters.type === 'INFO'}>Info</option>
|
{
|
||||||
<option value="WARNING" selected={filters.type === 'WARNING'}>Warning</option>
|
announcementTypes.map((type) => (
|
||||||
<option value="ALERT" selected={filters.type === 'ALERT'}>Alert</option>
|
<option value={type.value} selected={filters.type === type.value}>
|
||||||
|
{type.label}
|
||||||
|
</option>
|
||||||
|
))
|
||||||
|
}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -221,100 +221,91 @@ 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>
|
<InputTextArea
|
||||||
<label for="title" class="block text-xs font-medium text-zinc-400">Title*</label>
|
label="Content"
|
||||||
<input
|
name="content"
|
||||||
type="text"
|
error={createInputErrors.content}
|
||||||
name="title"
|
value={newAnnouncement.content}
|
||||||
id="title"
|
inputProps={{
|
||||||
required
|
required: true,
|
||||||
maxlength="255"
|
maxlength: 1000,
|
||||||
placeholder="Announcement Title"
|
rows: 3,
|
||||||
value={newAnnouncement.title}
|
placeholder: 'Announcement Content',
|
||||||
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>
|
|
||||||
<label for="content" class="block text-xs font-medium text-zinc-400">Content*</label>
|
|
||||||
<textarea
|
|
||||||
name="content"
|
|
||||||
id="content"
|
|
||||||
required
|
|
||||||
maxlength="1000"
|
|
||||||
rows="3"
|
|
||||||
placeholder="Announcement Content"
|
|
||||||
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"
|
|
||||||
>{newAnnouncement.content}</textarea
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<div>
|
<InputText
|
||||||
<label for="type" class="block text-xs font-medium text-zinc-400">Type*</label>
|
label="Link"
|
||||||
<select
|
name="link"
|
||||||
name="type"
|
error={createInputErrors.link}
|
||||||
id="type"
|
inputProps={{
|
||||||
required
|
type: 'url',
|
||||||
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"
|
placeholder: 'https://example.com',
|
||||||
>
|
}}
|
||||||
<option value="INFO" selected={true}>Info</option>
|
/>
|
||||||
<option value="WARNING" selected={false}>Warning</option>
|
<InputText
|
||||||
<option value="ALERT" selected={false}>Alert</option>
|
label="Link Text "
|
||||||
</select>
|
name="linkText"
|
||||||
</div>
|
error={createInputErrors.linkText}
|
||||||
|
inputProps={{
|
||||||
<div>
|
placeholder: 'Link Text',
|
||||||
<label for="startDate" class="block text-xs font-medium text-zinc-400">Start Date & Time*</label>
|
}}
|
||||||
<input
|
/>
|
||||||
type="datetime-local"
|
|
||||||
name="startDate"
|
|
||||||
id="startDate"
|
|
||||||
required
|
|
||||||
min={currentDate}
|
|
||||||
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>
|
|
||||||
<label for="endDate" class="block text-xs font-medium text-zinc-400"
|
|
||||||
>End Date & Time (Optional)</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="datetime-local"
|
|
||||||
name="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
|
label="Type"
|
||||||
type="checkbox"
|
name="type"
|
||||||
name="isActive"
|
options={announcementTypes.map((type) => ({
|
||||||
id="isActive"
|
label: type.label,
|
||||||
value="true"
|
value: type.value,
|
||||||
checked={newAnnouncement.isActive}
|
icon: type.icon,
|
||||||
class="h-4 w-4 rounded border-zinc-700 bg-zinc-900 text-blue-600 focus:ring-blue-500"
|
}))}
|
||||||
/>
|
cardSize="sm"
|
||||||
<label for="isActive" class="ml-2 block text-sm text-zinc-400">Active</label>
|
required
|
||||||
</div>
|
selectedValue={newAnnouncement.type}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputText
|
||||||
|
label="Start Date & Time"
|
||||||
|
name="startDate"
|
||||||
|
error={createInputErrors.startDate}
|
||||||
|
inputProps={{
|
||||||
|
type: 'datetime-local',
|
||||||
|
required: true,
|
||||||
|
value: newAnnouncement.startDate,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputText
|
||||||
|
label="End Date & Time"
|
||||||
|
name="endDate"
|
||||||
|
error={createInputErrors.endDate}
|
||||||
|
inputProps={{
|
||||||
|
type: 'datetime-local',
|
||||||
|
value: newAnnouncement.endDate,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="space-y-3">
|
||||||
|
<InputCardGroup
|
||||||
|
name="isActive"
|
||||||
|
label="Status"
|
||||||
|
error={createInputErrors.isActive}
|
||||||
|
options={[
|
||||||
|
{ label: 'Active', value: 'true' },
|
||||||
|
{ label: 'Inactive', value: 'false' },
|
||||||
|
]}
|
||||||
|
selectedValue={newAnnouncement.isActive ? 'true' : 'false'}
|
||||||
|
cardSize="sm"
|
||||||
|
/>
|
||||||
|
|
||||||
<div class="pt-4">
|
<div class="pt-4">
|
||||||
<button
|
<InputSubmitButton label="Create Announcement" icon="ri:save-line" hideCancel />
|
||||||
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 +319,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"
|
||||||
@@ -583,97 +453,215 @@ if (toggleResult?.error) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
announcements.map((announcement) => (
|
announcements.map((announcement) => {
|
||||||
<tr class="group hover:bg-zinc-700/30">
|
const announcementTypeInfo = getAnnouncementTypeInfo(announcement.type)
|
||||||
<td class="px-4 py-3 text-sm">
|
|
||||||
<div class="font-medium text-zinc-200">{announcement.title}</div>
|
|
||||||
<div class="mt-1 line-clamp-1 text-xs text-zinc-400">{announcement.content}</div>
|
|
||||||
</td>
|
|
||||||
<td class="px-4 py-3 text-left text-sm">
|
|
||||||
<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" />
|
|
||||||
</Tooltip>
|
|
||||||
|
|
||||||
<form
|
return (
|
||||||
method="POST"
|
<>
|
||||||
action={actions.admin.announcement.toggleActive}
|
<tr class="group hover:bg-zinc-700/30">
|
||||||
class="inline-block"
|
<td class="px-4 py-3 text-sm">
|
||||||
data-confirm={`Are you sure you want to ${announcement.isActive ? 'deactivate' : 'activate'} this announcement?`}
|
<div class="line-clamp-2 text-zinc-400">{announcement.content}</div>
|
||||||
>
|
</td>
|
||||||
<input type="hidden" name="id" value={announcement.id} />
|
<td class="px-4 py-3 text-left text-sm">
|
||||||
<input type="hidden" name="isActive" value={String(!announcement.isActive)} />
|
<span
|
||||||
<button
|
class={`inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-medium ${announcementTypeInfo.classNames.badge}`}
|
||||||
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={announcementTypeInfo.icon} class="me-1 size-3" />
|
||||||
<Icon
|
{announcementTypeInfo.label}
|
||||||
name={announcement.isActive ? 'ri:pause-circle-line' : 'ri:play-circle-line'}
|
</span>
|
||||||
class="size-4"
|
</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.content}
|
||||||
|
</h3>
|
||||||
|
<form
|
||||||
|
method="POST"
|
||||||
|
action={actions.admin.announcement.update}
|
||||||
|
class="grid gap-4 md:grid-cols-2"
|
||||||
|
>
|
||||||
|
<input type="hidden" name="id" value={announcement.id} />
|
||||||
|
|
||||||
|
<div class="space-y-3 md:col-span-2">
|
||||||
|
<InputTextArea
|
||||||
|
label="Content"
|
||||||
|
name="content"
|
||||||
|
value={announcement.content}
|
||||||
|
inputProps={{
|
||||||
|
required: true,
|
||||||
|
maxlength: 1000,
|
||||||
|
rows: 3,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</div>
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<form
|
<div class="space-y-3">
|
||||||
method="POST"
|
<InputText
|
||||||
action={actions.admin.announcement.delete}
|
label="Link"
|
||||||
class="inline-block"
|
name="link"
|
||||||
data-confirm="Are you sure you want to delete this announcement?"
|
inputProps={{
|
||||||
>
|
type: 'url',
|
||||||
<input type="hidden" name="id" value={announcement.id} />
|
placeholder: 'https://example.com',
|
||||||
<button
|
value: announcement.link,
|
||||||
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"
|
/>
|
||||||
>
|
<InputText
|
||||||
<Tooltip text="Delete">
|
label="Link Text"
|
||||||
<Icon name="ri:delete-bin-line" class="size-4" />
|
name="linkText"
|
||||||
</Tooltip>
|
inputProps={{
|
||||||
</button>
|
placeholder: 'Link Text',
|
||||||
</form>
|
value: announcement.linkText,
|
||||||
</div>
|
}}
|
||||||
</td>
|
/>
|
||||||
</tr>
|
</div>
|
||||||
))
|
|
||||||
|
<div class="space-y-3">
|
||||||
|
<InputCardGroup
|
||||||
|
label="Type"
|
||||||
|
name="type"
|
||||||
|
options={announcementTypes.map((type) => ({
|
||||||
|
label: type.label,
|
||||||
|
value: type.value,
|
||||||
|
icon: type.icon,
|
||||||
|
}))}
|
||||||
|
cardSize="sm"
|
||||||
|
required
|
||||||
|
selectedValue={announcement.type}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputText
|
||||||
|
label="Start Date & Time"
|
||||||
|
name="startDate"
|
||||||
|
inputProps={{
|
||||||
|
type: 'datetime-local',
|
||||||
|
required: true,
|
||||||
|
value: new Date(announcement.startDate).toISOString().slice(0, 16),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputText
|
||||||
|
label="End Date & Time"
|
||||||
|
name="endDate"
|
||||||
|
inputProps={{
|
||||||
|
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 />
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
label="Cancel"
|
||||||
|
color="gray"
|
||||||
|
onclick={`document.getElementById('edit-announcement-form-${announcement.id}').classList.toggle('hidden')`}
|
||||||
|
class="ml-2"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -714,6 +702,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 +721,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()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -180,7 +180,8 @@ const makeSortUrl = (slug: NonNullable<(typeof filters)['sort-by']>) => {
|
|||||||
required
|
required
|
||||||
rows="3"
|
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-green-500 focus:ring-green-500 focus:outline-none"
|
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-green-500 focus:ring-green-500 focus:outline-none"
|
||||||
></textarea>
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
createInputErrors.description && (
|
createInputErrors.description && (
|
||||||
<p class="mt-1 text-sm text-red-400">{createInputErrors.description.join(', ')}</p>
|
<p class="mt-1 text-sm text-red-400">{createInputErrors.description.join(', ')}</p>
|
||||||
@@ -593,9 +594,8 @@ const makeSortUrl = (slug: NonNullable<(typeof filters)['sort-by']>) => {
|
|||||||
required
|
required
|
||||||
rows="3"
|
rows="3"
|
||||||
class="mt-1 w-full rounded-md border border-zinc-600 bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
class="mt-1 w-full rounded-md border border-zinc-600 bg-zinc-800 px-3 py-2 text-sm text-zinc-200 placeholder-zinc-500 focus:border-blue-500 focus:ring-blue-500 focus:outline-none"
|
||||||
>
|
set:text={attribute.description}
|
||||||
{attribute.description}
|
/>
|
||||||
</textarea>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-4 sm:grid-cols-4">
|
<div class="grid grid-cols-2 gap-4 sm:grid-cols-4">
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ const statusInfo = getServiceSuggestionStatusInfo(serviceSuggestion.status)
|
|||||||
|
|
||||||
<span class="font-title text-gray-400">Submitted by:</span>
|
<span class="font-title text-gray-400">Submitted by:</span>
|
||||||
<span class="text-gray-300">
|
<span class="text-gray-300">
|
||||||
<a href={`/admin/users?name=${serviceSuggestion.user.name}`} class="hover:text-green-500">
|
<a href={`/admin/users/${serviceSuggestion.user.name}`} class="hover:text-green-500">
|
||||||
{serviceSuggestion.user.name}
|
{serviceSuggestion.user.name}
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
@@ -148,9 +148,10 @@ const statusInfo = getServiceSuggestionStatusInfo(serviceSuggestion.status)
|
|||||||
serviceSuggestion.notes && (
|
serviceSuggestion.notes && (
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<h3 class="font-title mb-1 text-sm text-gray-400">Notes from user:</h3>
|
<h3 class="font-title mb-1 text-sm text-gray-400">Notes from user:</h3>
|
||||||
<div class="rounded-md border border-gray-700 bg-black/50 p-3 text-sm whitespace-pre-wrap text-gray-300">
|
<div
|
||||||
{serviceSuggestion.notes}
|
class="rounded-md border border-gray-700 bg-black/50 p-3 text-sm wrap-anywhere whitespace-pre-wrap text-gray-300"
|
||||||
</div>
|
set:text={serviceSuggestion.notes}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ const makeSortUrl = (slug: string) => {
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 py-3">
|
<td class="px-4 py-3">
|
||||||
<a href={`/admin/users?name=${suggestion.user.name}`} class="hover:text-green-500">
|
<a href={`/admin/users/${suggestion.user.name}`} class="hover:text-green-500">
|
||||||
{suggestion.user.name}
|
{suggestion.user.name}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -211,8 +211,9 @@ const buttonSmallWarningClasses = cn(
|
|||||||
id="description"
|
id="description"
|
||||||
required
|
required
|
||||||
rows={4}
|
rows={4}
|
||||||
class={inputBaseClasses}>{service.description}</textarea
|
class={inputBaseClasses}
|
||||||
>
|
set:text={service.description}
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
serviceInputErrors.description && (
|
serviceInputErrors.description && (
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.description.join(', ')}</p>
|
<p class={errorTextClasses}>{serviceInputErrors.description.join(', ')}</p>
|
||||||
@@ -243,8 +244,8 @@ const buttonSmallWarningClasses = cn(
|
|||||||
id="serviceUrls"
|
id="serviceUrls"
|
||||||
rows={3}
|
rows={3}
|
||||||
placeholder="https://example1.com\nhttps://example2.com"
|
placeholder="https://example1.com\nhttps://example2.com"
|
||||||
>{service.serviceUrls.join('\n')}</textarea
|
set:text={service.serviceUrls.join('\n')}
|
||||||
>
|
/>
|
||||||
{
|
{
|
||||||
serviceInputErrors.serviceUrls && (
|
serviceInputErrors.serviceUrls && (
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.serviceUrls.join(', ')}</p>
|
<p class={errorTextClasses}>{serviceInputErrors.serviceUrls.join(', ')}</p>
|
||||||
@@ -260,8 +261,8 @@ const buttonSmallWarningClasses = cn(
|
|||||||
id="tosUrls"
|
id="tosUrls"
|
||||||
rows={3}
|
rows={3}
|
||||||
placeholder="https://example1.com/tos\nhttps://example2.com/tos"
|
placeholder="https://example1.com/tos\nhttps://example2.com/tos"
|
||||||
>{service.tosUrls.join('\n')}</textarea
|
set:text={service.tosUrls.join('\n')}
|
||||||
>
|
/>
|
||||||
{
|
{
|
||||||
serviceInputErrors.tosUrls && (
|
serviceInputErrors.tosUrls && (
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.tosUrls.join(', ')}</p>
|
<p class={errorTextClasses}>{serviceInputErrors.tosUrls.join(', ')}</p>
|
||||||
@@ -277,8 +278,8 @@ const buttonSmallWarningClasses = cn(
|
|||||||
id="onionUrls"
|
id="onionUrls"
|
||||||
rows={3}
|
rows={3}
|
||||||
placeholder="http://example1.onion\nhttp://example2.onion"
|
placeholder="http://example1.onion\nhttp://example2.onion"
|
||||||
>{service.onionUrls.join('\n')}</textarea
|
set:text={service.onionUrls.join('\n')}
|
||||||
>
|
/>
|
||||||
{
|
{
|
||||||
serviceInputErrors.onionUrls && (
|
serviceInputErrors.onionUrls && (
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.onionUrls.join(', ')}</p>
|
<p class={errorTextClasses}>{serviceInputErrors.onionUrls.join(', ')}</p>
|
||||||
@@ -294,8 +295,8 @@ const buttonSmallWarningClasses = cn(
|
|||||||
id="i2pUrls"
|
id="i2pUrls"
|
||||||
rows={3}
|
rows={3}
|
||||||
placeholder="http://example1.b32.i2p\nhttp://example2.b32.i2p"
|
placeholder="http://example1.b32.i2p\nhttp://example2.b32.i2p"
|
||||||
>{service.i2pUrls.join('\n')}</textarea
|
set:text={service.i2pUrls.join('\n')}
|
||||||
>
|
/>
|
||||||
{/* Assuming i2pUrls might have errors, add error display if schema supports it */}
|
{/* Assuming i2pUrls might have errors, add error display if schema supports it */}
|
||||||
{
|
{
|
||||||
/* serviceInputErrors.i2pUrls && (
|
/* serviceInputErrors.i2pUrls && (
|
||||||
@@ -515,8 +516,9 @@ const buttonSmallWarningClasses = cn(
|
|||||||
class={inputBaseClasses}
|
class={inputBaseClasses}
|
||||||
name="verificationSummary"
|
name="verificationSummary"
|
||||||
id="verificationSummary"
|
id="verificationSummary"
|
||||||
rows={4}>{service.verificationSummary}</textarea
|
rows={4}
|
||||||
>
|
set:text={service.verificationSummary}
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
serviceInputErrors.verificationSummary && (
|
serviceInputErrors.verificationSummary && (
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.verificationSummary.join(', ')}</p>
|
<p class={errorTextClasses}>{serviceInputErrors.verificationSummary.join(', ')}</p>
|
||||||
@@ -531,8 +533,9 @@ const buttonSmallWarningClasses = cn(
|
|||||||
class={inputBaseClasses}
|
class={inputBaseClasses}
|
||||||
name="verificationProofMd"
|
name="verificationProofMd"
|
||||||
id="verificationProofMd"
|
id="verificationProofMd"
|
||||||
rows={8}>{service.verificationProofMd}</textarea
|
rows={8}
|
||||||
>
|
set:text={service.verificationProofMd}
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
serviceInputErrors.verificationProofMd && (
|
serviceInputErrors.verificationProofMd && (
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.verificationProofMd.join(', ')}</p>
|
<p class={errorTextClasses}>{serviceInputErrors.verificationProofMd.join(', ')}</p>
|
||||||
@@ -731,9 +734,8 @@ const buttonSmallWarningClasses = cn(
|
|||||||
required
|
required
|
||||||
rows={3}
|
rows={3}
|
||||||
class={inputBaseClasses}
|
class={inputBaseClasses}
|
||||||
>
|
set:text={event.content}
|
||||||
{event.content}
|
/>
|
||||||
</textarea>
|
|
||||||
{eventUpdateInputErrors.content && (
|
{eventUpdateInputErrors.content && (
|
||||||
<p class={errorTextClasses}>{eventUpdateInputErrors.content.join(', ')}</p>
|
<p class={errorTextClasses}>{eventUpdateInputErrors.content.join(', ')}</p>
|
||||||
)}
|
)}
|
||||||
@@ -847,8 +849,14 @@ const buttonSmallWarningClasses = cn(
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="newEventContent" class={labelBaseClasses}>Content</label>
|
<label for="newEventContent" class={labelBaseClasses}>Content</label>
|
||||||
<textarea name="content" id="newEventContent" required rows={3} class={inputBaseClasses}
|
<textarea
|
||||||
></textarea>
|
name="content"
|
||||||
|
id="newEventContent"
|
||||||
|
required
|
||||||
|
rows={3}
|
||||||
|
class={inputBaseClasses}
|
||||||
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
eventInputErrors.content && (
|
eventInputErrors.content && (
|
||||||
<p class={errorTextClasses}>{eventInputErrors.content.join(', ')}</p>
|
<p class={errorTextClasses}>{eventInputErrors.content.join(', ')}</p>
|
||||||
@@ -1014,9 +1022,8 @@ const buttonSmallWarningClasses = cn(
|
|||||||
id={`stepDescriptionEdit-${step.id}`}
|
id={`stepDescriptionEdit-${step.id}`}
|
||||||
rows={2}
|
rows={2}
|
||||||
class={inputBaseClasses}
|
class={inputBaseClasses}
|
||||||
>
|
set:text={step.description}
|
||||||
{step.description}
|
/>
|
||||||
</textarea>
|
|
||||||
{verificationStepUpdateInputErrors.description && (
|
{verificationStepUpdateInputErrors.description && (
|
||||||
<p class={errorTextClasses}>
|
<p class={errorTextClasses}>
|
||||||
{verificationStepUpdateInputErrors.description.join(', ')}
|
{verificationStepUpdateInputErrors.description.join(', ')}
|
||||||
@@ -1032,9 +1039,8 @@ const buttonSmallWarningClasses = cn(
|
|||||||
id={`stepEvidenceMdEdit-${step.id}`}
|
id={`stepEvidenceMdEdit-${step.id}`}
|
||||||
rows={4}
|
rows={4}
|
||||||
class={inputBaseClasses}
|
class={inputBaseClasses}
|
||||||
>
|
set:text={step.evidenceMd}
|
||||||
{step.evidenceMd}
|
/>
|
||||||
</textarea>
|
|
||||||
{verificationStepUpdateInputErrors.evidenceMd && (
|
{verificationStepUpdateInputErrors.evidenceMd && (
|
||||||
<p class={errorTextClasses}>
|
<p class={errorTextClasses}>
|
||||||
{verificationStepUpdateInputErrors.evidenceMd.join(', ')}
|
{verificationStepUpdateInputErrors.evidenceMd.join(', ')}
|
||||||
@@ -1104,8 +1110,14 @@ const buttonSmallWarningClasses = cn(
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="newStepDescription" class={labelBaseClasses}>Description (Max 200 chars)</label>
|
<label for="newStepDescription" class={labelBaseClasses}>Description (Max 200 chars)</label>
|
||||||
<textarea name="description" id="newStepDescription" required rows={3} class={inputBaseClasses}
|
<textarea
|
||||||
></textarea>
|
name="description"
|
||||||
|
id="newStepDescription"
|
||||||
|
required
|
||||||
|
rows={3}
|
||||||
|
class={inputBaseClasses}
|
||||||
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
verificationStepInputErrors.description && (
|
verificationStepInputErrors.description && (
|
||||||
<p class={errorTextClasses}>{verificationStepInputErrors.description.join(', ')}</p>
|
<p class={errorTextClasses}>{verificationStepInputErrors.description.join(', ')}</p>
|
||||||
@@ -1114,7 +1126,13 @@ const buttonSmallWarningClasses = cn(
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="newStepEvidenceMd" class={labelBaseClasses}>Evidence (Markdown)</label>
|
<label for="newStepEvidenceMd" class={labelBaseClasses}>Evidence (Markdown)</label>
|
||||||
<textarea name="evidenceMd" id="newStepEvidenceMd" rows={5} class={inputBaseClasses}></textarea>
|
<textarea
|
||||||
|
name="evidenceMd"
|
||||||
|
id="newStepEvidenceMd"
|
||||||
|
rows={5}
|
||||||
|
class={inputBaseClasses}
|
||||||
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
verificationStepInputErrors.evidenceMd && (
|
verificationStepInputErrors.evidenceMd && (
|
||||||
<p class={errorTextClasses}>{verificationStepInputErrors.evidenceMd.join(', ')}</p>
|
<p class={errorTextClasses}>{verificationStepInputErrors.evidenceMd.join(', ')}</p>
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {}
|
|||||||
id="description"
|
id="description"
|
||||||
required
|
required
|
||||||
class="font-title w-full rounded-md border border-green-500/30 bg-black/50 p-2 text-gray-300 placeholder-gray-500 focus:border-green-500 focus:ring-green-500"
|
class="font-title w-full rounded-md border border-green-500/30 bg-black/50 p-2 text-gray-300 placeholder-gray-500 focus:border-green-500 focus:ring-green-500"
|
||||||
></textarea>
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
inputErrors.description && (
|
inputErrors.description && (
|
||||||
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.description.join(', ')}</p>
|
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.description.join(', ')}</p>
|
||||||
@@ -80,7 +81,9 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {}
|
|||||||
name="serviceUrls"
|
name="serviceUrls"
|
||||||
id="serviceUrls"
|
id="serviceUrls"
|
||||||
rows={3}
|
rows={3}
|
||||||
placeholder="https://example1.com https://example2.com"></textarea>
|
placeholder="https://example1.com https://example2.com"
|
||||||
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
inputErrors.serviceUrls && (
|
inputErrors.serviceUrls && (
|
||||||
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.serviceUrls.join(', ')}</p>
|
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.serviceUrls.join(', ')}</p>
|
||||||
@@ -96,7 +99,9 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {}
|
|||||||
name="tosUrls"
|
name="tosUrls"
|
||||||
id="tosUrls"
|
id="tosUrls"
|
||||||
rows={3}
|
rows={3}
|
||||||
placeholder="https://example1.com/tos https://example2.com/tos"></textarea>
|
placeholder="https://example1.com/tos https://example2.com/tos"
|
||||||
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
inputErrors.tosUrls && (
|
inputErrors.tosUrls && (
|
||||||
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.tosUrls.join(', ')}</p>
|
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.tosUrls.join(', ')}</p>
|
||||||
@@ -112,7 +117,9 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {}
|
|||||||
name="onionUrls"
|
name="onionUrls"
|
||||||
id="onionUrls"
|
id="onionUrls"
|
||||||
rows={3}
|
rows={3}
|
||||||
placeholder="http://example.onion"></textarea>
|
placeholder="http://example.onion"
|
||||||
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
inputErrors.onionUrls && (
|
inputErrors.onionUrls && (
|
||||||
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.onionUrls.join(', ')}</p>
|
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.onionUrls.join(', ')}</p>
|
||||||
@@ -266,7 +273,9 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {}
|
|||||||
class="font-title w-full rounded-md border border-green-500/30 bg-black/50 p-2 text-gray-300 placeholder-gray-500 focus:border-green-500 focus:ring-green-500"
|
class="font-title w-full rounded-md border border-green-500/30 bg-black/50 p-2 text-gray-300 placeholder-gray-500 focus:border-green-500 focus:ring-green-500"
|
||||||
name="verificationSummary"
|
name="verificationSummary"
|
||||||
id="verificationSummary"
|
id="verificationSummary"
|
||||||
rows={3}></textarea>
|
rows={3}
|
||||||
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
inputErrors.verificationSummary && (
|
inputErrors.verificationSummary && (
|
||||||
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.verificationSummary.join(', ')}</p>
|
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.verificationSummary.join(', ')}</p>
|
||||||
@@ -283,7 +292,9 @@ const inputErrors = isInputError(result?.error) ? result.error.fields : {}
|
|||||||
class="font-title w-full rounded-md border border-green-500/30 bg-black/50 p-2 text-gray-300 placeholder-gray-500 focus:border-green-500 focus:ring-green-500"
|
class="font-title w-full rounded-md border border-green-500/30 bg-black/50 p-2 text-gray-300 placeholder-gray-500 focus:border-green-500 focus:ring-green-500"
|
||||||
name="verificationProofMd"
|
name="verificationProofMd"
|
||||||
id="verificationProofMd"
|
id="verificationProofMd"
|
||||||
rows={10}></textarea>
|
rows={10}
|
||||||
|
set:text=""
|
||||||
|
/>
|
||||||
{
|
{
|
||||||
inputErrors.verificationProofMd && (
|
inputErrors.verificationProofMd && (
|
||||||
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.verificationProofMd.join(', ')}</p>
|
<p class="font-title mt-1 text-sm text-red-500">{inputErrors.verificationProofMd.join(', ')}</p>
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div data-note-content>
|
<div data-note-content>
|
||||||
<p class="text-day-200 whitespace-pre-wrap">{note.content}</p>
|
<p class="text-day-200 wrap-anywhere whitespace-pre-wrap" set:text={note.content} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
|
|||||||
@@ -336,6 +336,14 @@ const makeSortUrl = (slug: NonNullable<(typeof filters)['sort-by']>) => {
|
|||||||
>
|
>
|
||||||
<Icon name="ri:edit-line" class="size-4" />
|
<Icon name="ri:edit-line" class="size-4" />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
<Tooltip
|
||||||
|
as="a"
|
||||||
|
href={`/u/${user.name}`}
|
||||||
|
class="inline-flex items-center rounded-md border border-green-500/50 bg-green-500/20 px-1 py-1 text-xs text-green-400 transition-colors hover:bg-green-500/30"
|
||||||
|
text="Public profile"
|
||||||
|
>
|
||||||
|
<Icon name="ri:global-line" class="size-4" />
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { z } from 'astro:schema'
|
|||||||
import { groupBy, orderBy } from 'lodash-es'
|
import { groupBy, orderBy } from 'lodash-es'
|
||||||
import seedrandom from 'seedrandom'
|
import seedrandom from 'seedrandom'
|
||||||
|
|
||||||
import AnnouncementBanner from '../components/AnnouncementBanner.astro'
|
|
||||||
import Button from '../components/Button.astro'
|
import Button from '../components/Button.astro'
|
||||||
import Pagination from '../components/Pagination.astro'
|
import Pagination from '../components/Pagination.astro'
|
||||||
import ServiceFiltersPill from '../components/ServiceFiltersPill.astro'
|
import ServiceFiltersPill from '../components/ServiceFiltersPill.astro'
|
||||||
@@ -489,18 +488,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,9 +504,6 @@ const activeAnnouncements = await prisma.announcement.findMany({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<!-- Display announcements at the top of the page -->
|
|
||||||
<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">
|
||||||
<div
|
<div
|
||||||
class='[&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-offset-night-700 flex items-stretch sm:hidden [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-2 [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-green-500 [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-offset-2'
|
class='[&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-offset-night-700 flex items-stretch sm:hidden [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-2 [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-green-500 [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-offset-2'
|
||||||
|
|||||||
@@ -124,6 +124,13 @@ const [dbNotifications, notificationPreferences, totalNotifications] = await Ast
|
|||||||
verificationStatus: true,
|
verificationStatus: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
aboutKarmaTransaction: {
|
||||||
|
select: {
|
||||||
|
points: true,
|
||||||
|
action: true,
|
||||||
|
description: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
[],
|
[],
|
||||||
@@ -136,6 +143,7 @@ const [dbNotifications, notificationPreferences, totalNotifications] = await Ast
|
|||||||
enableOnMyCommentStatusChange: true,
|
enableOnMyCommentStatusChange: true,
|
||||||
enableAutowatchMyComments: true,
|
enableAutowatchMyComments: true,
|
||||||
enableNotifyPendingRepliesOnWatch: true,
|
enableNotifyPendingRepliesOnWatch: true,
|
||||||
|
karmaNotificationThreshold: true,
|
||||||
}),
|
}),
|
||||||
null,
|
null,
|
||||||
],
|
],
|
||||||
@@ -232,7 +240,7 @@ const notifications = dbNotifications.map((notification) => ({
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="font-medium text-zinc-200">{notification.title}</div>
|
<div class="font-medium text-zinc-200">{notification.title}</div>
|
||||||
<p class="text-sm text-zinc-400">{notification.content}</p>
|
<p class="text-sm wrap-anywhere text-zinc-400">{notification.content}</p>
|
||||||
<div class="mt-1 text-xs text-zinc-500">
|
<div class="mt-1 text-xs text-zinc-500">
|
||||||
<TimeFormatted date={notification.createdAt} prefix={false} caseType="sentence" />
|
<TimeFormatted date={notification.createdAt} prefix={false} caseType="sentence" />
|
||||||
</div>
|
</div>
|
||||||
@@ -326,6 +334,23 @@ const notifications = dbNotifications.map((notification) => ({
|
|||||||
</label>
|
</label>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
<div class="mt-4 flex items-center justify-between rounded-md p-2 transition-colors duration-200 hover:bg-zinc-800">
|
||||||
|
<span class="flex items-center text-zinc-300">
|
||||||
|
<Icon name="ri:award-line" class="mr-2 size-5 text-zinc-400" />
|
||||||
|
Notify me when my karma changes by at least
|
||||||
|
</span>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
name="karmaNotificationThreshold"
|
||||||
|
value={notificationPreferences.karmaNotificationThreshold}
|
||||||
|
min="1"
|
||||||
|
class="w-20 rounded border border-zinc-700 bg-zinc-800 px-2 py-1 text-zinc-200 focus:border-blue-600 focus:ring-1 focus:ring-blue-600 focus:outline-none"
|
||||||
|
/>
|
||||||
|
<span class="text-zinc-400">points</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-4 flex justify-end">
|
<div class="mt-4 flex justify-end">
|
||||||
<Button type="submit" label="Save" icon="ri:save-line" color="success" />
|
<Button type="submit" label="Save" icon="ri:save-line" color="success" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -149,9 +149,13 @@ const statusInfo = getServiceSuggestionStatusInfo(serviceSuggestion.status)
|
|||||||
|
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<div class="text-day-200 mb-2 text-sm">Notes for moderators:</div>
|
<div class="text-day-200 mb-2 text-sm">Notes for moderators:</div>
|
||||||
<div class="text-sm whitespace-pre-wrap">
|
{
|
||||||
{serviceSuggestion.notes ?? <span class="italic">Empty</span>}
|
serviceSuggestion.notes ? (
|
||||||
</div>
|
<div class="text-sm wrap-anywhere whitespace-pre-wrap" set:text={serviceSuggestion.notes} />
|
||||||
|
) : (
|
||||||
|
<span class="text-sm italic">Empty</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -240,53 +240,55 @@ const isCurrentUser = !!Astro.locals.user && user.id === Astro.locals.user.id
|
|||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<section class="border-night-400 bg-night-400/5 rounded-lg border p-6 shadow-sm backdrop-blur-xs">
|
<section class="border-night-400 bg-night-400/5 rounded-lg border p-6 shadow-sm backdrop-blur-xs">
|
||||||
<header class="flex items-center gap-4">
|
<header class="flex flex-wrap items-center justify-center gap-4">
|
||||||
{
|
<div class="flex grow flex-wrap items-center justify-center gap-4">
|
||||||
user.picture ? (
|
{
|
||||||
<MyPicture
|
user.picture ? (
|
||||||
src={user.picture}
|
<MyPicture
|
||||||
alt=""
|
src={user.picture}
|
||||||
class="ring-day-500/30 size-16 rounded-full ring-2"
|
alt=""
|
||||||
width={64}
|
class="ring-day-500/30 xs:size-14 size-12 rounded-full ring-2 sm:size-16"
|
||||||
height={64}
|
width={64}
|
||||||
/>
|
height={64}
|
||||||
) : (
|
/>
|
||||||
<div class="bg-day-500/10 ring-day-500/30 text-day-400 flex size-16 items-center justify-center rounded-full ring-2">
|
) : (
|
||||||
<Icon name="ri:user-3-line" class="size-8" />
|
<div class="bg-day-500/10 ring-day-500/30 text-day-400 flex size-16 items-center justify-center rounded-full ring-2">
|
||||||
|
<Icon name="ri:user-3-line" class="size-8" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
<div class="grow">
|
||||||
|
<h1 class="font-title text-lg font-bold tracking-wider text-white">
|
||||||
|
{user.name}
|
||||||
|
{isCurrentUser && <span class="text-day-500 font-normal">(You)</span>}
|
||||||
|
</h1>
|
||||||
|
{user.displayName && <p class="text-day-200">{user.displayName}</p>}
|
||||||
|
<div class="mt-1 flex gap-2">
|
||||||
|
{
|
||||||
|
user.admin && (
|
||||||
|
<span class="rounded-full border border-red-500/50 bg-red-500/20 px-2 py-0.5 text-xs text-red-400">
|
||||||
|
admin
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
user.verified && (
|
||||||
|
<span class="rounded-full border border-blue-500/50 bg-blue-500/20 px-2 py-0.5 text-xs text-blue-400">
|
||||||
|
verified
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
{
|
||||||
|
user.verifier && (
|
||||||
|
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
||||||
|
verifier
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
|
||||||
}
|
|
||||||
<div>
|
|
||||||
<h1 class="font-title text-lg font-bold tracking-wider text-white">
|
|
||||||
{user.name}
|
|
||||||
{isCurrentUser && <span class="text-day-500 font-normal">(You)</span>}
|
|
||||||
</h1>
|
|
||||||
{user.displayName && <p class="text-day-200">{user.displayName}</p>}
|
|
||||||
<div class="mt-1 flex gap-2">
|
|
||||||
{
|
|
||||||
user.admin && (
|
|
||||||
<span class="rounded-full border border-red-500/50 bg-red-500/20 px-2 py-0.5 text-xs text-red-400">
|
|
||||||
admin
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
{
|
|
||||||
user.verified && (
|
|
||||||
<span class="rounded-full border border-blue-500/50 bg-blue-500/20 px-2 py-0.5 text-xs text-blue-400">
|
|
||||||
verified
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
{
|
|
||||||
user.verifier && (
|
|
||||||
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
|
||||||
verifier
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<nav class="ml-auto flex items-center gap-2">
|
<nav class="flex items-center gap-2">
|
||||||
<AdminOnly>
|
<AdminOnly>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
as="a"
|
as="a"
|
||||||
@@ -521,7 +523,7 @@ const isCurrentUser = !!Astro.locals.user && user.id === Astro.locals.user.id
|
|||||||
<TimeFormatted date={note.createdAt} hourPrecision />
|
<TimeFormatted date={note.createdAt} hourPrecision />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-day-200 whitespace-pre-wrap">{note.content}</div>
|
<div class="text-day-200 wrap-anywhere whitespace-pre-wrap" set:text={note.content} />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -630,77 +632,38 @@ const isCurrentUser = !!Astro.locals.user && user.id === Astro.locals.user.id
|
|||||||
|
|
||||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<h3 class="font-title border-day-700/20 text-day-200 border-b pb-2 text-sm">Positive unlocks</h3>
|
<input type="checkbox" id="positive-unlocks-toggle" class="peer sr-only md:hidden" checked />
|
||||||
|
<label
|
||||||
|
for="positive-unlocks-toggle"
|
||||||
|
class="flex cursor-pointer items-center justify-between border-b border-green-500/20 pb-2 md:cursor-default peer-checked:[&_[data-expand-arrow]]:rotate-180"
|
||||||
|
>
|
||||||
|
<h3 class="font-title text-day-200 text-sm">Positive unlocks</h3>
|
||||||
|
<Icon name="ri:arrow-down-s-line" class="text-day-400 size-5 md:hidden" data-expand-arrow />
|
||||||
|
</label>
|
||||||
|
|
||||||
{
|
<div class="mt-3 hidden space-y-3 peer-checked:block md:block">
|
||||||
sortBy(
|
{
|
||||||
karmaUnlocks.filter((unlock) => unlock.karma >= 0),
|
sortBy(
|
||||||
'karma'
|
karmaUnlocks.filter((unlock) => unlock.karma >= 0),
|
||||||
).map((unlock) => (
|
'karma'
|
||||||
<div
|
).map((unlock) => (
|
||||||
class={cn(
|
|
||||||
'flex items-center justify-between rounded-md border p-3',
|
|
||||||
user.karmaUnlocks[unlock.id]
|
|
||||||
? 'border-green-500/30 bg-green-500/10'
|
|
||||||
: 'border-night-500 bg-night-800'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div class="flex items-center">
|
|
||||||
<span class={cn('mr-3', user.karmaUnlocks[unlock.id] ? 'text-day-400' : 'text-day-500')}>
|
|
||||||
<Icon name={unlock.icon} class="size-5" />
|
|
||||||
</span>
|
|
||||||
<div>
|
|
||||||
<p
|
|
||||||
class={cn('font-medium', user.karmaUnlocks[unlock.id] ? 'text-day-300' : 'text-day-400')}
|
|
||||||
>
|
|
||||||
{unlock.name}
|
|
||||||
</p>
|
|
||||||
<p class="text-day-500 text-sm">{unlock.karma.toLocaleString()} karma</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
{user.karmaUnlocks[unlock.id] ? (
|
|
||||||
<span class="bg-day-500/20 text-day-300 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
|
||||||
<Icon name="ri:check-line" class="mr-1 size-3" /> Unlocked
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<span class="bg-night-800 text-day-400 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
|
||||||
<Icon name="ri:lock-line" class="mr-1 size-3" /> Locked
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="space-y-3">
|
|
||||||
<h3 class="font-title border-b border-red-500/20 pb-2 text-sm text-red-400">Negative unlocks</h3>
|
|
||||||
|
|
||||||
{
|
|
||||||
sortBy(
|
|
||||||
karmaUnlocks.filter((unlock) => unlock.karma < 0),
|
|
||||||
'karma'
|
|
||||||
)
|
|
||||||
.reverse()
|
|
||||||
.map((unlock) => (
|
|
||||||
<div
|
<div
|
||||||
class={cn(
|
class={cn(
|
||||||
'flex items-center justify-between rounded-md border p-3',
|
'flex items-center justify-between rounded-md border p-3',
|
||||||
user.karmaUnlocks[unlock.id]
|
user.karmaUnlocks[unlock.id]
|
||||||
? 'border-red-500/30 bg-red-500/10'
|
? 'border-green-500/30 bg-green-500/10'
|
||||||
: 'border-night-500 bg-night-800'
|
: 'border-night-500 bg-night-800'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<span class={cn('mr-3', user.karmaUnlocks[unlock.id] ? 'text-red-400' : 'text-day-500')}>
|
<span class={cn('mr-3', user.karmaUnlocks[unlock.id] ? 'text-day-400' : 'text-day-500')}>
|
||||||
<Icon name={unlock.icon} class="size-5" />
|
<Icon name={unlock.icon} class="size-5" />
|
||||||
</span>
|
</span>
|
||||||
<div>
|
<div>
|
||||||
<p
|
<p
|
||||||
class={cn(
|
class={cn(
|
||||||
'font-medium',
|
'font-medium',
|
||||||
user.karmaUnlocks[unlock.id] ? 'text-red-400' : 'text-day-400'
|
user.karmaUnlocks[unlock.id] ? 'text-day-300' : 'text-day-400'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{unlock.name}
|
{unlock.name}
|
||||||
@@ -710,24 +673,85 @@ const isCurrentUser = !!Astro.locals.user && user.id === Astro.locals.user.id
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{user.karmaUnlocks[unlock.id] ? (
|
{user.karmaUnlocks[unlock.id] ? (
|
||||||
<span class="inline-flex items-center rounded-full bg-red-500/20 px-2 py-1 text-xs text-red-400">
|
<span class="bg-day-500/20 text-day-300 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
||||||
<Icon name="ri:alert-line" class="mr-1 size-3" /> Active
|
<Icon name="ri:check-line" class="mr-1 size-3" /> Unlocked
|
||||||
</span>
|
</span>
|
||||||
) : (
|
) : (
|
||||||
<span class="bg-night-800 text-day-400 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
<span class="bg-night-800 text-day-400 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
||||||
<Icon name="ri:shield-check-line" class="mr-1 size-3" /> Avoided
|
<Icon name="ri:lock-line" class="mr-1 size-3" /> Locked
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p class="text-day-400 border-night-500/30 bg-night-800/70 mt-4 rounded-md border p-3 text-xs">
|
<div class="space-y-3">
|
||||||
<Icon name="ri:information-line" class="inline-block size-4" />
|
<input type="checkbox" id="negative-unlocks-toggle" class="peer sr-only md:hidden" />
|
||||||
Negative karma leads to restrictions. <br class="hidden sm:block" />Keep interactions positive to
|
|
||||||
avoid penalties.
|
<label
|
||||||
</p>
|
for="negative-unlocks-toggle"
|
||||||
|
class="flex cursor-pointer items-center justify-between border-b border-red-500/20 pb-2 md:cursor-default peer-checked:[&_[data-expand-arrow]]:rotate-180"
|
||||||
|
>
|
||||||
|
<h3 class="font-title text-sm text-red-400">Negative unlocks</h3>
|
||||||
|
<Icon name="ri:arrow-down-s-line" class="text-day-400 size-5 md:hidden" data-expand-arrow />
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="mt-3 hidden space-y-3 peer-checked:block md:block">
|
||||||
|
{
|
||||||
|
sortBy(
|
||||||
|
karmaUnlocks.filter((unlock) => unlock.karma < 0),
|
||||||
|
'karma'
|
||||||
|
)
|
||||||
|
.reverse()
|
||||||
|
.map((unlock) => (
|
||||||
|
<div
|
||||||
|
class={cn(
|
||||||
|
'flex items-center justify-between rounded-md border p-3',
|
||||||
|
user.karmaUnlocks[unlock.id]
|
||||||
|
? 'border-red-500/30 bg-red-500/10'
|
||||||
|
: 'border-night-500 bg-night-800'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div class="flex items-center">
|
||||||
|
<span class={cn('mr-3', user.karmaUnlocks[unlock.id] ? 'text-red-400' : 'text-day-500')}>
|
||||||
|
<Icon name={unlock.icon} class="size-5" />
|
||||||
|
</span>
|
||||||
|
<div>
|
||||||
|
<p
|
||||||
|
class={cn(
|
||||||
|
'font-medium',
|
||||||
|
user.karmaUnlocks[unlock.id] ? 'text-red-400' : 'text-day-400'
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{unlock.name}
|
||||||
|
</p>
|
||||||
|
<p class="text-day-500 text-sm">{unlock.karma.toLocaleString()} karma</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{user.karmaUnlocks[unlock.id] ? (
|
||||||
|
<span class="inline-flex items-center rounded-full bg-red-500/20 px-2 py-1 text-xs text-red-400">
|
||||||
|
<Icon name="ri:alert-line" class="mr-1 size-3" /> Active
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<span class="bg-night-800 text-day-400 inline-flex items-center rounded-full px-2 py-1 text-xs">
|
||||||
|
<Icon name="ri:shield-check-line" class="mr-1 size-3" /> Avoided
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
<p class="text-day-400 border-night-500/30 bg-night-800/70 mt-4 rounded-md border p-3 text-xs">
|
||||||
|
<Icon name="ri:information-line" class="inline-block size-4" />
|
||||||
|
Negative karma leads to restrictions. <br class="hidden sm:block" />Keep interactions positive to
|
||||||
|
avoid penalties.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -105,6 +105,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@theme {
|
||||||
|
--animate-text-gradient: text-gradient 4s linear 0s infinite normal forwards running;
|
||||||
|
|
||||||
|
@keyframes text-gradient {
|
||||||
|
to {
|
||||||
|
background-position: -200%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@theme {
|
@theme {
|
||||||
--ease-in-sine: cubic-bezier(0.12, 0, 0.39, 0);
|
--ease-in-sine: cubic-bezier(0.12, 0, 0.39, 0);
|
||||||
--ease-out-sine: cubic-bezier(0.61, 1, 0.88, 1);
|
--ease-out-sine: cubic-bezier(0.61, 1, 0.88, 1);
|
||||||
|
|||||||