updates
This commit is contained in:
@@ -117,7 +117,6 @@ if (!user) return Astro.rewrite('/404')
|
||||
|
||||
<BaseLayout
|
||||
pageTitle={`User: ${user.name}`}
|
||||
htmx
|
||||
widthClassName="max-w-screen-lg"
|
||||
className={{ main: 'space-y-24' }}
|
||||
>
|
||||
@@ -140,9 +139,9 @@ if (!user) return Astro.rewrite('/404')
|
||||
</h1>
|
||||
|
||||
<div class="mb-4 flex flex-wrap justify-center gap-2">
|
||||
{user.admin && <BadgeSmall color="green" text="Admin" icon="ri:shield-check-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.verifier && <BadgeSmall color="blue" text="Verifier" icon="ri:check-fill" />}
|
||||
{user.verifier && <BadgeSmall color="blue" text="Moderator" icon="ri:graduation-cap-fill" />}
|
||||
{user.spammer && <BadgeSmall color="red" text="Spammer" icon="ri:alert-fill" />}
|
||||
</div>
|
||||
|
||||
@@ -172,7 +171,13 @@ if (!user) return Astro.rewrite('/404')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form method="POST" action={actions.admin.user.update} enctype="multipart/form-data" class="space-y-2">
|
||||
<form
|
||||
method="POST"
|
||||
action={actions.admin.user.update}
|
||||
enctype="multipart/form-data"
|
||||
class="space-y-2"
|
||||
data-astro-reload
|
||||
>
|
||||
<h2 class="font-title text-center text-3xl leading-none font-bold">Edit profile</h2>
|
||||
|
||||
<input type="hidden" name="id" value={user.id} />
|
||||
@@ -217,13 +222,19 @@ if (!user) return Astro.rewrite('/404')
|
||||
/>
|
||||
|
||||
<InputCardGroup
|
||||
name="role"
|
||||
label="Role"
|
||||
name="type"
|
||||
label="Type"
|
||||
options={[
|
||||
{ label: 'Admin', value: 'admin', icon: 'ri:shield-check-fill' },
|
||||
{ label: 'Verified', value: 'verified', icon: 'ri:verified-badge-fill', disabled: true },
|
||||
{ label: 'Verifier', value: 'verifier', icon: 'ri:check-fill' },
|
||||
{ label: 'Admin', value: 'admin', icon: 'ri:shield-star-fill' },
|
||||
{ label: 'Moderator', value: 'verifier', icon: 'ri:graduation-cap-fill' },
|
||||
{ label: 'Spammer', value: 'spammer', icon: 'ri:alert-fill' },
|
||||
{
|
||||
label: 'Verified',
|
||||
value: 'verified',
|
||||
icon: 'ri:verified-badge-fill',
|
||||
disabled: true,
|
||||
noTransitionPersist: true,
|
||||
},
|
||||
]}
|
||||
selectedValue={[
|
||||
user.admin ? 'admin' : null,
|
||||
@@ -235,7 +246,7 @@ if (!user) return Astro.rewrite('/404')
|
||||
cardSize="sm"
|
||||
iconSize="sm"
|
||||
multiple
|
||||
error={updateInputErrors.role}
|
||||
error={updateInputErrors.type}
|
||||
/>
|
||||
|
||||
<InputSubmitButton label="Save" icon="ri:save-line" hideCancel />
|
||||
@@ -280,7 +291,12 @@ if (!user) return Astro.rewrite('/404')
|
||||
<Icon name="ri:edit-line" class="size-5" />
|
||||
</label>
|
||||
|
||||
<form method="POST" action={actions.admin.user.internalNotes.delete} class="contents">
|
||||
<form
|
||||
method="POST"
|
||||
action={actions.admin.user.internalNotes.delete}
|
||||
class="contents"
|
||||
data-astro-reload
|
||||
>
|
||||
<input type="hidden" name="noteId" value={note.id} />
|
||||
<button type="submit" class="text-day-300 p-1 transition-colors hover:text-red-400">
|
||||
<Icon name="ri:delete-bin-line" class="size-5" />
|
||||
@@ -297,6 +313,7 @@ if (!user) return Astro.rewrite('/404')
|
||||
method="POST"
|
||||
action={actions.admin.user.internalNotes.update}
|
||||
data-note-edit-form
|
||||
data-astro-reload
|
||||
class="mt-4 hidden space-y-4"
|
||||
>
|
||||
<input type="hidden" name="noteId" value={note.id} />
|
||||
@@ -314,7 +331,12 @@ if (!user) return Astro.rewrite('/404')
|
||||
)
|
||||
}
|
||||
|
||||
<form method="POST" action={actions.admin.user.internalNotes.add} class="mt-10 space-y-2">
|
||||
<form
|
||||
method="POST"
|
||||
action={actions.admin.user.internalNotes.add}
|
||||
class="mt-10 space-y-2"
|
||||
data-astro-reload
|
||||
>
|
||||
<h3 class="font-title mb-0 text-center text-xl leading-none font-bold">Add Note</h3>
|
||||
|
||||
<input type="hidden" name="userId" value={user.id} />
|
||||
|
||||
@@ -10,6 +10,7 @@ import Pagination from '../components/Pagination.astro'
|
||||
import ServiceFiltersPill from '../components/ServiceFiltersPill.astro'
|
||||
import ServicesFilters from '../components/ServicesFilters.astro'
|
||||
import ServicesSearchResults from '../components/ServicesSearchResults.astro'
|
||||
import { getAttributeTypeInfo } from '../constants/attributeTypes'
|
||||
import {
|
||||
currencies,
|
||||
currenciesZodEnumBySlug,
|
||||
@@ -31,7 +32,7 @@ import { prisma } from '../lib/prisma'
|
||||
import { makeSortSeed } from '../lib/sortSeed'
|
||||
import { transformCase } from '../lib/strings'
|
||||
|
||||
import type { AttributeType, Prisma } from '@prisma/client'
|
||||
import type { Prisma } from '@prisma/client'
|
||||
|
||||
const MIN_CATEGORIES_TO_SHOW = 8
|
||||
const MIN_ATTRIBUTES_TO_SHOW = 8
|
||||
@@ -324,7 +325,10 @@ const [categories, [services, totalServices, hadToIncludeCommunityContributed]]
|
||||
})
|
||||
let hadToIncludeCommunityContributed = false
|
||||
|
||||
if (totalServices === 0 && !where.verificationStatus.in.includes('COMMUNITY_CONTRIBUTED')) {
|
||||
if (
|
||||
totalServices === 0 &&
|
||||
areEqualArraysWithoutOrder(where.verificationStatus.in, ['VERIFICATION_FAILED', 'APPROVED'])
|
||||
) {
|
||||
const [unsortedServiceCommunityServices, totalCommunityServices] =
|
||||
await prisma.service.findManyAndCount({
|
||||
where: {
|
||||
@@ -408,25 +412,6 @@ const [categories, [services, totalServices, hadToIncludeCommunityContributed]]
|
||||
],
|
||||
])
|
||||
|
||||
const attributeIcons = {
|
||||
GOOD: {
|
||||
icon: 'ri:check-line',
|
||||
iconClass: 'text-green-400',
|
||||
},
|
||||
BAD: {
|
||||
icon: 'ri:close-line',
|
||||
iconClass: 'text-red-400',
|
||||
},
|
||||
WARNING: {
|
||||
icon: 'ri:alert-line',
|
||||
iconClass: 'text-yellow-400',
|
||||
},
|
||||
INFO: {
|
||||
icon: 'ri:information-line',
|
||||
iconClass: 'text-blue-400',
|
||||
},
|
||||
} as const satisfies Record<AttributeType, { icon: string; iconClass: string }>
|
||||
|
||||
const attributes = await Astro.locals.banners.try(
|
||||
'Unable to load attribute filters.',
|
||||
() =>
|
||||
@@ -451,12 +436,14 @@ const attributes = await Astro.locals.banners.try(
|
||||
const attributesByCategory = orderBy(
|
||||
Object.entries(
|
||||
groupBy(
|
||||
attributes.map((attr) => ({
|
||||
...attr,
|
||||
...attributeIcons[attr.type],
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
value: filters.attr?.[attr.id] || undefined,
|
||||
})),
|
||||
attributes.map((attr) => {
|
||||
return {
|
||||
info: getAttributeTypeInfo(attr.type),
|
||||
...attr,
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
value: filters.attr?.[attr.id] || undefined,
|
||||
}
|
||||
}),
|
||||
'category'
|
||||
)
|
||||
).map(([category, attributes]) => ({
|
||||
@@ -533,7 +520,9 @@ const activeAnnouncements = await prisma.announcement.findMany({
|
||||
<AnnouncementBanner announcements={activeAnnouncements} />
|
||||
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:gap-8">
|
||||
<div class="flex items-stretch sm:hidden">
|
||||
<div
|
||||
class='[&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-offset-night-700 flex items-stretch sm:hidden [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-2 [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-green-500 [&:has(~_#show-filters:focus-visible)_[for="show-filters"]]:ring-offset-2'
|
||||
>
|
||||
{
|
||||
!hasDefaultFilters ? (
|
||||
<div class="-ml-4 flex flex-1 items-center gap-2 overflow-x-auto mask-r-from-[calc(100%-var(--spacing)*16)] pr-12 pl-4">
|
||||
@@ -656,11 +645,11 @@ const activeAnnouncements = await prisma.announcement.findMany({
|
||||
type="checkbox"
|
||||
id="show-filters"
|
||||
name="show-filters"
|
||||
class="peer hidden"
|
||||
class="peer sr-only sm:hidden"
|
||||
checked={Astro.url.searchParams.has('show-filters')}
|
||||
/>
|
||||
<div
|
||||
class="bg-night-700 fixed top-0 left-0 z-50 h-dvh w-dvw shrink-0 translate-y-full overflow-y-auto overscroll-contain border-t border-green-500/30 px-8 pt-4 transition-transform peer-checked:translate-y-0 sm:relative sm:z-auto sm:h-auto sm:w-64 sm:translate-y-0 sm:overflow-visible sm:border-none sm:bg-none sm:p-0"
|
||||
class="bg-night-700 fixed top-0 left-0 z-50 hidden h-dvh w-dvw shrink-0 translate-y-full overflow-y-auto overscroll-contain border-t border-green-500/30 px-8 pt-4 transition-transform peer-checked:translate-y-0 max-sm:peer-checked:block sm:relative sm:z-auto sm:block sm:h-auto sm:w-64 sm:translate-y-0 sm:overflow-visible sm:border-none sm:bg-none sm:p-0"
|
||||
>
|
||||
<ServicesFilters
|
||||
searchResultsId="search-results"
|
||||
|
||||
@@ -693,10 +693,15 @@ const ogImageTemplateData = {
|
||||
</li>
|
||||
))}
|
||||
|
||||
<input type="checkbox" class="peer hidden" id="show-more-links" checked={hiddenLinks.length === 0} />
|
||||
<input
|
||||
type="checkbox"
|
||||
class="peer sr-only checked:hidden"
|
||||
id="show-more-links"
|
||||
checked={hiddenLinks.length === 0}
|
||||
/>
|
||||
|
||||
{hiddenLinks.length > 0 && (
|
||||
<li class="peer-checked:hidden">
|
||||
<li class="peer-focus-visible:ring-offset-night-700 rounded-full peer-checked:hidden peer-focus-visible:ring-4 peer-focus-visible:ring-orange-500 peer-focus-visible:ring-offset-2">
|
||||
<label
|
||||
for="show-more-links"
|
||||
class="2xs:text-sm 2xs:h-8 2xs:gap-2 2xs:px-4 text-day-100 bg-day-800 hover:bg-day-900 inline-flex h-6 cursor-pointer items-center gap-1 rounded-full px-2 text-xs whitespace-nowrap transition-colors duration-200"
|
||||
|
||||
Reference in New Issue
Block a user