Compare commits
6 Commits
release-20
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4806a7fd4e | ||
|
|
85605de8aa | ||
|
|
7a22629c55 | ||
|
|
8deb9acb93 | ||
|
|
61a5448ff5 | ||
|
|
cdfdcfc122 |
@@ -29,7 +29,7 @@ npm run db-fill-clean
|
|||||||
|
|
||||||
Now open the [.env](web/.env) file and fill in the missing values.
|
Now open the [.env](web/.env) file and fill in the missing values.
|
||||||
|
|
||||||
> Default users are created with tokens: `admin`, `verifier`, `verified`, `normal` (configurable via env vars)
|
> Default users are created with tokens: `admin`, `moderator`, `verified`, `normal` (configurable via env vars)
|
||||||
|
|
||||||
### Running the project
|
### Running the project
|
||||||
|
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ All commands are run from the root of the project, from a terminal:
|
|||||||
|
|
||||||
> **Note**: `db-fill` and `db-fill-clean` support the `-- --services=n` flag, where n is the number of fake services to add. It defaults to 10. For example, `npm run db-fill -- --services=5` will add 5 fake services.
|
> **Note**: `db-fill` and `db-fill-clean` support the `-- --services=n` flag, where n is the number of fake services to add. It defaults to 10. For example, `npm run db-fill -- --services=5` will add 5 fake services.
|
||||||
|
|
||||||
> **Note**: `db-fill` and `db-fill-clean` create default users with tokens: `admin`, `verifier`, `verified`, `normal` (override with `DEV_*****_USER_SECRET_TOKEN` env vars)
|
> **Note**: `db-fill` and `db-fill-clean` create default users with tokens: `admin`, `moderator`, `verified`, `normal` (override with `DEV_*****_USER_SECRET_TOKEN` env vars)
|
||||||
|
|||||||
@@ -131,11 +131,11 @@ export default defineConfig({
|
|||||||
min: 1,
|
min: 1,
|
||||||
default: 'admin',
|
default: 'admin',
|
||||||
}),
|
}),
|
||||||
DEV_VERIFIER_USER_SECRET_TOKEN: envField.string({
|
DEV_MODERATOR_USER_SECRET_TOKEN: envField.string({
|
||||||
context: 'server',
|
context: 'server',
|
||||||
access: 'secret',
|
access: 'secret',
|
||||||
min: 1,
|
min: 1,
|
||||||
default: 'verifier',
|
default: 'moderator',
|
||||||
}),
|
}),
|
||||||
DEV_VERIFIED_USER_SECRET_TOKEN: envField.string({
|
DEV_VERIFIED_USER_SECRET_TOKEN: envField.string({
|
||||||
context: 'server',
|
context: 'server',
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the column `iconId` on the `ServiceContactMethod` table. All the data in the column will be lost.
|
||||||
|
- You are about to drop the column `info` on the `ServiceContactMethod` table. All the data in the column will be lost.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "ServiceContactMethod" DROP COLUMN "iconId",
|
||||||
|
DROP COLUMN "info",
|
||||||
|
ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
ALTER COLUMN "label" DROP NOT NULL;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
Manully edited to be a rename migration.
|
||||||
|
*/
|
||||||
|
-- AlterEnum
|
||||||
|
BEGIN;
|
||||||
|
ALTER TYPE "AccountStatusChange" RENAME VALUE 'VERIFIER_TRUE' TO 'MODERATOR_TRUE';
|
||||||
|
ALTER TYPE "AccountStatusChange" RENAME VALUE 'VERIFIER_FALSE' TO 'MODERATOR_FALSE';
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "User"
|
||||||
|
RENAME COLUMN "verifier" TO "moderator"
|
||||||
|
|
||||||
@@ -120,8 +120,8 @@ enum AccountStatusChange {
|
|||||||
ADMIN_FALSE
|
ADMIN_FALSE
|
||||||
VERIFIED_TRUE
|
VERIFIED_TRUE
|
||||||
VERIFIED_FALSE
|
VERIFIED_FALSE
|
||||||
VERIFIER_TRUE
|
MODERATOR_TRUE
|
||||||
VERIFIER_FALSE
|
MODERATOR_FALSE
|
||||||
SPAMMER_TRUE
|
SPAMMER_TRUE
|
||||||
SPAMMER_FALSE
|
SPAMMER_FALSE
|
||||||
}
|
}
|
||||||
@@ -397,12 +397,15 @@ model Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model ServiceContactMethod {
|
model ServiceContactMethod {
|
||||||
id Int @id @default(autoincrement())
|
id Int @id @default(autoincrement())
|
||||||
label String
|
/// Only include it if you want to override the formatted value.
|
||||||
|
label String?
|
||||||
/// Including the protocol (e.g. "mailto:", "tel:", "https://")
|
/// Including the protocol (e.g. "mailto:", "tel:", "https://")
|
||||||
value String
|
value String
|
||||||
iconId String
|
|
||||||
info String
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @default(now()) @updatedAt
|
||||||
|
|
||||||
services Service @relation("ServiceToContactMethod", fields: [serviceId], references: [id], onDelete: Cascade)
|
services Service @relation("ServiceToContactMethod", fields: [serviceId], references: [id], onDelete: Cascade)
|
||||||
serviceId Int
|
serviceId Int
|
||||||
}
|
}
|
||||||
@@ -461,7 +464,7 @@ model User {
|
|||||||
spammer Boolean @default(false)
|
spammer Boolean @default(false)
|
||||||
verified Boolean @default(false)
|
verified Boolean @default(false)
|
||||||
admin Boolean @default(false)
|
admin Boolean @default(false)
|
||||||
verifier Boolean @default(false)
|
moderator Boolean @default(false)
|
||||||
verifiedLink String?
|
verifiedLink String?
|
||||||
secretTokenHash String @unique
|
secretTokenHash String @unique
|
||||||
/// Computed via trigger. Do not update through prisma.
|
/// Computed via trigger. Do not update through prisma.
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ BEGIN
|
|||||||
VALUES (NEW.id, 'ACCOUNT_STATUS_CHANGE', status_change);
|
VALUES (NEW.id, 'ACCOUNT_STATUS_CHANGE', status_change);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- Check for verifier status change
|
-- Check for moderator status change
|
||||||
IF OLD.verifier IS DISTINCT FROM NEW.verifier THEN
|
IF OLD.moderator IS DISTINCT FROM NEW.moderator THEN
|
||||||
IF NEW.verifier = true THEN
|
IF NEW.moderator = true THEN
|
||||||
status_change := 'VERIFIER_TRUE';
|
status_change := 'MODERATOR_TRUE';
|
||||||
ELSE
|
ELSE
|
||||||
status_change := 'VERIFIER_FALSE';
|
status_change := 'MODERATOR_FALSE';
|
||||||
END IF;
|
END IF;
|
||||||
INSERT INTO "Notification" ("userId", "type", "aboutAccountStatusChange")
|
INSERT INTO "Notification" ("userId", "type", "aboutAccountStatusChange")
|
||||||
VALUES (NEW.id, 'ACCOUNT_STATUS_CHANGE', status_change);
|
VALUES (NEW.id, 'ACCOUNT_STATUS_CHANGE', status_change);
|
||||||
@@ -57,6 +57,6 @@ DROP TRIGGER IF EXISTS user_status_change_notifications_trigger ON "User";
|
|||||||
|
|
||||||
-- Create the trigger to fire after updates on specific status columns
|
-- Create the trigger to fire after updates on specific status columns
|
||||||
CREATE TRIGGER user_status_change_notifications_trigger
|
CREATE TRIGGER user_status_change_notifications_trigger
|
||||||
AFTER UPDATE OF admin, verified, verifier, spammer ON "User"
|
AFTER UPDATE OF admin, verified, moderator, spammer ON "User"
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
EXECUTE FUNCTION trigger_user_status_change_notifications();
|
EXECUTE FUNCTION trigger_user_status_change_notifications();
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ async function createAccount(preGeneratedToken?: string) {
|
|||||||
verifiedLink,
|
verifiedLink,
|
||||||
verified: !!verifiedLink,
|
verified: !!verifiedLink,
|
||||||
admin: faker.datatype.boolean({ probability: 0.1 }),
|
admin: faker.datatype.boolean({ probability: 0.1 }),
|
||||||
verifier: faker.datatype.boolean({ probability: 0.1 }),
|
moderator: faker.datatype.boolean({ probability: 0.1 }),
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
serviceAffiliations: true,
|
serviceAffiliations: true,
|
||||||
@@ -845,40 +845,45 @@ const generateFakeComment = (userId: number, serviceId: number, parentId?: numbe
|
|||||||
const generateFakeServiceContactMethod = (serviceId: number) => {
|
const generateFakeServiceContactMethod = (serviceId: number) => {
|
||||||
const types = [
|
const types = [
|
||||||
{
|
{
|
||||||
label: 'Email',
|
|
||||||
value: `mailto:${faker.internet.email()}`,
|
value: `mailto:${faker.internet.email()}`,
|
||||||
iconId: 'ri:mail-line',
|
|
||||||
info: faker.lorem.sentence(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Phone',
|
|
||||||
value: `tel:${faker.phone.number({ style: 'international' })}`,
|
value: `tel:${faker.phone.number({ style: 'international' })}`,
|
||||||
iconId: 'ri:phone-line',
|
|
||||||
info: faker.lorem.sentence(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'WhatsApp',
|
|
||||||
value: `https://wa.me/${faker.phone.number({ style: 'international' })}`,
|
value: `https://wa.me/${faker.phone.number({ style: 'international' })}`,
|
||||||
iconId: 'ri:whatsapp-line',
|
|
||||||
info: faker.lorem.sentence(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Telegram',
|
|
||||||
value: `https://t.me/${faker.internet.username()}`,
|
value: `https://t.me/${faker.internet.username()}`,
|
||||||
iconId: 'ri:telegram-line',
|
|
||||||
info: faker.lorem.sentence(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Website',
|
value: `https://x.com/${faker.internet.username()}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: `https://matrix.to/#/@${faker.internet.username()}:${faker.internet.domainName()}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: `https://instagram.com/${faker.internet.username()}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: `https://linkedin.com/in/${faker.helpers.slugify(faker.person.fullName())}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: faker.lorem.word({ length: 2 }),
|
||||||
|
value: `https://bitcointalk.org/index.php?topic=${faker.number.int({ min: 1, max: 1000000 }).toString()}.0`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: `https://bitcointalk.org/index.php?topic=${faker.number.int({ min: 1, max: 1000000 }).toString()}.0`,
|
||||||
|
},
|
||||||
|
{
|
||||||
value: faker.internet.url(),
|
value: faker.internet.url(),
|
||||||
iconId: 'ri:global-line',
|
|
||||||
info: faker.lorem.sentence(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'LinkedIn',
|
label: faker.lorem.word({ length: 2 }),
|
||||||
value: `https://www.linkedin.com/company/${faker.helpers.slugify(faker.company.name())}`,
|
value: faker.internet.url(),
|
||||||
iconId: 'ri:linkedin-box-line',
|
},
|
||||||
info: faker.lorem.sentence(),
|
{
|
||||||
|
value: `https://linkedin.com/company/${faker.helpers.slugify(faker.company.name())}`,
|
||||||
},
|
},
|
||||||
] as const satisfies Partial<Prisma.ServiceContactMethodCreateInput>[]
|
] as const satisfies Partial<Prisma.ServiceContactMethodCreateInput>[]
|
||||||
|
|
||||||
@@ -894,19 +899,19 @@ const specialUsersData = {
|
|||||||
envToken: 'DEV_ADMIN_USER_SECRET_TOKEN',
|
envToken: 'DEV_ADMIN_USER_SECRET_TOKEN',
|
||||||
defaultToken: 'admin',
|
defaultToken: 'admin',
|
||||||
admin: true,
|
admin: true,
|
||||||
verifier: true,
|
moderator: true,
|
||||||
verified: true,
|
verified: true,
|
||||||
verifiedLink: 'https://kycnot.me',
|
verifiedLink: 'https://kycnot.me',
|
||||||
totalKarma: 1001,
|
totalKarma: 1001,
|
||||||
link: 'https://kycnot.me',
|
link: 'https://kycnot.me',
|
||||||
picture: 'https://comments.kycnot.me/api/users/549f290e-0542-4c18-b437-5b64b35758f0/avatar?size=L',
|
picture: 'https://comments.kycnot.me/api/users/549f290e-0542-4c18-b437-5b64b35758f0/avatar?size=L',
|
||||||
},
|
},
|
||||||
verifier: {
|
moderator: {
|
||||||
name: 'verifier_dev',
|
name: 'moderator_dev',
|
||||||
envToken: 'DEV_VERIFIER_USER_SECRET_TOKEN',
|
envToken: 'DEV_MODERATOR_USER_SECRET_TOKEN',
|
||||||
defaultToken: 'verifier',
|
defaultToken: 'moderator',
|
||||||
admin: false,
|
admin: false,
|
||||||
verifier: true,
|
moderator: true,
|
||||||
verified: true,
|
verified: true,
|
||||||
verifiedLink: 'https://kycnot.me',
|
verifiedLink: 'https://kycnot.me',
|
||||||
totalKarma: 1001,
|
totalKarma: 1001,
|
||||||
@@ -918,7 +923,7 @@ const specialUsersData = {
|
|||||||
envToken: 'DEV_VERIFIED_USER_SECRET_TOKEN',
|
envToken: 'DEV_VERIFIED_USER_SECRET_TOKEN',
|
||||||
defaultToken: 'verified',
|
defaultToken: 'verified',
|
||||||
admin: false,
|
admin: false,
|
||||||
verifier: false,
|
moderator: false,
|
||||||
verified: true,
|
verified: true,
|
||||||
verifiedLink: 'https://kycnot.me',
|
verifiedLink: 'https://kycnot.me',
|
||||||
totalKarma: 1001,
|
totalKarma: 1001,
|
||||||
@@ -928,7 +933,7 @@ const specialUsersData = {
|
|||||||
envToken: 'DEV_NORMAL_USER_SECRET_TOKEN',
|
envToken: 'DEV_NORMAL_USER_SECRET_TOKEN',
|
||||||
defaultToken: 'normal',
|
defaultToken: 'normal',
|
||||||
admin: false,
|
admin: false,
|
||||||
verifier: false,
|
moderator: false,
|
||||||
verified: false,
|
verified: false,
|
||||||
},
|
},
|
||||||
spam: {
|
spam: {
|
||||||
@@ -936,7 +941,7 @@ const specialUsersData = {
|
|||||||
envToken: 'DEV_SPAM_USER_SECRET_TOKEN',
|
envToken: 'DEV_SPAM_USER_SECRET_TOKEN',
|
||||||
defaultToken: 'spam',
|
defaultToken: 'spam',
|
||||||
admin: false,
|
admin: false,
|
||||||
verifier: false,
|
moderator: false,
|
||||||
verified: false,
|
verified: false,
|
||||||
totalKarma: -100,
|
totalKarma: -100,
|
||||||
spammer: true,
|
spammer: true,
|
||||||
@@ -1301,7 +1306,7 @@ async function runFaker() {
|
|||||||
tx.internalUserNote.create({
|
tx.internalUserNote.create({
|
||||||
data: generateFakeInternalNote(
|
data: generateFakeInternalNote(
|
||||||
user.id,
|
user.id,
|
||||||
faker.helpers.arrayElement([specialUsers.admin.id, specialUsers.verifier.id])
|
faker.helpers.arrayElement([specialUsers.admin.id, specialUsers.moderator.id])
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@@ -1318,7 +1323,7 @@ async function runFaker() {
|
|||||||
tx.internalUserNote.create({
|
tx.internalUserNote.create({
|
||||||
data: generateFakeInternalNote(
|
data: generateFakeInternalNote(
|
||||||
user.id,
|
user.id,
|
||||||
faker.helpers.arrayElement([specialUsers.admin.id, specialUsers.verifier.id])
|
faker.helpers.arrayElement([specialUsers.admin.id, specialUsers.moderator.id])
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
} from '../../lib/zodUtils'
|
} from '../../lib/zodUtils'
|
||||||
|
|
||||||
const serviceSchemaBase = z.object({
|
const serviceSchemaBase = z.object({
|
||||||
id: z.number(),
|
id: z.number().int().positive(),
|
||||||
slug: z
|
slug: z
|
||||||
.string()
|
.string()
|
||||||
.regex(/^[a-z0-9-]+$/, 'Allowed characters: lowercase letters, numbers, and hyphens')
|
.regex(/^[a-z0-9-]+$/, 'Allowed characters: lowercase letters, numbers, and hyphens')
|
||||||
@@ -56,15 +56,6 @@ const addSlugIfMissing = <
|
|||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
|
||||||
const contactMethodSchema = z.object({
|
|
||||||
id: z.number().optional(),
|
|
||||||
label: z.string().min(1).max(50),
|
|
||||||
value: z.string().min(1).max(200),
|
|
||||||
iconId: z.string().min(1).max(50),
|
|
||||||
info: z.string().max(200).optional().default(''),
|
|
||||||
serviceId: z.number(),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const adminServiceActions = {
|
export const adminServiceActions = {
|
||||||
create: defineProtectedAction({
|
create: defineProtectedAction({
|
||||||
accept: 'form',
|
accept: 'form',
|
||||||
@@ -195,10 +186,18 @@ export const adminServiceActions = {
|
|||||||
createContactMethod: defineProtectedAction({
|
createContactMethod: defineProtectedAction({
|
||||||
accept: 'form',
|
accept: 'form',
|
||||||
permissions: 'admin',
|
permissions: 'admin',
|
||||||
input: contactMethodSchema.omit({ id: true }),
|
input: z.object({
|
||||||
|
label: z.string().min(1).max(50).nullable(),
|
||||||
|
value: z.string().url(),
|
||||||
|
serviceId: z.number().int().positive(),
|
||||||
|
}),
|
||||||
handler: async (input) => {
|
handler: async (input) => {
|
||||||
const contactMethod = await prisma.serviceContactMethod.create({
|
const contactMethod = await prisma.serviceContactMethod.create({
|
||||||
data: input,
|
data: {
|
||||||
|
label: input.label,
|
||||||
|
value: input.value,
|
||||||
|
serviceId: input.serviceId,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
return { contactMethod }
|
return { contactMethod }
|
||||||
},
|
},
|
||||||
@@ -207,12 +206,20 @@ export const adminServiceActions = {
|
|||||||
updateContactMethod: defineProtectedAction({
|
updateContactMethod: defineProtectedAction({
|
||||||
accept: 'form',
|
accept: 'form',
|
||||||
permissions: 'admin',
|
permissions: 'admin',
|
||||||
input: contactMethodSchema,
|
input: z.object({
|
||||||
|
id: z.number().int().positive(),
|
||||||
|
label: z.string().min(1).max(50).nullable(),
|
||||||
|
value: z.string().url(),
|
||||||
|
serviceId: z.number().int().positive(),
|
||||||
|
}),
|
||||||
handler: async (input) => {
|
handler: async (input) => {
|
||||||
const { id, ...data } = input
|
|
||||||
const contactMethod = await prisma.serviceContactMethod.update({
|
const contactMethod = await prisma.serviceContactMethod.update({
|
||||||
where: { id },
|
where: { id: input.id },
|
||||||
data,
|
data: {
|
||||||
|
label: input.label,
|
||||||
|
value: input.value,
|
||||||
|
serviceId: input.serviceId,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
return { contactMethod }
|
return { contactMethod }
|
||||||
},
|
},
|
||||||
@@ -222,7 +229,7 @@ export const adminServiceActions = {
|
|||||||
accept: 'form',
|
accept: 'form',
|
||||||
permissions: 'admin',
|
permissions: 'admin',
|
||||||
input: z.object({
|
input: z.object({
|
||||||
id: z.number(),
|
id: z.number().int().positive(),
|
||||||
}),
|
}),
|
||||||
handler: async (input) => {
|
handler: async (input) => {
|
||||||
await prisma.serviceContactMethod.delete({
|
await prisma.serviceContactMethod.delete({
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const selectUserReturnFields = {
|
|||||||
picture: true,
|
picture: true,
|
||||||
admin: true,
|
admin: true,
|
||||||
verified: true,
|
verified: true,
|
||||||
verifier: true,
|
moderator: true,
|
||||||
verifiedLink: true,
|
verifiedLink: true,
|
||||||
secretTokenHash: true,
|
secretTokenHash: true,
|
||||||
totalKarma: true,
|
totalKarma: true,
|
||||||
@@ -55,7 +55,7 @@ export const adminUserActions = {
|
|||||||
.default(null) // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
.default(null) // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
.transform((val) => val || null),
|
.transform((val) => val || null),
|
||||||
pictureFile: z.instanceof(File).optional(),
|
pictureFile: z.instanceof(File).optional(),
|
||||||
type: z.array(z.enum(['admin', 'verifier', 'spammer'])),
|
type: z.array(z.enum(['admin', 'moderator', 'spammer'])),
|
||||||
verifiedLink: z
|
verifiedLink: z
|
||||||
.string()
|
.string()
|
||||||
.url('Invalid URL')
|
.url('Invalid URL')
|
||||||
@@ -101,7 +101,7 @@ export const adminUserActions = {
|
|||||||
verified: !!valuesToUpdate.verifiedLink,
|
verified: !!valuesToUpdate.verifiedLink,
|
||||||
picture: pictureUrl,
|
picture: pictureUrl,
|
||||||
admin: type.includes('admin'),
|
admin: type.includes('admin'),
|
||||||
verifier: type.includes('verifier'),
|
moderator: type.includes('moderator'),
|
||||||
spammer: type.includes('spammer'),
|
spammer: type.includes('spammer'),
|
||||||
},
|
},
|
||||||
select: selectUserReturnFields,
|
select: selectUserReturnFields,
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ import { timeTrapSecretKey } from '../lib/timeTrapSecret'
|
|||||||
|
|
||||||
import type { CommentStatus, Prisma } from '@prisma/client'
|
import type { CommentStatus, Prisma } from '@prisma/client'
|
||||||
|
|
||||||
const COMMENT_RATE_LIMIT_WINDOW_MINUTES = 5
|
const COMMENT_RATE_LIMIT_WINDOW_MINUTES = 2
|
||||||
const MAX_COMMENTS_PER_WINDOW = 1
|
const MAX_COMMENTS_PER_WINDOW = 1
|
||||||
const MAX_COMMENTS_PER_WINDOW_VERIFIED_USER = 5
|
const MAX_COMMENTS_PER_WINDOW_VERIFIED_USER = 10
|
||||||
|
|
||||||
export const commentActions = {
|
export const commentActions = {
|
||||||
vote: defineProtectedAction({
|
vote: defineProtectedAction({
|
||||||
@@ -331,7 +331,7 @@ export const commentActions = {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
moderate: defineProtectedAction({
|
moderate: defineProtectedAction({
|
||||||
permissions: ['admin', 'verifier'],
|
permissions: ['admin', 'moderator'],
|
||||||
input: z.object({
|
input: z.object({
|
||||||
commentId: z.number(),
|
commentId: z.number(),
|
||||||
userId: z.number(),
|
userId: z.number(),
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ const isHighlighted = comment.id === highlightedCommentId
|
|||||||
const userVote = user ? comment.votes.find((v) => v.userId === user.id) : null
|
const userVote = user ? comment.votes.find((v) => v.userId === user.id) : null
|
||||||
|
|
||||||
const isAuthor = user?.id === comment.author.id
|
const isAuthor = user?.id === comment.author.id
|
||||||
const isAdminOrVerifier = !!user && (user.admin || user.verifier)
|
const isAdminOrModerator = !!user && (user.admin || user.moderator)
|
||||||
const isAuthorOrPrivileged = isAuthor || isAdminOrVerifier
|
const isAuthorOrPrivileged = isAuthor || isAdminOrModerator
|
||||||
|
|
||||||
// Check if user is new (less than 1 week old)
|
// Check if user is new (less than 1 week old)
|
||||||
const isNewUser =
|
const isNewUser =
|
||||||
@@ -75,7 +75,7 @@ const isRatingActive =
|
|||||||
!comment.suspicious &&
|
!comment.suspicious &&
|
||||||
(comment.status === 'APPROVED' || comment.status === 'VERIFIED')
|
(comment.status === 'APPROVED' || comment.status === 'VERIFIED')
|
||||||
|
|
||||||
// Skip rendering if comment is not approved/verified and user is not the author or admin/verifier
|
// Skip rendering if comment is not approved/verified and user is not the author or admin/moderator
|
||||||
const shouldShow =
|
const shouldShow =
|
||||||
comment.status === 'APPROVED' ||
|
comment.status === 'APPROVED' ||
|
||||||
comment.status === 'VERIFIED' ||
|
comment.status === 'VERIFIED' ||
|
||||||
@@ -164,10 +164,10 @@ const commentUrl = makeCommentUrl({ serviceSlug, commentId: comment.id, origin:
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{
|
{
|
||||||
(comment.author.verified || comment.author.admin || comment.author.verifier) && (
|
(comment.author.verified || comment.author.admin || comment.author.moderator) && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
text={`${
|
text={`${
|
||||||
comment.author.admin || comment.author.verifier
|
comment.author.admin || comment.author.moderator
|
||||||
? `KYCnot.me ${comment.author.admin ? 'Admin' : 'Moderator'}${comment.author.verifiedLink ? '. ' : ''}`
|
? `KYCnot.me ${comment.author.admin ? 'Admin' : 'Moderator'}${comment.author.verifiedLink ? '. ' : ''}`
|
||||||
: ''
|
: ''
|
||||||
}${comment.author.verifiedLink ? `Related to ${comment.author.verifiedLink}` : ''}`}
|
}${comment.author.verifiedLink ? `Related to ${comment.author.verifiedLink}` : ''}`}
|
||||||
@@ -186,7 +186,7 @@ const commentUrl = makeCommentUrl({ serviceSlug, commentId: comment.id, origin:
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
comment.author.verifier && !comment.author.admin && (
|
comment.author.moderator && !comment.author.admin && (
|
||||||
<BadgeSmall
|
<BadgeSmall
|
||||||
icon="ri:graduation-cap-fill"
|
icon="ri:graduation-cap-fill"
|
||||||
color="teal"
|
color="teal"
|
||||||
@@ -198,14 +198,14 @@ const commentUrl = makeCommentUrl({ serviceSlug, commentId: comment.id, origin:
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
isNewUser && !comment.author.admin && !comment.author.verifier && (
|
isNewUser && !comment.author.admin && !comment.author.moderator && (
|
||||||
<Tooltip text={`Joined ${formatDateShort(comment.author.createdAt, { hourPrecision: true })}`}>
|
<Tooltip text={`Joined ${formatDateShort(comment.author.createdAt, { hourPrecision: true })}`}>
|
||||||
<BadgeSmall icon="ri:user-add-fill" color="purple" text="New User" variant="faded" inlineIcon />
|
<BadgeSmall icon="ri:user-add-fill" color="purple" text="New User" variant="faded" inlineIcon />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
authorUnlocks.highKarmaBadge && !comment.author.admin && !comment.author.verifier && (
|
authorUnlocks.highKarmaBadge && !comment.author.admin && !comment.author.moderator && (
|
||||||
<BadgeSmall
|
<BadgeSmall
|
||||||
icon={karmaUnlocksById.highKarmaBadge.icon}
|
icon={karmaUnlocksById.highKarmaBadge.icon}
|
||||||
color="lime"
|
color="lime"
|
||||||
@@ -380,7 +380,7 @@ const commentUrl = makeCommentUrl({ serviceSlug, commentId: comment.id, origin:
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
user && (user.admin || user.verifier) && comment.internalNote && (
|
user && (user.admin || user.moderator) && comment.internalNote && (
|
||||||
<div class="mt-2 peer-checked/collapse:hidden">
|
<div class="mt-2 peer-checked/collapse:hidden">
|
||||||
<div class="border-l-2 border-red-600 bg-red-900/20 py-0.5 pl-2 text-xs">
|
<div class="border-l-2 border-red-600 bg-red-900/20 py-0.5 pl-2 text-xs">
|
||||||
<span class="font-medium text-red-400">Internal note:</span>
|
<span class="font-medium text-red-400">Internal note:</span>
|
||||||
@@ -391,7 +391,7 @@ const commentUrl = makeCommentUrl({ serviceSlug, commentId: comment.id, origin:
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
user && (user.admin || user.verifier) && comment.privateContext && (
|
user && (user.admin || user.moderator) && comment.privateContext && (
|
||||||
<div class="mt-2 peer-checked/collapse:hidden">
|
<div class="mt-2 peer-checked/collapse:hidden">
|
||||||
<div class="border-l-2 border-blue-600 bg-blue-900/20 py-0.5 pl-2 text-xs">
|
<div class="border-l-2 border-blue-600 bg-blue-900/20 py-0.5 pl-2 text-xs">
|
||||||
<span class="font-medium text-blue-400">Private context:</span>
|
<span class="font-medium text-blue-400">Private context:</span>
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ const { comment, class: className, ...divProps } = Astro.props
|
|||||||
|
|
||||||
const user = Astro.locals.user
|
const user = Astro.locals.user
|
||||||
|
|
||||||
// Only render for admin/verifier users
|
// Only render for admin/moderator users
|
||||||
if (!user || !user.admin || !user.verifier) return null
|
if (!user || !user.admin || !user.moderator) return null
|
||||||
---
|
---
|
||||||
|
|
||||||
<div {...divProps} class={cn('text-xs', className)}>
|
<div {...divProps} class={cn('text-xs', className)}>
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ function makeReplySchema(comment: CommentWithRepliesPopulated): Comment {
|
|||||||
Most Upvotes
|
Most Upvotes
|
||||||
</a>
|
</a>
|
||||||
{
|
{
|
||||||
user && (user.admin || user.verifier) && (
|
user && (user.admin || user.moderator) && (
|
||||||
<a
|
<a
|
||||||
href={getSortUrl('status')}
|
href={getSortUrl('status')}
|
||||||
class={cn([
|
class={cn([
|
||||||
|
|||||||
@@ -43,14 +43,14 @@ export const {
|
|||||||
notificationTitle: 'Your account is no longer verified',
|
notificationTitle: 'Your account is no longer verified',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'VERIFIER_TRUE',
|
value: 'MODERATOR_TRUE',
|
||||||
label: 'Verifier role granted',
|
label: 'Moderator role granted',
|
||||||
notificationTitle: 'Verifier role granted',
|
notificationTitle: 'Moderator role granted',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'VERIFIER_FALSE',
|
value: 'MODERATOR_FALSE',
|
||||||
label: 'Verifier role revoked',
|
label: 'Moderator role revoked',
|
||||||
notificationTitle: 'Verifier role revoked',
|
notificationTitle: 'Moderator role revoked',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'SPAMMER_TRUE',
|
value: 'SPAMMER_TRUE',
|
||||||
|
|||||||
123
web/src/constants/contactMethods.ts
Normal file
123
web/src/constants/contactMethods.ts
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
import { parsePhoneNumberWithError } from 'libphonenumber-js'
|
||||||
|
|
||||||
|
import { makeHelpersForOptions } from '../lib/makeHelpersForOptions'
|
||||||
|
import { transformCase } from '../lib/strings'
|
||||||
|
|
||||||
|
type ContactMethodInfo<T extends string | null | undefined = string> = {
|
||||||
|
type: T
|
||||||
|
label: string
|
||||||
|
/** Notice that the first capture group is then used to format the value */
|
||||||
|
matcher: RegExp
|
||||||
|
formatter: (value: string) => string | null
|
||||||
|
icon: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const {
|
||||||
|
dataArray: contactMethods,
|
||||||
|
dataObject: contactMethodsById,
|
||||||
|
/** Use {@link formatContactMethod} instead */
|
||||||
|
getFn: getContactMethodInfo,
|
||||||
|
} = makeHelpersForOptions(
|
||||||
|
'type',
|
||||||
|
(type): ContactMethodInfo<typeof type> => ({
|
||||||
|
type,
|
||||||
|
label: type ? transformCase(type, 'title') : String(type),
|
||||||
|
icon: 'ri:shield-fill',
|
||||||
|
matcher: /(.*)/,
|
||||||
|
formatter: (value) => value,
|
||||||
|
}),
|
||||||
|
[
|
||||||
|
{
|
||||||
|
type: 'email',
|
||||||
|
label: 'Email',
|
||||||
|
matcher: /mailto:(.+)/,
|
||||||
|
formatter: (value) => value,
|
||||||
|
icon: 'ri:mail-line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'telephone',
|
||||||
|
label: 'Telephone',
|
||||||
|
matcher: /tel:(.+)/,
|
||||||
|
formatter: (value) => {
|
||||||
|
return parsePhoneNumberWithError(value).formatInternational()
|
||||||
|
},
|
||||||
|
icon: 'ri:phone-line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'whatsapp',
|
||||||
|
label: 'WhatsApp',
|
||||||
|
matcher: /https?:\/\/(?:www\.)?wa\.me\/(.+)/,
|
||||||
|
formatter: (value) => {
|
||||||
|
return parsePhoneNumberWithError(value).formatInternational()
|
||||||
|
},
|
||||||
|
icon: 'ri:whatsapp-line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'telegram',
|
||||||
|
label: 'Telegram',
|
||||||
|
matcher: /https?:\/\/(?:www\.)?t\.me\/(.+)/,
|
||||||
|
formatter: (value) => `t.me/${value}`,
|
||||||
|
icon: 'ri:telegram-line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'linkedin',
|
||||||
|
label: 'LinkedIn',
|
||||||
|
matcher: /https?:\/\/(?:www\.)?linkedin\.com\/(?:in|company)\/(.+)/,
|
||||||
|
formatter: (value) => `in/${value}`,
|
||||||
|
icon: 'ri:linkedin-box-line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'x',
|
||||||
|
label: 'X',
|
||||||
|
matcher: /https?:\/\/(?:www\.)?x\.com\/(.+)/,
|
||||||
|
formatter: (value) => `@${value}`,
|
||||||
|
icon: 'ri:twitter-x-line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'instagram',
|
||||||
|
label: 'Instagram',
|
||||||
|
matcher: /https?:\/\/(?:www\.)?instagram\.com\/(.+)/,
|
||||||
|
formatter: (value) => `@${value}`,
|
||||||
|
icon: 'ri:instagram-line',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'matrix',
|
||||||
|
label: 'Matrix',
|
||||||
|
matcher: /https?:\/\/(?:www\.)?matrix\.to\/#\/(.+)/,
|
||||||
|
formatter: (value) => value,
|
||||||
|
icon: 'ri:hashtag',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'bitcointalk',
|
||||||
|
label: 'BitcoinTalk',
|
||||||
|
matcher: /https?:\/\/(?:www\.)?bitcointalk\.org/,
|
||||||
|
formatter: () => 'BitcoinTalk',
|
||||||
|
icon: 'ri:btc-line',
|
||||||
|
},
|
||||||
|
// Website must go last because it's a catch-all
|
||||||
|
{
|
||||||
|
type: 'website',
|
||||||
|
label: 'Website',
|
||||||
|
matcher: /https?:\/\/(?:www\.)?((?:[a-zA-Z0-9-]+\.)+[a-zA-Z]+)/,
|
||||||
|
formatter: (value) => value,
|
||||||
|
icon: 'ri:global-line',
|
||||||
|
},
|
||||||
|
] as const satisfies ContactMethodInfo[]
|
||||||
|
)
|
||||||
|
|
||||||
|
export function formatContactMethod(url: string) {
|
||||||
|
for (const contactMethod of contactMethods) {
|
||||||
|
const captureGroup = url.match(contactMethod.matcher)?.[1]
|
||||||
|
if (!captureGroup) continue
|
||||||
|
|
||||||
|
const formattedValue = contactMethod.formatter(captureGroup)
|
||||||
|
if (!formattedValue) continue
|
||||||
|
|
||||||
|
return {
|
||||||
|
...contactMethod,
|
||||||
|
formattedValue,
|
||||||
|
} as const
|
||||||
|
}
|
||||||
|
|
||||||
|
return { ...getContactMethodInfo('unknown'), formattedValue: url } as const
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ const commentReplyQuery = {
|
|||||||
name: true,
|
name: true,
|
||||||
verified: true,
|
verified: true,
|
||||||
admin: true,
|
admin: true,
|
||||||
verifier: true,
|
moderator: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
displayName: true,
|
displayName: true,
|
||||||
picture: true,
|
picture: true,
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
import { parsePhoneNumberWithError } from 'libphonenumber-js'
|
|
||||||
|
|
||||||
type Formatter = {
|
|
||||||
id: string
|
|
||||||
matcher: RegExp
|
|
||||||
formatter: (value: string) => string | null
|
|
||||||
}
|
|
||||||
const formatters = [
|
|
||||||
{
|
|
||||||
id: 'email',
|
|
||||||
matcher: /mailto:(.*)/,
|
|
||||||
formatter: (value) => value,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'telephone',
|
|
||||||
matcher: /tel:(.*)/,
|
|
||||||
formatter: (value) => {
|
|
||||||
return parsePhoneNumberWithError(value).formatInternational()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'whatsapp',
|
|
||||||
matcher: /https?:\/\/wa\.me\/(.*)\/?/,
|
|
||||||
formatter: (value) => {
|
|
||||||
return parsePhoneNumberWithError(value).formatInternational()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'telegram',
|
|
||||||
matcher: /https?:\/\/t\.me\/(.*)\/?/,
|
|
||||||
formatter: (value) => `t.me/${value}`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'linkedin',
|
|
||||||
matcher: /https?:\/\/(?:www\.)?linkedin\.com\/(?:in|company)\/(.*)\/?/,
|
|
||||||
formatter: (value) => `in/${value}`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'website',
|
|
||||||
matcher: /https?:\/\/(?:www\.)?((?:[a-zA-Z0-9-]+\.)+[a-zA-Z]+)/,
|
|
||||||
formatter: (value) => value,
|
|
||||||
},
|
|
||||||
] as const satisfies Formatter[]
|
|
||||||
|
|
||||||
export function formatContactMethod(url: string) {
|
|
||||||
for (const formatter of formatters) {
|
|
||||||
const captureGroup = url.match(formatter.matcher)?.[1]
|
|
||||||
if (!captureGroup) continue
|
|
||||||
|
|
||||||
const formattedValue = formatter.formatter(captureGroup)
|
|
||||||
if (!formattedValue) continue
|
|
||||||
|
|
||||||
return {
|
|
||||||
type: formatter.id,
|
|
||||||
formattedValue,
|
|
||||||
} as const
|
|
||||||
}
|
|
||||||
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
import type { MaybePromise } from 'astro/actions/runtime/utils.js'
|
import type { MaybePromise } from 'astro/actions/runtime/utils.js'
|
||||||
import type { z } from 'astro/zod'
|
import type { z } from 'astro/zod'
|
||||||
|
|
||||||
type SpecialUserPermission = 'admin' | 'verified' | 'verifier'
|
type SpecialUserPermission = 'admin' | 'verified' | 'moderator'
|
||||||
type Permission = SpecialUserPermission | 'guest' | 'not-spammer' | 'user'
|
type Permission = SpecialUserPermission | 'guest' | 'not-spammer' | 'user'
|
||||||
|
|
||||||
type ActionAPIContextWithUser = ActionAPIContext & {
|
type ActionAPIContextWithUser = ActionAPIContext & {
|
||||||
@@ -87,8 +87,8 @@ export function defineProtectedAction<
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(permissions === 'verifier' || (Array.isArray(permissions) && permissions.includes('verifier'))) &&
|
(permissions === 'moderator' || (Array.isArray(permissions) && permissions.includes('moderator'))) &&
|
||||||
!context.locals.user.verifier
|
!context.locals.user.moderator
|
||||||
) {
|
) {
|
||||||
if (context.locals.user.spammer) {
|
if (context.locals.user.spammer) {
|
||||||
throw new ActionError({
|
throw new ActionError({
|
||||||
@@ -98,7 +98,7 @@ export function defineProtectedAction<
|
|||||||
}
|
}
|
||||||
throw new ActionError({
|
throw new ActionError({
|
||||||
code: 'FORBIDDEN',
|
code: 'FORBIDDEN',
|
||||||
message: 'Verifier privileges required.',
|
message: 'Moderator privileges required.',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ const USER_SECRET_TOKEN_DEV_USERS_REGEX = (() => {
|
|||||||
defaultToken: 'admin',
|
defaultToken: 'admin',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
envToken: 'DEV_VERIFIER_USER_SECRET_TOKEN',
|
envToken: 'DEV_MODERATOR_USER_SECRET_TOKEN',
|
||||||
defaultToken: 'verifier',
|
defaultToken: 'moderator',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
envToken: 'DEV_VERIFIED_USER_SECRET_TOKEN',
|
envToken: 'DEV_VERIFIED_USER_SECRET_TOKEN',
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const user = await Astro.locals.banners.try('user', async () => {
|
|||||||
spammer: true,
|
spammer: true,
|
||||||
verified: true,
|
verified: true,
|
||||||
admin: true,
|
admin: true,
|
||||||
verifier: true,
|
moderator: true,
|
||||||
verifiedLink: true,
|
verifiedLink: true,
|
||||||
totalKarma: true,
|
totalKarma: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
@@ -206,7 +206,7 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
</h1>
|
</h1>
|
||||||
{user.displayName && <p class="text-day-200 font-title">{user.name}</p>}
|
{user.displayName && <p class="text-day-200 font-title">{user.name}</p>}
|
||||||
{
|
{
|
||||||
(user.admin || user.verified || user.verifier) && (
|
(user.admin || user.verified || user.moderator) && (
|
||||||
<div class="mt-1 flex gap-2">
|
<div class="mt-1 flex gap-2">
|
||||||
{user.admin && (
|
{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">
|
<span class="rounded-full border border-red-500/50 bg-red-500/20 px-2 py-0.5 text-xs text-red-400">
|
||||||
@@ -218,9 +218,9 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
verified
|
verified
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{user.verifier && (
|
{user.moderator && (
|
||||||
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
||||||
verifier
|
moderator
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -356,14 +356,14 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
user.verifier && (
|
user.moderator && (
|
||||||
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
||||||
Verifier
|
Moderator
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
!user.admin && !user.verified && !user.verifier && (
|
!user.admin && !user.verified && !user.moderator && (
|
||||||
<span class="border-day-700/50 bg-day-700/20 text-day-400 rounded-full border px-2 py-0.5 text-xs">
|
<span class="border-day-700/50 bg-day-700/20 text-day-400 rounded-full border px-2 py-0.5 text-xs">
|
||||||
Standard User
|
Standard User
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { prisma } from '../../lib/prisma'
|
|||||||
import { urlWithParams } from '../../lib/urls'
|
import { urlWithParams } from '../../lib/urls'
|
||||||
|
|
||||||
const user = Astro.locals.user
|
const user = Astro.locals.user
|
||||||
if (!user || (!user.admin && !user.verifier)) {
|
if (!user || (!user.admin && !user.moderator)) {
|
||||||
return Astro.rewrite('/404')
|
return Astro.rewrite('/404')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ type AdminLink = {
|
|||||||
icon: ComponentProps<typeof Icon>['name']
|
icon: ComponentProps<typeof Icon>['name']
|
||||||
title: string
|
title: string
|
||||||
href: string
|
href: string
|
||||||
description: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const adminLinks: AdminLink[] = [
|
const adminLinks: AdminLink[] = [
|
||||||
@@ -17,37 +16,36 @@ const adminLinks: AdminLink[] = [
|
|||||||
icon: 'ri:box-3-line',
|
icon: 'ri:box-3-line',
|
||||||
title: 'Services',
|
title: 'Services',
|
||||||
href: '/admin/services',
|
href: '/admin/services',
|
||||||
description: 'Manage your available services',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ri:file-list-3-line',
|
icon: 'ri:file-list-3-line',
|
||||||
title: 'Attributes',
|
title: 'Attributes',
|
||||||
href: '/admin/attributes',
|
href: '/admin/attributes',
|
||||||
description: 'Configure service attributes',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ri:user-3-line',
|
icon: 'ri:user-3-line',
|
||||||
title: 'Users',
|
title: 'Users',
|
||||||
href: '/admin/users',
|
href: '/admin/users',
|
||||||
description: 'Manage user accounts',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ri:chat-settings-line',
|
icon: 'ri:chat-settings-line',
|
||||||
title: 'Comments',
|
title: 'Comments',
|
||||||
href: '/admin/comments',
|
href: '/admin/comments',
|
||||||
description: 'Moderate user comments',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ri:lightbulb-line',
|
icon: 'ri:lightbulb-line',
|
||||||
title: 'Service suggestions',
|
title: 'Service suggestions',
|
||||||
href: '/admin/service-suggestions',
|
href: '/admin/service-suggestions',
|
||||||
description: 'Review and manage service suggestions',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ri:megaphone-line',
|
icon: 'ri:megaphone-line',
|
||||||
title: 'Announcements',
|
title: 'Announcements',
|
||||||
href: '/admin/announcements',
|
href: '/admin/announcements',
|
||||||
description: 'Manage site announcements',
|
},
|
||||||
|
{
|
||||||
|
icon: 'ri:database-2-line',
|
||||||
|
title: 'Database',
|
||||||
|
href: 'https://db.kycnot.me',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
---
|
---
|
||||||
@@ -58,23 +56,17 @@ const adminLinks: AdminLink[] = [
|
|||||||
Admin Dashboard
|
Admin Dashboard
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
|
<div class="grid grid-cols-[repeat(auto-fill,minmax(calc(var(--spacing)*40),1fr))] gap-4">
|
||||||
{
|
{
|
||||||
adminLinks.map((link) => (
|
adminLinks.map((link) => (
|
||||||
<a
|
<a
|
||||||
href={link.href}
|
href={link.href}
|
||||||
class="group block rounded-lg border border-zinc-800 bg-gradient-to-br from-zinc-900/90 to-zinc-900/50 p-6 shadow-lg backdrop-blur-xs transition-all duration-300 hover:-translate-y-0.5 hover:from-zinc-800/90 hover:to-zinc-800/50 hover:shadow-xl hover:shadow-zinc-900/20"
|
class="group flex flex-col items-center justify-evenly rounded-lg border border-zinc-800 bg-gradient-to-br from-zinc-900/90 to-zinc-900/50 py-3 text-center shadow-lg backdrop-blur-xs transition-all duration-300 hover:-translate-y-0.5 hover:from-zinc-800/90 hover:to-zinc-800/50 hover:shadow-xl hover:shadow-zinc-900/20"
|
||||||
>
|
>
|
||||||
<div class="mb-4 flex items-center gap-3">
|
<Icon name={link.icon} class="size-8 text-zinc-400 transition-colors group-hover:text-green-400" />
|
||||||
<Icon
|
<span class="font-title text-xl leading-none font-semibold text-zinc-100 transition-colors group-hover:text-green-400">
|
||||||
name={link.icon}
|
{link.title}
|
||||||
class="h-6 w-6 text-zinc-400 transition-colors group-hover:text-green-400"
|
</span>
|
||||||
/>
|
|
||||||
<h2 class="font-title text-xl font-semibold text-zinc-100 transition-colors group-hover:text-green-400">
|
|
||||||
{link.title}
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
<p class="text-sm text-zinc-400">{link.description}</p>
|
|
||||||
</a>
|
</a>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { actions } from 'astro:actions'
|
|||||||
|
|
||||||
import Chat from '../../../components/Chat.astro'
|
import Chat from '../../../components/Chat.astro'
|
||||||
import ServiceCard from '../../../components/ServiceCard.astro'
|
import ServiceCard from '../../../components/ServiceCard.astro'
|
||||||
|
import UserBadge from '../../../components/UserBadge.astro'
|
||||||
import { getServiceSuggestionStatusInfo } from '../../../constants/serviceSuggestionStatus'
|
import { getServiceSuggestionStatusInfo } from '../../../constants/serviceSuggestionStatus'
|
||||||
import BaseLayout from '../../../layouts/BaseLayout.astro'
|
import BaseLayout from '../../../layouts/BaseLayout.astro'
|
||||||
import { cn } from '../../../lib/cn'
|
import { cn } from '../../../lib/cn'
|
||||||
@@ -37,6 +38,8 @@ const serviceSuggestion = await Astro.locals.banners.try('Error fetching service
|
|||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
name: true,
|
name: true,
|
||||||
|
displayName: true,
|
||||||
|
picture: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
service: {
|
service: {
|
||||||
@@ -127,11 +130,7 @@ const statusInfo = getServiceSuggestionStatusInfo(serviceSuggestion.status)
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
<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">
|
<UserBadge class="text-gray-300" user={serviceSuggestion.user} size="md" />
|
||||||
<a href={`/admin/users/${serviceSuggestion.user.name}`} class="hover:text-green-500">
|
|
||||||
{serviceSuggestion.user.name}
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<span class="font-title text-gray-400">Submitted at:</span>
|
<span class="font-title text-gray-400">Submitted at:</span>
|
||||||
<span class="text-gray-300">{serviceSuggestion.createdAt.toLocaleString()}</span>
|
<span class="text-gray-300">{serviceSuggestion.createdAt.toLocaleString()}</span>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { Icon } from 'astro-icon/components'
|
import { Icon } from 'astro-icon/components'
|
||||||
import { actions } from 'astro:actions'
|
import { actions } from 'astro:actions'
|
||||||
import { z } from 'astro:content'
|
import { z } from 'astro:content'
|
||||||
import { orderBy as lodashOrderBy } from 'lodash-es'
|
import { orderBy } from 'lodash-es'
|
||||||
|
|
||||||
import SortArrowIcon from '../../../components/SortArrowIcon.astro'
|
import SortArrowIcon from '../../../components/SortArrowIcon.astro'
|
||||||
import TimeFormatted from '../../../components/TimeFormatted.astro'
|
import TimeFormatted from '../../../components/TimeFormatted.astro'
|
||||||
@@ -122,21 +122,13 @@ let suggestionsWithDetails = suggestions.map((s) => ({
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
if (sortBy === 'service') {
|
if (sortBy === 'service') {
|
||||||
suggestionsWithDetails = lodashOrderBy(
|
suggestionsWithDetails = orderBy(suggestionsWithDetails, [(s) => s.service.name.toLowerCase()], [sortOrder])
|
||||||
suggestionsWithDetails,
|
|
||||||
[(s) => s.service.name.toLowerCase()],
|
|
||||||
[sortOrder]
|
|
||||||
)
|
|
||||||
} else if (sortBy === 'status') {
|
} else if (sortBy === 'status') {
|
||||||
suggestionsWithDetails = lodashOrderBy(suggestionsWithDetails, [(s) => s.statusInfo.label], [sortOrder])
|
suggestionsWithDetails = orderBy(suggestionsWithDetails, [(s) => s.statusInfo.label], [sortOrder])
|
||||||
} else if (sortBy === 'user') {
|
} else if (sortBy === 'user') {
|
||||||
suggestionsWithDetails = lodashOrderBy(
|
suggestionsWithDetails = orderBy(suggestionsWithDetails, [(s) => s.user.name.toLowerCase()], [sortOrder])
|
||||||
suggestionsWithDetails,
|
|
||||||
[(s) => s.user.name.toLowerCase()],
|
|
||||||
[sortOrder]
|
|
||||||
)
|
|
||||||
} else if (sortBy === 'messageCount') {
|
} else if (sortBy === 'messageCount') {
|
||||||
suggestionsWithDetails = lodashOrderBy(suggestionsWithDetails, ['messageCount'], [sortOrder])
|
suggestionsWithDetails = orderBy(suggestionsWithDetails, ['messageCount'], [sortOrder])
|
||||||
}
|
}
|
||||||
|
|
||||||
const suggestionCount = suggestionsWithDetails.length
|
const suggestionCount = suggestionsWithDetails.length
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
---
|
---
|
||||||
import {
|
import { EventType, VerificationStepStatus } from '@prisma/client'
|
||||||
AttributeCategory,
|
|
||||||
Currency,
|
|
||||||
EventType,
|
|
||||||
VerificationStatus,
|
|
||||||
VerificationStepStatus,
|
|
||||||
} from '@prisma/client'
|
|
||||||
import { Icon } from 'astro-icon/components'
|
import { Icon } from 'astro-icon/components'
|
||||||
import { actions, isInputError } from 'astro:actions'
|
import { actions, isInputError } from 'astro:actions'
|
||||||
|
|
||||||
import MyPicture from '../../../../components/MyPicture.astro'
|
import InputCardGroup from '../../../../components/InputCardGroup.astro'
|
||||||
|
import InputCheckboxGroup from '../../../../components/InputCheckboxGroup.astro'
|
||||||
|
import InputImageFile from '../../../../components/InputImageFile.astro'
|
||||||
|
import InputSubmitButton from '../../../../components/InputSubmitButton.astro'
|
||||||
|
import InputText from '../../../../components/InputText.astro'
|
||||||
|
import InputTextArea from '../../../../components/InputTextArea.astro'
|
||||||
import UserBadge from '../../../../components/UserBadge.astro'
|
import UserBadge from '../../../../components/UserBadge.astro'
|
||||||
|
import { formatContactMethod } from '../../../../constants/contactMethods'
|
||||||
|
import { currencies } from '../../../../constants/currencies'
|
||||||
|
import { kycLevels } from '../../../../constants/kycLevels'
|
||||||
import { serviceVisibilities } from '../../../../constants/serviceVisibility'
|
import { serviceVisibilities } from '../../../../constants/serviceVisibility'
|
||||||
|
import { verificationStatuses } from '../../../../constants/verificationStatus'
|
||||||
import BaseLayout from '../../../../layouts/BaseLayout.astro'
|
import BaseLayout from '../../../../layouts/BaseLayout.astro'
|
||||||
import { cn } from '../../../../lib/cn'
|
import { cn } from '../../../../lib/cn'
|
||||||
import { prisma } from '../../../../lib/prisma'
|
import { prisma } from '../../../../lib/prisma'
|
||||||
import { ACCEPTED_IMAGE_TYPES } from '../../../../lib/zodUtils'
|
|
||||||
|
|
||||||
const { slug } = Astro.params
|
const { slug } = Astro.params
|
||||||
|
|
||||||
@@ -131,15 +133,7 @@ const attributes = await Astro.locals.banners.try(
|
|||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|
||||||
const inputBaseClasses =
|
// Button style constants for admin sections (Events, etc.)
|
||||||
'w-full rounded-md border-zinc-600 bg-zinc-700/80 p-2 text-zinc-200 placeholder-zinc-400 focus:border-sky-500 focus:ring-1 focus:ring-sky-500 text-sm'
|
|
||||||
const labelBaseClasses = 'block text-sm font-medium text-zinc-300 mb-1'
|
|
||||||
const errorTextClasses = 'mt-1 text-xs text-red-400'
|
|
||||||
const checkboxLabelClasses = 'inline-flex items-center text-sm text-zinc-300'
|
|
||||||
const checkboxInputClasses =
|
|
||||||
'rounded-sm border-zinc-500 bg-zinc-700 text-sky-500 focus:ring-sky-500 focus:ring-offset-zinc-800'
|
|
||||||
|
|
||||||
// Button style constants
|
|
||||||
const buttonPrimaryClasses =
|
const buttonPrimaryClasses =
|
||||||
'inline-flex items-center justify-center rounded-md border border-transparent bg-sky-600 px-3 py-1.5 text-sm font-medium text-white shadow-sm hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-500 focus:ring-offset-2 focus:ring-offset-zinc-900'
|
'inline-flex items-center justify-center rounded-md border border-transparent bg-sky-600 px-3 py-1.5 text-sm font-medium text-white shadow-sm hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-500 focus:ring-offset-2 focus:ring-offset-zinc-900'
|
||||||
|
|
||||||
@@ -160,6 +154,12 @@ const buttonSmallWarningClasses = cn(
|
|||||||
buttonSmallBaseClasses,
|
buttonSmallBaseClasses,
|
||||||
'text-yellow-400 hover:bg-yellow-700/30 hover:text-yellow-300'
|
'text-yellow-400 hover:bg-yellow-700/30 hover:text-yellow-300'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Legacy classes for existing admin forms (Events, Verification Steps, Contact Methods)
|
||||||
|
const inputBaseClasses =
|
||||||
|
'w-full rounded-md border-zinc-600 bg-zinc-700/80 p-2 text-zinc-200 placeholder-zinc-400 focus:border-sky-500 focus:ring-1 focus:ring-sky-500 text-sm'
|
||||||
|
const labelBaseClasses = 'block text-sm font-medium text-zinc-300 mb-1'
|
||||||
|
const errorTextClasses = 'mt-1 text-xs text-red-400'
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout pageTitle={`Edit Service: ${service.name}`}>
|
<BaseLayout pageTitle={`Edit Service: ${service.name}`}>
|
||||||
@@ -170,8 +170,6 @@ const buttonSmallWarningClasses = cn(
|
|||||||
</h1>
|
</h1>
|
||||||
<a
|
<a
|
||||||
href={`/service/${service.slug}`}
|
href={`/service/${service.slug}`}
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
class="inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-sm text-sky-400 hover:text-sky-300 hover:underline focus:ring-2 focus:ring-sky-500 focus:ring-offset-2 focus:ring-offset-zinc-900 focus:outline-none"
|
class="inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-sm text-sky-400 hover:text-sky-300 hover:underline focus:ring-2 focus:ring-sky-500 focus:ring-offset-2 focus:ring-offset-zinc-900 focus:outline-none"
|
||||||
>
|
>
|
||||||
<Icon name="ri:external-link-line" class="size-4" />
|
<Icon name="ri:external-link-line" class="size-4" />
|
||||||
@@ -190,430 +188,226 @@ const buttonSmallWarningClasses = cn(
|
|||||||
enctype="multipart/form-data"
|
enctype="multipart/form-data"
|
||||||
>
|
>
|
||||||
<input type="hidden" name="id" value={service.id} />
|
<input type="hidden" name="id" value={service.id} />
|
||||||
|
<InputText
|
||||||
|
label="Name"
|
||||||
|
name="name"
|
||||||
|
inputProps={{
|
||||||
|
required: true,
|
||||||
|
value: service.name,
|
||||||
|
}}
|
||||||
|
error={serviceInputErrors.name}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputTextArea
|
||||||
|
label="Description"
|
||||||
|
name="description"
|
||||||
|
inputProps={{
|
||||||
|
required: true,
|
||||||
|
rows: 4,
|
||||||
|
}}
|
||||||
|
value={service.description}
|
||||||
|
error={serviceInputErrors.description}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputText
|
||||||
|
label="Slug (auto-generated if empty)"
|
||||||
|
name="slug"
|
||||||
|
inputProps={{
|
||||||
|
value: service.slug,
|
||||||
|
class: 'font-title',
|
||||||
|
}}
|
||||||
|
error={serviceInputErrors.slug}
|
||||||
|
class="font-title"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
|
||||||
|
<InputTextArea
|
||||||
|
label="Service URLs (one per line)"
|
||||||
|
name="serviceUrls"
|
||||||
|
inputProps={{
|
||||||
|
rows: 3,
|
||||||
|
placeholder: 'https://example1.com\nhttps://example2.com',
|
||||||
|
}}
|
||||||
|
value={service.serviceUrls.join('\n')}
|
||||||
|
error={serviceInputErrors.serviceUrls}
|
||||||
|
/>
|
||||||
|
<InputTextArea
|
||||||
|
label="ToS URLs (one per line)"
|
||||||
|
name="tosUrls"
|
||||||
|
inputProps={{
|
||||||
|
rows: 3,
|
||||||
|
placeholder: 'https://example1.com/tos\nhttps://example2.com/tos',
|
||||||
|
}}
|
||||||
|
value={service.tosUrls.join('\n')}
|
||||||
|
error={serviceInputErrors.tosUrls}
|
||||||
|
/>
|
||||||
|
<InputTextArea
|
||||||
|
label="Onion URLs (one per line)"
|
||||||
|
name="onionUrls"
|
||||||
|
inputProps={{
|
||||||
|
rows: 3,
|
||||||
|
placeholder: 'http://example1.onion\nhttp://example2.onion',
|
||||||
|
}}
|
||||||
|
value={service.onionUrls.join('\n')}
|
||||||
|
error={serviceInputErrors.onionUrls}
|
||||||
|
/>
|
||||||
|
<InputTextArea
|
||||||
|
label="I2P URLs (one per line)"
|
||||||
|
name="i2pUrls"
|
||||||
|
inputProps={{
|
||||||
|
rows: 3,
|
||||||
|
placeholder: 'http://example1.b32.i2p\nhttp://example2.b32.i2p',
|
||||||
|
}}
|
||||||
|
value={service.i2pUrls.join('\n')}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="name" class={labelBaseClasses}>Name</label>
|
<InputImageFile
|
||||||
<input
|
label="Service Image"
|
||||||
transition:persist
|
name="imageFile"
|
||||||
type="text"
|
description="Square image. At least 192x192px. Transparency supported. Leave empty to keep current image."
|
||||||
name="name"
|
error={serviceInputErrors.imageFile}
|
||||||
id="name"
|
square
|
||||||
|
value={service.imageUrl}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<InputCheckboxGroup
|
||||||
|
name="categories"
|
||||||
|
label="Categories"
|
||||||
required
|
required
|
||||||
value={service.name}
|
options={categories.map((category) => ({
|
||||||
class={inputBaseClasses}
|
label: category.name,
|
||||||
|
value: category.id.toString(),
|
||||||
|
icon: category.icon,
|
||||||
|
}))}
|
||||||
|
selectedValues={service.categories.map((c) => c.id.toString())}
|
||||||
|
error={serviceInputErrors.categories}
|
||||||
/>
|
/>
|
||||||
{serviceInputErrors.name && <p class={errorTextClasses}>{serviceInputErrors.name.join(', ')}</p>}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="description" class={labelBaseClasses}>Description</label>
|
<InputCardGroup
|
||||||
<textarea
|
name="kycLevel"
|
||||||
transition:persist
|
label="KYC Level"
|
||||||
name="description"
|
options={kycLevels.map((kycLevel) => ({
|
||||||
id="description"
|
label: `${kycLevel.name} (${kycLevel.value}/4)`,
|
||||||
|
value: kycLevel.id.toString(),
|
||||||
|
icon: kycLevel.icon,
|
||||||
|
description: kycLevel.description,
|
||||||
|
}))}
|
||||||
|
selectedValue={service.kycLevel.toString()}
|
||||||
|
iconSize="md"
|
||||||
|
cardSize="md"
|
||||||
|
error={serviceInputErrors.kycLevel}
|
||||||
|
class="[&>div]:grid-cols-2 [&>div]:[--card-min-size:16rem]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<InputCheckboxGroup
|
||||||
|
name="attributes"
|
||||||
|
label="Attributes"
|
||||||
|
options={attributes.map((attribute) => ({
|
||||||
|
label: `${attribute.title} (${attribute.category})`,
|
||||||
|
value: attribute.id.toString(),
|
||||||
|
}))}
|
||||||
|
selectedValues={service.attributes.map((a) => a.attribute.id.toString())}
|
||||||
|
error={serviceInputErrors.attributes}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<InputCardGroup
|
||||||
|
name="verificationStatus"
|
||||||
|
label="Verification Status"
|
||||||
|
options={verificationStatuses.map((status) => ({
|
||||||
|
label: status.label,
|
||||||
|
value: status.value,
|
||||||
|
icon: status.icon,
|
||||||
|
iconClass: status.classNames.icon,
|
||||||
|
description: status.description,
|
||||||
|
}))}
|
||||||
|
selectedValue={service.verificationStatus}
|
||||||
|
error={serviceInputErrors.verificationStatus}
|
||||||
|
cardSize="md"
|
||||||
|
iconSize="md"
|
||||||
|
class="[&>div]:grid-cols-2 [&>div]:[--card-min-size:16rem]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<InputCardGroup
|
||||||
|
name="acceptedCurrencies"
|
||||||
|
label="Accepted Currencies"
|
||||||
|
options={currencies.map((currency) => ({
|
||||||
|
label: currency.name,
|
||||||
|
value: currency.id,
|
||||||
|
icon: currency.icon,
|
||||||
|
}))}
|
||||||
|
selectedValue={service.acceptedCurrencies}
|
||||||
|
error={serviceInputErrors.acceptedCurrencies}
|
||||||
required
|
required
|
||||||
rows={4}
|
multiple
|
||||||
class={inputBaseClasses}
|
|
||||||
set:text={service.description}
|
|
||||||
/>
|
/>
|
||||||
{
|
|
||||||
serviceInputErrors.description && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.description.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="slug" class={cn(labelBaseClasses, 'font-title')}>Slug (auto-generated if empty)</label>
|
<InputTextArea
|
||||||
<input
|
label="Verification Summary (Markdown)"
|
||||||
transition:persist
|
|
||||||
type="text"
|
|
||||||
name="slug"
|
|
||||||
id="slug"
|
|
||||||
value={service.slug}
|
|
||||||
class={cn(inputBaseClasses, 'font-title')}
|
|
||||||
/>
|
|
||||||
{serviceInputErrors.slug && <p class={errorTextClasses}>{serviceInputErrors.slug.join(', ')}</p>}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
||||||
<div>
|
|
||||||
<label for="serviceUrls" class={labelBaseClasses}>Service URLs (one per line)</label>
|
|
||||||
<textarea
|
|
||||||
transition:persist
|
|
||||||
class={inputBaseClasses}
|
|
||||||
name="serviceUrls"
|
|
||||||
id="serviceUrls"
|
|
||||||
rows={3}
|
|
||||||
placeholder="https://example1.com\nhttps://example2.com"
|
|
||||||
set:text={service.serviceUrls.join('\n')}
|
|
||||||
/>
|
|
||||||
{
|
|
||||||
serviceInputErrors.serviceUrls && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.serviceUrls.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="tosUrls" class={labelBaseClasses}>ToS URLs (one per line)</label>
|
|
||||||
<textarea
|
|
||||||
transition:persist
|
|
||||||
class={inputBaseClasses}
|
|
||||||
name="tosUrls"
|
|
||||||
id="tosUrls"
|
|
||||||
rows={3}
|
|
||||||
placeholder="https://example1.com/tos\nhttps://example2.com/tos"
|
|
||||||
set:text={service.tosUrls.join('\n')}
|
|
||||||
/>
|
|
||||||
{
|
|
||||||
serviceInputErrors.tosUrls && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.tosUrls.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="onionUrls" class={labelBaseClasses}>Onion URLs (one per line)</label>
|
|
||||||
<textarea
|
|
||||||
transition:persist
|
|
||||||
class={inputBaseClasses}
|
|
||||||
name="onionUrls"
|
|
||||||
id="onionUrls"
|
|
||||||
rows={3}
|
|
||||||
placeholder="http://example1.onion\nhttp://example2.onion"
|
|
||||||
set:text={service.onionUrls.join('\n')}
|
|
||||||
/>
|
|
||||||
{
|
|
||||||
serviceInputErrors.onionUrls && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.onionUrls.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="i2pUrls" class={labelBaseClasses}>I2P URLs (one per line)</label>
|
|
||||||
<textarea
|
|
||||||
transition:persist
|
|
||||||
class={inputBaseClasses}
|
|
||||||
name="i2pUrls"
|
|
||||||
id="i2pUrls"
|
|
||||||
rows={3}
|
|
||||||
placeholder="http://example1.b32.i2p\nhttp://example2.b32.i2p"
|
|
||||||
set:text={service.i2pUrls.join('\n')}
|
|
||||||
/>
|
|
||||||
{/* Assuming i2pUrls might have errors, add error display if schema supports it */}
|
|
||||||
{
|
|
||||||
/* serviceInputErrors.i2pUrls && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.i2pUrls.join(', ')}</p>
|
|
||||||
) */
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<div class="flex items-end gap-4">
|
|
||||||
<div class="grow">
|
|
||||||
<label for="imageFile" class={labelBaseClasses}>Service Image</label>
|
|
||||||
<div class="space-y-1">
|
|
||||||
<input
|
|
||||||
transition:persist
|
|
||||||
type="file"
|
|
||||||
name="imageFile"
|
|
||||||
id="imageFile"
|
|
||||||
accept={ACCEPTED_IMAGE_TYPES.join(',')}
|
|
||||||
class={cn(
|
|
||||||
inputBaseClasses,
|
|
||||||
'p-0 file:mr-3 file:rounded-md file:border-0 file:bg-zinc-600 file:px-3 file:py-2 file:font-medium file:text-zinc-200 hover:file:bg-zinc-500'
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<p class="text-xs text-zinc-400">
|
|
||||||
Leave empty to keep the current image. Square images (e.g., 256x256) recommended.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
{
|
|
||||||
serviceInputErrors.imageFile && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.imageFile.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
{
|
|
||||||
service.imageUrl ? (
|
|
||||||
<div class="mt-2 shrink-0">
|
|
||||||
<MyPicture
|
|
||||||
src={service.imageUrl}
|
|
||||||
alt="Current service image"
|
|
||||||
width={100}
|
|
||||||
height={100}
|
|
||||||
class="h-24 w-24 rounded-md border border-zinc-600 object-cover"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div class="flex h-24 w-24 shrink-0 items-center justify-center rounded-lg border border-zinc-600 bg-zinc-700/50 text-3xl leading-none text-zinc-500">
|
|
||||||
<Icon name="ri:image-add-line" class="size-10" />
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
||||||
<div>
|
|
||||||
<label class={labelBaseClasses} for="categories">Categories</label>
|
|
||||||
<div
|
|
||||||
class="mt-1 max-h-48 space-y-1 space-x-2 overflow-y-auto rounded-md border border-zinc-600 bg-zinc-700/30 p-3"
|
|
||||||
>
|
|
||||||
{
|
|
||||||
categories.map((category) => (
|
|
||||||
<label class={checkboxLabelClasses}>
|
|
||||||
<input
|
|
||||||
transition:persist
|
|
||||||
type="checkbox"
|
|
||||||
name="categories"
|
|
||||||
value={category.id}
|
|
||||||
checked={service.categories.some((c) => c.id === category.id)}
|
|
||||||
class={cn(checkboxInputClasses, 'mr-1')}
|
|
||||||
/>
|
|
||||||
<span>{category.name}</span>
|
|
||||||
</label>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
{
|
|
||||||
serviceInputErrors.categories && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.categories.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label for="kycLevel" class={labelBaseClasses}>KYC Level (0-4)</label>
|
|
||||||
<input
|
|
||||||
transition:persist
|
|
||||||
class={inputBaseClasses}
|
|
||||||
type="number"
|
|
||||||
name="kycLevel"
|
|
||||||
id="kycLevel"
|
|
||||||
min={0}
|
|
||||||
max={4}
|
|
||||||
value={service.kycLevel}
|
|
||||||
/>
|
|
||||||
{
|
|
||||||
serviceInputErrors.kycLevel && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.kycLevel.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label class={labelBaseClasses} for="attributes">Attributes</label>
|
|
||||||
<div class="space-y-3">
|
|
||||||
{
|
|
||||||
Object.values(AttributeCategory).map((categoryValue) => (
|
|
||||||
<div class="rounded-md border border-zinc-700 bg-zinc-700/30 p-4">
|
|
||||||
<h4 class="font-title text-md mb-2 font-medium text-zinc-200">{categoryValue}</h4>
|
|
||||||
<div class="grid grid-cols-1 gap-x-4 gap-y-1 sm:grid-cols-2">
|
|
||||||
{attributes
|
|
||||||
.filter((attr) => attr.category === categoryValue)
|
|
||||||
.map((attr) => (
|
|
||||||
<label class={checkboxLabelClasses}>
|
|
||||||
<input
|
|
||||||
transition:persist
|
|
||||||
type="checkbox"
|
|
||||||
name="attributes"
|
|
||||||
value={attr.id}
|
|
||||||
checked={service.attributes.some((a) => a.attribute.id === attr.id)}
|
|
||||||
class={cn(checkboxInputClasses, 'mr-2')}
|
|
||||||
/>
|
|
||||||
<span class="flex items-center gap-1.5">
|
|
||||||
{attr.title}
|
|
||||||
<span
|
|
||||||
class={cn(
|
|
||||||
'rounded-sm border px-1 py-0.5 text-xs font-medium',
|
|
||||||
{
|
|
||||||
'border-green-500/50 bg-green-500/20 text-green-300': attr.type === 'GOOD',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'border-red-500/50 bg-red-500/20 text-red-300': attr.type === 'BAD',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'border-yellow-500/50 bg-yellow-500/20 text-yellow-300':
|
|
||||||
attr.type === 'WARNING',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'border-sky-500/50 bg-sky-500/20 text-sky-300': attr.type === 'INFO',
|
|
||||||
}
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{attr.type}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
{serviceInputErrors.attributes && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.attributes.join(', ')}</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
|
|
||||||
<div>
|
|
||||||
<label class={labelBaseClasses} for="verificationStatus">Verification Status</label>
|
|
||||||
<select
|
|
||||||
transition:persist
|
|
||||||
class={inputBaseClasses}
|
|
||||||
name="verificationStatus"
|
|
||||||
id="verificationStatus"
|
|
||||||
>
|
|
||||||
{
|
|
||||||
Object.values(VerificationStatus).map((status) => (
|
|
||||||
<option value={status} selected={service.verificationStatus === status}>
|
|
||||||
{status}
|
|
||||||
</option>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</select>
|
|
||||||
{
|
|
||||||
serviceInputErrors.verificationStatus && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.verificationStatus.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label class={labelBaseClasses} for="acceptedCurrencies">Accepted Currencies</label>
|
|
||||||
<div
|
|
||||||
class="mt-1 max-h-32 space-y-1 space-x-2 overflow-y-auto rounded-md border border-zinc-600 bg-zinc-700/30 p-3"
|
|
||||||
>
|
|
||||||
{
|
|
||||||
Object.values(Currency).map((currency) => (
|
|
||||||
<label class={checkboxLabelClasses}>
|
|
||||||
<input
|
|
||||||
transition:persist
|
|
||||||
type="checkbox"
|
|
||||||
name="acceptedCurrencies"
|
|
||||||
value={currency}
|
|
||||||
checked={service.acceptedCurrencies.includes(currency)}
|
|
||||||
class={cn(checkboxInputClasses, 'mr-1')}
|
|
||||||
/>
|
|
||||||
<span>{currency}</span>
|
|
||||||
</label>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
{
|
|
||||||
serviceInputErrors.acceptedCurrencies && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.acceptedCurrencies.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label class={labelBaseClasses} for="verificationSummary">Verification Summary (Markdown)</label>
|
|
||||||
<textarea
|
|
||||||
transition:persist
|
|
||||||
class={inputBaseClasses}
|
|
||||||
name="verificationSummary"
|
name="verificationSummary"
|
||||||
id="verificationSummary"
|
inputProps={{
|
||||||
rows={4}
|
rows: 4,
|
||||||
set:text={service.verificationSummary}
|
}}
|
||||||
|
value={service.verificationSummary ?? undefined}
|
||||||
|
error={serviceInputErrors.verificationSummary}
|
||||||
/>
|
/>
|
||||||
{
|
|
||||||
serviceInputErrors.verificationSummary && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.verificationSummary.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class={labelBaseClasses} for="verificationProofMd">Verification Proof (Markdown)</label>
|
<InputTextArea
|
||||||
<textarea
|
label="Verification Proof (Markdown)"
|
||||||
transition:persist
|
|
||||||
class={inputBaseClasses}
|
|
||||||
name="verificationProofMd"
|
name="verificationProofMd"
|
||||||
id="verificationProofMd"
|
inputProps={{
|
||||||
rows={8}
|
rows: 8,
|
||||||
set:text={service.verificationProofMd}
|
}}
|
||||||
|
value={service.verificationProofMd ?? undefined}
|
||||||
|
error={serviceInputErrors.verificationProofMd}
|
||||||
/>
|
/>
|
||||||
{
|
|
||||||
serviceInputErrors.verificationProofMd && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.verificationProofMd.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class={labelBaseClasses} for="referral">Referral Code/Link (Optional)</label>
|
<InputText
|
||||||
<input
|
label="Referral Code/Link (Optional)"
|
||||||
transition:persist
|
|
||||||
type="text"
|
|
||||||
name="referral"
|
name="referral"
|
||||||
id="referral"
|
inputProps={{
|
||||||
value={service.referral}
|
value: service.referral ?? undefined,
|
||||||
placeholder="e.g., REFCODE123 or https://example.com?ref=123"
|
placeholder: 'e.g., REFCODE123 or https://example.com?ref=123',
|
||||||
class={inputBaseClasses}
|
}}
|
||||||
|
error={serviceInputErrors.referral}
|
||||||
/>
|
/>
|
||||||
{
|
|
||||||
serviceInputErrors.referral && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.referral.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class={labelBaseClasses} for="serviceVisibility">Service Visibility</label>
|
<InputCardGroup
|
||||||
<div class="grid grid-cols-1 gap-3 sm:grid-cols-3">
|
name="serviceVisibility"
|
||||||
{
|
label="Service Visibility"
|
||||||
serviceVisibilities.map((visibility) => (
|
options={serviceVisibilities.map((visibility) => ({
|
||||||
<div class="contents">
|
label: visibility.label,
|
||||||
<input
|
value: visibility.value,
|
||||||
transition:persist
|
icon: visibility.icon,
|
||||||
type="radio"
|
iconClass: visibility.iconClass,
|
||||||
name="serviceVisibility"
|
description: visibility.description,
|
||||||
id={`serviceVisibility-${visibility.value}`}
|
}))}
|
||||||
value={visibility.value}
|
selectedValue={service.serviceVisibility}
|
||||||
checked={service.serviceVisibility === visibility.value}
|
error={serviceInputErrors.serviceVisibility}
|
||||||
class="peer sr-only"
|
cardSize="sm"
|
||||||
/>
|
/>
|
||||||
<label
|
|
||||||
for={`serviceVisibility-${visibility.value}`}
|
|
||||||
class="group relative cursor-pointer items-start gap-3 rounded-lg border border-zinc-700 bg-zinc-700/50 p-3 transition-all peer-checked:border-sky-500 peer-checked:bg-sky-500/20 peer-checked:ring-1 peer-checked:ring-sky-500 hover:bg-zinc-700/80"
|
|
||||||
>
|
|
||||||
<div class="mb-1 flex items-center gap-1.5">
|
|
||||||
<Icon
|
|
||||||
name={visibility.icon}
|
|
||||||
class={cn(
|
|
||||||
'size-4 text-zinc-300 group-peer-checked:text-sky-400',
|
|
||||||
visibility.iconClass
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<span class="text-sm font-medium text-zinc-200 group-peer-checked:text-sky-300">
|
|
||||||
{visibility.label}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<p class="text-xs leading-snug text-zinc-400 group-peer-checked:text-sky-400/80">
|
|
||||||
{visibility.description}
|
|
||||||
</p>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
{
|
|
||||||
serviceInputErrors.serviceVisibility && (
|
|
||||||
<p class={errorTextClasses}>{serviceInputErrors.serviceVisibility.join(', ')}</p>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<InputSubmitButton label="Update Service" />
|
||||||
type="submit"
|
|
||||||
class="inline-flex justify-center rounded-md border border-transparent bg-sky-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-sky-700 focus:ring-2 focus:ring-sky-500 focus:ring-offset-2 focus:ring-offset-zinc-900 focus:outline-none"
|
|
||||||
>
|
|
||||||
Update Service
|
|
||||||
</button>
|
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -1213,114 +1007,95 @@ const buttonSmallWarningClasses = cn(
|
|||||||
service.contactMethods.length > 0 && (
|
service.contactMethods.length > 0 && (
|
||||||
<div class="space-y-3">
|
<div class="space-y-3">
|
||||||
<h3 class="font-title mb-2 text-lg font-medium text-zinc-200">Existing Contact Methods</h3>
|
<h3 class="font-title mb-2 text-lg font-medium text-zinc-200">Existing Contact Methods</h3>
|
||||||
{service.contactMethods.map((method) => (
|
{service.contactMethods.map((method) => {
|
||||||
<div class="rounded-md border border-zinc-700 bg-zinc-700/30 p-3">
|
const contactMethodInfo = formatContactMethod(method.value)
|
||||||
<div class="flex items-start justify-between gap-3">
|
return (
|
||||||
<div class="flex-grow space-y-1">
|
<div class="rounded-md border border-zinc-700 bg-zinc-700/30 p-3">
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
<div class="flex items-start justify-between gap-3">
|
||||||
<Icon name={method.iconId} class="size-4 text-zinc-300" />
|
<div class="flex-grow space-y-1">
|
||||||
<span class="text-md font-semibold text-zinc-100">{method.label}</span>
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
<Icon name={contactMethodInfo.icon} class="size-4 text-zinc-300" />
|
||||||
|
<span class="text-md font-semibold text-zinc-100">{contactMethodInfo.label}</span>
|
||||||
|
</div>
|
||||||
|
<p class="text-sm text-pretty text-zinc-400">
|
||||||
|
{method.label ?? contactMethodInfo.formattedValue}{' '}
|
||||||
|
<span class="text-zinc-500">({method.value})</span>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="text-sm text-pretty text-zinc-400">{method.value}</p>
|
<div class="flex shrink-0 gap-1.5">
|
||||||
{method.info && <p class="text-xs text-zinc-500">{method.info}</p>}
|
|
||||||
</div>
|
|
||||||
<div class="flex shrink-0 gap-1.5">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class={buttonSmallPrimaryClasses}
|
|
||||||
title="Edit Contact Method"
|
|
||||||
onclick={`document.getElementById('edit-contact-method-${method.id}')?.classList.toggle('hidden')`}
|
|
||||||
>
|
|
||||||
<Icon name="ri:pencil-line" class="size-4" />
|
|
||||||
</button>
|
|
||||||
<form method="POST" action={actions.admin.service.deleteContactMethod} class="inline">
|
|
||||||
<input type="hidden" name="id" value={method.id} />
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="button"
|
||||||
class={buttonSmallDestructiveClasses}
|
class={buttonSmallPrimaryClasses}
|
||||||
title="Delete Contact Method"
|
title="Edit Contact Method"
|
||||||
|
onclick={`document.getElementById('edit-contact-method-${method.id}')?.classList.toggle('hidden')`}
|
||||||
>
|
>
|
||||||
<Icon name="ri:delete-bin-line" class="size-4" />
|
<Icon name="ri:pencil-line" class="size-4" />
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<form method="POST" action={actions.admin.service.deleteContactMethod} class="inline">
|
||||||
|
<input type="hidden" name="id" value={method.id} />
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
class={buttonSmallDestructiveClasses}
|
||||||
|
title="Delete Contact Method"
|
||||||
|
>
|
||||||
|
<Icon name="ri:delete-bin-line" class="size-4" />
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Edit Contact Method Form - Hidden by default */}
|
{/* Edit Contact Method Form - Hidden by default */}
|
||||||
<form
|
<form
|
||||||
id={`edit-contact-method-${method.id}`}
|
id={`edit-contact-method-${method.id}`}
|
||||||
method="POST"
|
method="POST"
|
||||||
action={actions.admin.service.updateContactMethod}
|
action={actions.admin.service.updateContactMethod}
|
||||||
class="mt-3 hidden space-y-3 rounded-md border border-zinc-600 bg-zinc-700/40 p-3"
|
class="mt-3 hidden space-y-3 rounded-md border border-zinc-600 bg-zinc-700/40 p-3"
|
||||||
>
|
>
|
||||||
<input type="hidden" name="id" value={method.id} />
|
<input type="hidden" name="id" value={method.id} />
|
||||||
<input type="hidden" name="serviceId" value={service.id} />
|
<input type="hidden" name="serviceId" value={service.id} />
|
||||||
<div>
|
<div>
|
||||||
<label for={`contactLabel-${method.id}`} class={labelBaseClasses}>
|
<label for={`contactLabel-${method.id}`} class={labelBaseClasses}>
|
||||||
Label
|
Override Label (Optional)
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
name="label"
|
name="label"
|
||||||
id={`contactLabel-${method.id}`}
|
id={`contactLabel-${method.id}`}
|
||||||
value={method.label}
|
value={method.label}
|
||||||
class={inputBaseClasses}
|
class={inputBaseClasses}
|
||||||
/>
|
placeholder={contactMethodInfo.formattedValue}
|
||||||
</div>
|
/>
|
||||||
<div>
|
</div>
|
||||||
<label for={`contactValue-${method.id}`} class={labelBaseClasses}>
|
<div>
|
||||||
Value (with protocol)
|
<label for={`contactValue-${method.id}`} class={labelBaseClasses}>
|
||||||
</label>
|
Value (with protocol)
|
||||||
<input
|
</label>
|
||||||
type="text"
|
<input
|
||||||
name="value"
|
type="text"
|
||||||
id={`contactValue-${method.id}`}
|
name="value"
|
||||||
value={method.value}
|
id={`contactValue-${method.id}`}
|
||||||
placeholder="e.g., mailto:contact@example.com or https://t.me/example"
|
value={method.value}
|
||||||
class={inputBaseClasses}
|
placeholder="e.g., mailto:contact@example.com or https://t.me/example"
|
||||||
/>
|
class={inputBaseClasses}
|
||||||
</div>
|
/>
|
||||||
<div>
|
</div>
|
||||||
<label for={`contactIcon-${method.id}`} class={labelBaseClasses}>
|
|
||||||
Icon ID
|
<div class="mt-2 flex justify-end gap-2">
|
||||||
</label>
|
<button
|
||||||
<input
|
type="button"
|
||||||
type="text"
|
class={buttonSmallSecondaryClasses}
|
||||||
name="iconId"
|
onclick={`document.getElementById('edit-contact-method-${method.id}')?.classList.add('hidden')`}
|
||||||
id={`contactIcon-${method.id}`}
|
>
|
||||||
value={method.iconId}
|
Cancel
|
||||||
placeholder="e.g., ri:mail-line or ri:telegram-line"
|
</button>
|
||||||
class={inputBaseClasses}
|
<button type="submit" class={buttonSmallPrimaryClasses}>
|
||||||
/>
|
Update Contact Method
|
||||||
</div>
|
</button>
|
||||||
<div>
|
</div>
|
||||||
<label for={`contactInfo-${method.id}`} class={labelBaseClasses}>
|
</form>
|
||||||
Additional Info (Optional)
|
</div>
|
||||||
</label>
|
)
|
||||||
<input
|
})}
|
||||||
type="text"
|
|
||||||
name="info"
|
|
||||||
id={`contactInfo-${method.id}`}
|
|
||||||
value={method.info}
|
|
||||||
placeholder="e.g., Available 24/7 or Response within 24h"
|
|
||||||
class={inputBaseClasses}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="mt-2 flex justify-end gap-2">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class={buttonSmallSecondaryClasses}
|
|
||||||
onclick={`document.getElementById('edit-contact-method-${method.id}')?.classList.add('hidden')`}
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button type="submit" class={buttonSmallPrimaryClasses}>
|
|
||||||
Update Contact Method
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1344,8 +1119,8 @@ const buttonSmallWarningClasses = cn(
|
|||||||
>
|
>
|
||||||
<input type="hidden" name="serviceId" value={service.id} />
|
<input type="hidden" name="serviceId" value={service.id} />
|
||||||
<div>
|
<div>
|
||||||
<label for="newContactLabel" class={labelBaseClasses}>Label</label>
|
<label for="newContactLabel" class={labelBaseClasses}>Override Label (Optional)</label>
|
||||||
<input type="text" name="label" id="newContactLabel" required class={inputBaseClasses} />
|
<input type="text" name="label" id="newContactLabel" class={inputBaseClasses} />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="newContactValue" class={labelBaseClasses}>Value (with protocol)</label>
|
<label for="newContactValue" class={labelBaseClasses}>Value (with protocol)</label>
|
||||||
@@ -1358,27 +1133,7 @@ const buttonSmallWarningClasses = cn(
|
|||||||
class={inputBaseClasses}
|
class={inputBaseClasses}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
<label for="newContactIcon" class={labelBaseClasses}>Icon ID</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="iconId"
|
|
||||||
id="newContactIcon"
|
|
||||||
required
|
|
||||||
placeholder="e.g., ri:mail-line or ri:telegram-line"
|
|
||||||
class={inputBaseClasses}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label for="newContactInfo" class={labelBaseClasses}>Additional Info (Optional)</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="info"
|
|
||||||
id="newContactInfo"
|
|
||||||
placeholder="e.g., Available 24/7 or Response within 24h"
|
|
||||||
class={inputBaseClasses}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class={buttonPrimaryClasses}>Add Contact Method</button>
|
<button type="submit" class={buttonPrimaryClasses}>Add Contact Method</button>
|
||||||
</form>
|
</form>
|
||||||
</details>
|
</details>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const [user, allServices] = await Astro.locals.banners.tryMany([
|
|||||||
link: true,
|
link: true,
|
||||||
admin: true,
|
admin: true,
|
||||||
verified: true,
|
verified: true,
|
||||||
verifier: true,
|
moderator: true,
|
||||||
spammer: true,
|
spammer: true,
|
||||||
verifiedLink: true,
|
verifiedLink: true,
|
||||||
internalNotes: {
|
internalNotes: {
|
||||||
@@ -141,7 +141,7 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
<div class="mb-4 flex flex-wrap justify-center gap-2">
|
<div class="mb-4 flex flex-wrap justify-center gap-2">
|
||||||
{user.admin && <BadgeSmall color="green" text="Admin" icon="ri:shield-star-fill" />}
|
{user.admin && <BadgeSmall color="green" text="Admin" icon="ri:shield-star-fill" />}
|
||||||
{user.verified && <BadgeSmall color="cyan" text="Verified" icon="ri:verified-badge-fill" />}
|
{user.verified && <BadgeSmall color="cyan" text="Verified" icon="ri:verified-badge-fill" />}
|
||||||
{user.verifier && <BadgeSmall color="blue" text="Moderator" icon="ri:graduation-cap-fill" />}
|
{user.moderator && <BadgeSmall color="blue" text="Moderator" icon="ri:graduation-cap-fill" />}
|
||||||
{user.spammer && <BadgeSmall color="red" text="Spammer" icon="ri:alert-fill" />}
|
{user.spammer && <BadgeSmall color="red" text="Spammer" icon="ri:alert-fill" />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
label="Type"
|
label="Type"
|
||||||
options={[
|
options={[
|
||||||
{ label: 'Admin', value: 'admin', icon: 'ri:shield-star-fill' },
|
{ label: 'Admin', value: 'admin', icon: 'ri:shield-star-fill' },
|
||||||
{ label: 'Moderator', value: 'verifier', icon: 'ri:graduation-cap-fill' },
|
{ label: 'Moderator', value: 'moderator', icon: 'ri:graduation-cap-fill' },
|
||||||
{ label: 'Spammer', value: 'spammer', icon: 'ri:alert-fill' },
|
{ label: 'Spammer', value: 'spammer', icon: 'ri:alert-fill' },
|
||||||
{
|
{
|
||||||
label: 'Verified',
|
label: 'Verified',
|
||||||
@@ -239,7 +239,7 @@ if (!user) return Astro.rewrite('/404')
|
|||||||
selectedValue={[
|
selectedValue={[
|
||||||
user.admin ? 'admin' : null,
|
user.admin ? 'admin' : null,
|
||||||
user.verified ? 'verified' : null,
|
user.verified ? 'verified' : null,
|
||||||
user.verifier ? 'verifier' : null,
|
user.moderator ? 'moderator' : null,
|
||||||
user.spammer ? 'spammer' : null,
|
user.spammer ? 'spammer' : null,
|
||||||
].filter((v) => v !== null)}
|
].filter((v) => v !== null)}
|
||||||
required
|
required
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { zodParseQueryParamsStoringErrors } from '../../../lib/parseUrlFilters'
|
|||||||
import { pluralize } from '../../../lib/pluralize'
|
import { pluralize } from '../../../lib/pluralize'
|
||||||
import { prisma } from '../../../lib/prisma'
|
import { prisma } from '../../../lib/prisma'
|
||||||
import { formatDateShort } from '../../../lib/timeAgo'
|
import { formatDateShort } from '../../../lib/timeAgo'
|
||||||
|
import { urlWithParams } from '../../../lib/urls'
|
||||||
|
|
||||||
import type { Prisma } from '@prisma/client'
|
import type { Prisma } from '@prisma/client'
|
||||||
|
|
||||||
@@ -20,7 +21,7 @@ const { data: filters } = zodParseQueryParamsStoringErrors(
|
|||||||
'sort-by': z.enum(['name', 'role', 'createdAt', 'karma']).default('createdAt'),
|
'sort-by': z.enum(['name', 'role', 'createdAt', 'karma']).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(),
|
||||||
role: z.enum(['user', 'admin', 'verifier', 'verified', 'spammer']).optional(),
|
role: z.enum(['user', 'admin', 'moderator', 'verified', 'spammer']).optional(),
|
||||||
},
|
},
|
||||||
Astro
|
Astro
|
||||||
)
|
)
|
||||||
@@ -45,7 +46,7 @@ if (filters.role) {
|
|||||||
switch (filters.role) {
|
switch (filters.role) {
|
||||||
case 'user': {
|
case 'user': {
|
||||||
whereClause.admin = false
|
whereClause.admin = false
|
||||||
whereClause.verifier = false
|
whereClause.moderator = false
|
||||||
whereClause.verified = false
|
whereClause.verified = false
|
||||||
whereClause.spammer = false
|
whereClause.spammer = false
|
||||||
break
|
break
|
||||||
@@ -54,8 +55,8 @@ if (filters.role) {
|
|||||||
whereClause.admin = true
|
whereClause.admin = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'verifier': {
|
case 'moderator': {
|
||||||
whereClause.verifier = true
|
whereClause.moderator = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'verified': {
|
case 'verified': {
|
||||||
@@ -79,7 +80,7 @@ const dbUsers = await prisma.user.findMany({
|
|||||||
picture: true,
|
picture: true,
|
||||||
verified: true,
|
verified: true,
|
||||||
admin: true,
|
admin: true,
|
||||||
verifier: true,
|
moderator: true,
|
||||||
spammer: true,
|
spammer: true,
|
||||||
totalKarma: true,
|
totalKarma: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
@@ -106,14 +107,11 @@ const users =
|
|||||||
? lodashOrderBy(dbUsers, [(u) => (u.admin ? 'admin' : 'user')], [filters['sort-order']])
|
? lodashOrderBy(dbUsers, [(u) => (u.admin ? 'admin' : 'user')], [filters['sort-order']])
|
||||||
: dbUsers
|
: dbUsers
|
||||||
|
|
||||||
const makeSortUrl = (slug: NonNullable<(typeof filters)['sort-by']>) => {
|
const makeSortUrl = (sortBy: NonNullable<(typeof filters)['sort-by']>) => {
|
||||||
const currentSortBy = filters['sort-by']
|
return urlWithParams(Astro.url, {
|
||||||
const currentSortOrder = filters['sort-order']
|
'sort-by': sortBy,
|
||||||
const newSortOrder = currentSortBy === slug && currentSortOrder === 'asc' ? 'desc' : 'asc'
|
'sort-order': filters['sort-by'] === sortBy && filters['sort-order'] === 'asc' ? 'desc' : 'asc',
|
||||||
const searchParams = new URLSearchParams(Astro.url.search)
|
})
|
||||||
searchParams.set('sort-by', slug)
|
|
||||||
searchParams.set('sort-order', newSortOrder)
|
|
||||||
return `/admin/users?${searchParams.toString()}`
|
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -149,7 +147,7 @@ const makeSortUrl = (slug: NonNullable<(typeof filters)['sort-by']>) => {
|
|||||||
<option value="" selected={!filters.role}>All Users</option>
|
<option value="" selected={!filters.role}>All Users</option>
|
||||||
<option value="user" selected={filters.role === 'user'}>Regular Users</option>
|
<option value="user" selected={filters.role === 'user'}>Regular Users</option>
|
||||||
<option value="admin" selected={filters.role === 'admin'}>Admins</option>
|
<option value="admin" selected={filters.role === 'admin'}>Admins</option>
|
||||||
<option value="verifier" selected={filters.role === 'verifier'}>Verifiers</option>
|
<option value="moderator" selected={filters.role === 'moderator'}>Moderators</option>
|
||||||
<option value="verified" selected={filters.role === 'verified'}>Verified Users</option>
|
<option value="verified" selected={filters.role === 'verified'}>Verified Users</option>
|
||||||
<option value="spammer" selected={filters.role === 'spammer'}>Spammers</option>
|
<option value="spammer" selected={filters.role === 'spammer'}>Spammers</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -279,10 +277,10 @@ const makeSortUrl = (slug: NonNullable<(typeof filters)['sort-by']>) => {
|
|||||||
Verified
|
Verified
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{user.verifier && (
|
{user.moderator && (
|
||||||
<span class="inline-flex items-center gap-1 rounded-md bg-blue-900/30 px-2 py-0.5 text-xs font-medium text-blue-400">
|
<span class="inline-flex items-center gap-1 rounded-md bg-blue-900/30 px-2 py-0.5 text-xs font-medium text-blue-400">
|
||||||
<Icon name="ri:shield-check-fill" class="size-3.5" />
|
<Icon name="ri:shield-check-fill" class="size-3.5" />
|
||||||
Verifier
|
Moderator
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import Tooltip from '../../components/Tooltip.astro'
|
|||||||
import VerificationWarningBanner from '../../components/VerificationWarningBanner.astro'
|
import VerificationWarningBanner from '../../components/VerificationWarningBanner.astro'
|
||||||
import { getAttributeCategoryInfo } from '../../constants/attributeCategories'
|
import { getAttributeCategoryInfo } from '../../constants/attributeCategories'
|
||||||
import { getAttributeTypeInfo } from '../../constants/attributeTypes'
|
import { getAttributeTypeInfo } from '../../constants/attributeTypes'
|
||||||
|
import { formatContactMethod } from '../../constants/contactMethods'
|
||||||
import { currencies, getCurrencyInfo } from '../../constants/currencies'
|
import { currencies, getCurrencyInfo } from '../../constants/currencies'
|
||||||
import { getEventTypeInfo } from '../../constants/eventTypes'
|
import { getEventTypeInfo } from '../../constants/eventTypes'
|
||||||
import { getKycLevelInfo, kycLevels } from '../../constants/kycLevels'
|
import { getKycLevelInfo, kycLevels } from '../../constants/kycLevels'
|
||||||
@@ -37,7 +38,6 @@ import BaseLayout from '../../layouts/BaseLayout.astro'
|
|||||||
import { someButNotAll, undefinedIfEmpty } from '../../lib/arrays'
|
import { someButNotAll, undefinedIfEmpty } from '../../lib/arrays'
|
||||||
import { makeNonDbAttributes, sortAttributes } from '../../lib/attributes'
|
import { makeNonDbAttributes, sortAttributes } from '../../lib/attributes'
|
||||||
import { cn } from '../../lib/cn'
|
import { cn } from '../../lib/cn'
|
||||||
import { formatContactMethod } from '../../lib/contactMethods'
|
|
||||||
import { getOrCreateNotificationPreferences } from '../../lib/notificationPreferences'
|
import { getOrCreateNotificationPreferences } from '../../lib/notificationPreferences'
|
||||||
import { formatNumber, type FormatNumberOptions } from '../../lib/numbers'
|
import { formatNumber, type FormatNumberOptions } from '../../lib/numbers'
|
||||||
import { pluralize } from '../../lib/pluralize'
|
import { pluralize } from '../../lib/pluralize'
|
||||||
@@ -95,8 +95,8 @@ const [service, dbNotificationPreferences] = await Astro.locals.banners.tryMany(
|
|||||||
isRecentlyListed: true,
|
isRecentlyListed: true,
|
||||||
contactMethods: {
|
contactMethods: {
|
||||||
select: {
|
select: {
|
||||||
iconId: true,
|
|
||||||
value: true,
|
value: true,
|
||||||
|
label: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
attributes: {
|
attributes: {
|
||||||
@@ -379,20 +379,22 @@ const ogImageTemplateData = {
|
|||||||
service.contactMethods
|
service.contactMethods
|
||||||
.map((method) => ({
|
.map((method) => ({
|
||||||
...method,
|
...method,
|
||||||
...(formatContactMethod(method.value) ?? { type: 'unknown', formattedValue: method.value }),
|
info: formatContactMethod(method.value),
|
||||||
}))
|
}))
|
||||||
.map<ContactPoint | null>(({ type, formattedValue }) => {
|
.map<ContactPoint | null>(({ info, label }) => {
|
||||||
switch (type) {
|
switch (info.type) {
|
||||||
case 'telephone': {
|
case 'telephone': {
|
||||||
return {
|
return {
|
||||||
'@type': 'ContactPoint',
|
'@type': 'ContactPoint',
|
||||||
telephone: formattedValue,
|
telephone: info.formattedValue,
|
||||||
|
name: label ?? info.label,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 'email': {
|
case 'email': {
|
||||||
return {
|
return {
|
||||||
'@type': 'ContactPoint',
|
'@type': 'ContactPoint',
|
||||||
email: formattedValue,
|
email: info.formattedValue,
|
||||||
|
name: label ?? info.label,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -730,8 +732,8 @@ const ogImageTemplateData = {
|
|||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
class="text-day-300 hover:text-day-200 flex items-center gap-1 px-2 py-1 hover:underline"
|
class="text-day-300 hover:text-day-200 flex items-center gap-1 px-2 py-1 hover:underline"
|
||||||
>
|
>
|
||||||
<Icon name={method.iconId} class="text-day-200 h-5 w-5" />
|
<Icon name={methodInfo.icon} class="text-day-200 h-5 w-5" />
|
||||||
<span>{methodInfo?.formattedValue ?? method.value}</span>
|
<span>{method.label ?? methodInfo.formattedValue}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const user = await Astro.locals.banners.try('user', async () => {
|
|||||||
spammer: true,
|
spammer: true,
|
||||||
verified: true,
|
verified: true,
|
||||||
admin: true,
|
admin: true,
|
||||||
verifier: true,
|
moderator: true,
|
||||||
verifiedLink: true,
|
verifiedLink: true,
|
||||||
totalKarma: true,
|
totalKarma: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
@@ -208,7 +208,7 @@ const isCurrentUser = !!Astro.locals.user && user.id === Astro.locals.user.id
|
|||||||
sameAs: user.link ? [user.link] : undefined,
|
sameAs: user.link ? [user.link] : undefined,
|
||||||
description: `User profile page for ${user.displayName ?? user.name} on KYCnot.me`,
|
description: `User profile page for ${user.displayName ?? user.name} on KYCnot.me`,
|
||||||
identifier: [user.name, user.id.toString()],
|
identifier: [user.name, user.id.toString()],
|
||||||
jobTitle: user.admin ? 'Administrator' : user.verifier ? 'Moderator' : undefined,
|
jobTitle: user.admin ? 'Administrator' : user.moderator ? 'Moderator' : undefined,
|
||||||
memberOf: KYCNOTME_SCHEMA_MINI,
|
memberOf: KYCNOTME_SCHEMA_MINI,
|
||||||
interactionStatistic: [
|
interactionStatistic: [
|
||||||
{
|
{
|
||||||
@@ -281,9 +281,9 @@ const isCurrentUser = !!Astro.locals.user && user.id === Astro.locals.user.id
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
user.verifier && (
|
user.moderator && (
|
||||||
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
||||||
verifier
|
moderator
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -415,14 +415,14 @@ const isCurrentUser = !!Astro.locals.user && user.id === Astro.locals.user.id
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
user.verifier && (
|
user.moderator && (
|
||||||
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
<span class="rounded-full border border-green-500/50 bg-green-500/20 px-2 py-0.5 text-xs text-green-400">
|
||||||
Verifier
|
Moderator
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
!user.admin && !user.verified && !user.verifier && (
|
!user.admin && !user.verified && !user.moderator && (
|
||||||
<span class="border-day-700/50 bg-day-700/20 text-day-400 rounded-full border px-2 py-0.5 text-xs">
|
<span class="border-day-700/50 bg-day-700/20 text-day-400 rounded-full border px-2 py-0.5 text-xs">
|
||||||
Standard User
|
Standard User
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user