--- import { Icon } from 'astro-icon/components' import { uniq } from 'lodash-es' import { verificationStatusesByValue } from '../constants/verificationStatus' import { cn } from '../lib/cn' import { pluralize } from '../lib/pluralize' import { createPageUrl, urlWithParams } from '../lib/urls' import Button from './Button.astro' import ServiceCard from './ServiceCard.astro' import type { ServicesFiltersObject } from '../pages/index.astro' import type { ComponentProps, HTMLAttributes } from 'astro/types' type Props = HTMLAttributes<'div'> & { hasDefaultFilters?: boolean services: ComponentProps['service'][] | undefined currentPage?: number total: number pageSize: number sortSeed?: string filters: ServicesFiltersObject includeScams: boolean countCommunityOnly: number | null inlineIcons?: boolean } const { services, hasDefaultFilters = false, currentPage = 1, total, pageSize, sortSeed, class: className, filters, includeScams, countCommunityOnly, inlineIcons, ...divProps } = Astro.props const hasScams = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing filters.verification.includes('VERIFICATION_FAILED') || includeScams const hasSomeScam = !!services?.some((service) => service.verificationStatus.includes('VERIFICATION_FAILED')) const hasCommunityContributed = filters.verification.includes('COMMUNITY_CONTRIBUTED') const hasSomeCommunityContributed = !!services?.some((service) => service.verificationStatus.includes('COMMUNITY_CONTRIBUTED') ) const totalPages = Math.ceil(total / pageSize) || 1 const urlIfIncludingCommunity = urlWithParams(Astro.url, { verification: uniq([ ...filters.verification.map((v) => verificationStatusesByValue[v].slug), verificationStatusesByValue.COMMUNITY_CONTRIBUTED.slug, ]), }) ---
{total.toLocaleString()} {pluralize('result', total)} { countCommunityOnly && ( <>
{ hasScams && hasCommunityContributed && (
Results {hasSomeScam || hasSomeCommunityContributed ? 'include' : 'may include'} SCAMs or community-contributed services.
) } { hasScams && !hasCommunityContributed && (
Results {hasSomeScam ? 'include' : 'may include'} SCAM services
) } { !hasScams && hasCommunityContributed && (
Results {hasSomeCommunityContributed ? 'include' : 'may include'} unverified community-contributed services, some might be scams.
) } { !services || services.length === 0 ? (

No services found

Try adjusting your filters to find more services

{!hasDefaultFilters && (
) : ( <>
{services.map((service, i) => ( ))}
Loading more services...
) } { services && services.length > 0 && (
) }