Release 2025-05-22-SwZ1

This commit is contained in:
pluja
2025-05-22 23:07:55 +00:00
parent ecc8f67fc4
commit f4525e3d32
2 changed files with 11 additions and 16 deletions

View File

@@ -22,7 +22,7 @@ type Props = HTMLAttributes<'div'> & {
sortSeed?: string sortSeed?: string
filters: ServicesFiltersObject filters: ServicesFiltersObject
includeScams: boolean includeScams: boolean
countIfIncludingCommunity: number | null countCommunityOnly: number | null
inlineIcons?: boolean inlineIcons?: boolean
} }
@@ -36,7 +36,7 @@ const {
class: className, class: className,
filters, filters,
includeScams, includeScams,
countIfIncludingCommunity, countCommunityOnly,
inlineIcons, inlineIcons,
...divProps ...divProps
} = Astro.props } = Astro.props
@@ -59,8 +59,6 @@ const urlIfIncludingCommunity = urlWithParams(Astro.url, {
verificationStatusesByValue.COMMUNITY_CONTRIBUTED.slug, verificationStatusesByValue.COMMUNITY_CONTRIBUTED.slug,
]), ]),
}) })
const extraIfIncludingCommunity = Math.max(0, (countIfIncludingCommunity ?? 0) - (services?.length ?? 0))
--- ---
<div {...divProps} class={cn('flex-1', className)}> <div {...divProps} class={cn('flex-1', className)}>
@@ -77,12 +75,12 @@ const extraIfIncludingCommunity = Math.max(0, (countIfIncludingCommunity ?? 0) -
/> />
{ {
extraIfIncludingCommunity > 0 && ( countCommunityOnly && (
<> <>
<Button <Button
as="a" as="a"
href={urlIfIncludingCommunity} href={urlIfIncludingCommunity}
label={`Include +${extraIfIncludingCommunity.toLocaleString()} community contributed`} label={`Include +${countCommunityOnly.toLocaleString()} community contributed`}
size="sm" size="sm"
class="hidden lg:inline-flex" class="hidden lg:inline-flex"
icon="ri:search-line" icon="ri:search-line"
@@ -91,7 +89,7 @@ const extraIfIncludingCommunity = Math.max(0, (countIfIncludingCommunity ?? 0) -
<Button <Button
as="a" as="a"
href={urlIfIncludingCommunity} href={urlIfIncludingCommunity}
label={`Include +${extraIfIncludingCommunity.toLocaleString()}`} label={`Include +${countCommunityOnly.toLocaleString()}`}
size="sm" size="sm"
class="hidden sm:inline-flex lg:hidden" class="hidden sm:inline-flex lg:hidden"
icon="ri:search-line" icon="ri:search-line"
@@ -112,7 +110,7 @@ const extraIfIncludingCommunity = Math.max(0, (countIfIncludingCommunity ?? 0) -
is:inline={inlineIcons} is:inline={inlineIcons}
/> />
Include Include
{extraIfIncludingCommunity.toLocaleString()} {countCommunityOnly.toLocaleString()}
<Icon <Icon
name="ri:question-line" name="ri:question-line"
class="inline-block size-3.5 shrink-0 align-[-0.15em] text-yellow-200/50" class="inline-block size-3.5 shrink-0 align-[-0.15em] text-yellow-200/50"
@@ -198,11 +196,11 @@ const extraIfIncludingCommunity = Math.max(0, (countIfIncludingCommunity ?? 0) -
inlineIcon={inlineIcons} inlineIcon={inlineIcons}
/> />
)} )}
{extraIfIncludingCommunity > 0 && ( {countCommunityOnly && (
<Button <Button
as="a" as="a"
href={urlIfIncludingCommunity} href={urlIfIncludingCommunity}
label={`Show ${extraIfIncludingCommunity.toLocaleString()} community contributed`} label={`Show ${countCommunityOnly.toLocaleString()} community contributed`}
icon="ri:search-line" icon="ri:search-line"
inlineIcon={inlineIcons} inlineIcon={inlineIcons}
/> />

View File

@@ -310,7 +310,7 @@ const where = {
], ],
} as const satisfies Prisma.ServiceWhereInput } as const satisfies Prisma.ServiceWhereInput
const [categories, [services, totalServices], countIfIncludingCommunity, attributes] = const [categories, [services, totalServices], countCommunityOnly, attributes] =
await Astro.locals.banners.tryMany([ await Astro.locals.banners.tryMany([
[ [
'Unable to load category filters.', 'Unable to load category filters.',
@@ -416,10 +416,7 @@ const [categories, [services, totalServices], countIfIncludingCommunity, attribu
? prisma.service.count({ ? prisma.service.count({
where: { where: {
...where, ...where,
verificationStatus: { verificationStatus: 'COMMUNITY_CONTRIBUTED',
...where.verificationStatus,
in: uniq([...where.verificationStatus.in, 'COMMUNITY_CONTRIBUTED'] as const),
},
}, },
}) })
: null, : null,
@@ -707,7 +704,7 @@ const showFiltersId = 'show-filters'
sortSeed={filters['sort-seed']} sortSeed={filters['sort-seed']}
filters={filters} filters={filters}
includeScams={includeScams} includeScams={includeScams}
countIfIncludingCommunity={countIfIncludingCommunity} countCommunityOnly={countCommunityOnly}
inlineIcons inlineIcons
/> />
</div> </div>