Release 202506011511

This commit is contained in:
pluja
2025-06-01 15:11:37 +00:00
parent e17bc8a521
commit 490433b002
6 changed files with 60 additions and 15 deletions

View File

@@ -157,12 +157,6 @@ export const adminServiceActions = {
})
}
const imageUrl = input.removeImage
? null
: input.imageFile
? await saveFileLocally(input.imageFile, input.imageFile.name)
: undefined
const existingService = await prisma.service.findUnique({
where: { id: input.id },
select: {
@@ -201,6 +195,12 @@ export const adminServiceActions = {
const attributesToAdd = input.attributes.filter((aId) => !existingAttributeIds.includes(aId))
const attributesToRemove = existingAttributeIds.filter((aId) => !input.attributes.includes(aId))
const imageUrl = input.removeImage
? null
: input.imageFile
? await saveFileLocally(input.imageFile, input.imageFile.name)
: undefined
const {
web: serviceUrls,
onion: onionUrls,

View File

@@ -271,6 +271,7 @@ if (toggleResult?.error) {
label: type.label,
value: type.value,
icon: type.icon,
noTransitionPersist: false,
}))}
cardSize="sm"
required
@@ -305,8 +306,8 @@ if (toggleResult?.error) {
label="Status"
error={createInputErrors.isActive}
options={[
{ label: 'Active', value: 'true' },
{ label: 'Inactive', value: 'false' },
{ label: 'Active', value: 'true', noTransitionPersist: true },
{ label: 'Inactive', value: 'false', noTransitionPersist: true },
]}
selectedValue={newAnnouncement.isActive ? 'true' : 'false'}
cardSize="sm"
@@ -627,6 +628,7 @@ if (toggleResult?.error) {
label: type.label,
value: type.value,
icon: type.icon,
noTransitionPersist: true,
}))}
cardSize="sm"
required
@@ -659,8 +661,8 @@ if (toggleResult?.error) {
name="isActive"
label="Status"
options={[
{ label: 'Active', value: 'true' },
{ label: 'Inactive', value: 'false' },
{ label: 'Active', value: 'true', noTransitionPersist: true },
{ label: 'Inactive', value: 'false', noTransitionPersist: true },
]}
selectedValue={announcement.isActive ? 'true' : 'false'}
cardSize="sm"

View File

@@ -406,6 +406,7 @@ const apiCalls = await Astro.locals.banners.try(
value: kycLevel.id.toString(),
icon: kycLevel.icon,
description: kycLevel.description,
noTransitionPersist: true,
}))}
selectedValue={service.kycLevel.toString()}
iconSize="md"
@@ -423,6 +424,7 @@ const apiCalls = await Astro.locals.banners.try(
icon: status.icon,
iconClass: status.classNames.icon,
description: status.description,
noTransitionPersist: true,
}))}
selectedValue={service.verificationStatus}
error={serviceInputErrors.verificationStatus}
@@ -438,6 +440,7 @@ const apiCalls = await Astro.locals.banners.try(
label: currency.name,
value: currency.id,
icon: currency.icon,
noTransitionPersist: true,
}))}
selectedValue={service.acceptedCurrencies}
error={serviceInputErrors.acceptedCurrencies}
@@ -478,6 +481,7 @@ const apiCalls = await Astro.locals.banners.try(
icon: visibility.icon,
iconClass: visibility.iconClass,
description: visibility.description,
noTransitionPersist: true,
}))}
selectedValue={service.serviceVisibility}
error={serviceInputErrors.serviceVisibility}

View File

@@ -226,9 +226,24 @@ if (!user) return Astro.rewrite('/404')
name="type"
label="Type"
options={[
{ label: 'Admin', value: 'admin', icon: 'ri:shield-star-fill' },
{ label: 'Moderator', value: 'moderator', icon: 'ri:graduation-cap-fill' },
{ label: 'Spammer', value: 'spammer', icon: 'ri:alert-fill' },
{
label: 'Admin',
value: 'admin',
icon: 'ri:shield-star-fill',
noTransitionPersist: true,
},
{
label: 'Moderator',
value: 'moderator',
icon: 'ri:graduation-cap-fill',
noTransitionPersist: true,
},
{
label: 'Spammer',
value: 'spammer',
icon: 'ri:alert-fill',
noTransitionPersist: true,
},
{
label: 'Verified',
value: 'verified',
@@ -419,6 +434,7 @@ if (!user) return Astro.rewrite('/404')
label: role.label,
value: role.value,
icon: role.icon,
noTransitionPersist: true,
}))}
required
cardSize="sm"

View File

@@ -13,6 +13,7 @@ import {
getEventTypeInfo,
getEventTypeInfoBySlug,
} from '../constants/eventTypes'
import { getServiceVisibilityInfo } from '../constants/serviceVisibility'
import { getVerificationStatusInfo } from '../constants/verificationStatus'
import BaseLayout from '../layouts/BaseLayout.astro'
import { cn } from '../lib/cn'
@@ -44,6 +45,8 @@ const [services, [dbEvents, totalEvents]] = await Astro.locals.banners.tryMany([
async () =>
prisma.service.findMany({
where: {
listedAt: { lte: new Date() },
serviceVisibility: { in: ['PUBLIC', 'ARCHIVED'] },
events: {
some: {
visible: true,
@@ -72,8 +75,15 @@ const [services, [dbEvents, totalEvents]] = await Astro.locals.banners.tryMany([
createdAt: {
lte: params.now,
},
...(params.service ? { service: { slug: params.service } } : {}),
...(params.type ? { type: getEventTypeInfoBySlug(params.type).id } : {}),
service: {
slug: params.service ?? undefined,
listedAt: params.service ? undefined : { lte: new Date() },
serviceVisibility: {
in: params.service ? ['PUBLIC', 'ARCHIVED', 'UNLISTED'] : ['PUBLIC', 'ARCHIVED'],
},
},
type: params.type ? getEventTypeInfoBySlug(params.type).id : undefined,
...(params.from || params.to
? {
OR: [
@@ -105,6 +115,7 @@ const [services, [dbEvents, totalEvents]] = await Astro.locals.banners.tryMany([
name: true,
imageUrl: true,
verificationStatus: true,
serviceVisibility: true,
},
},
},
@@ -126,6 +137,7 @@ const events = orderBy(
service: {
...event.service,
verificationStatusInfo: getVerificationStatusInfo(event.service.verificationStatus),
serviceVisibilityInfo: getServiceVisibilityInfo(event.service.serviceVisibility),
},
})),
['actualEndedAt', 'startedAt'],
@@ -416,6 +428,16 @@ const createUrlWithoutFilter = (paramName: keyof typeof params) => {
)}
/>
)}
{event.service.serviceVisibility === 'ARCHIVED' && (
<Icon
name={event.service.serviceVisibilityInfo.icon}
class={cn(
'ms-1 inline-block size-3 shrink-0',
event.service.serviceVisibilityInfo.iconClass
)}
/>
)}
</a>
{event.source && (

View File

@@ -182,6 +182,7 @@ const {
'min-score': { if: 'default' },
'user-rating': { if: 'default' },
'max-kyc': { if: 'default' },
'sort-seed': { if: 'another-is-unset', prop: 'page' },
},
},
}