diff --git a/web/src/components/OgImage.tsx b/web/src/components/OgImage.tsx index 43f603d..c2ad7b7 100644 --- a/web/src/components/OgImage.tsx +++ b/web/src/components/OgImage.tsx @@ -9,6 +9,7 @@ import defaultOGImage from '../assets/ogimage.png' import { makeOverallScoreInfo } from '../lib/overallScore' import { urlWithParams } from '../lib/urls' +import type { VerificationStatus } from '@prisma/client' import type { APIContext } from 'astro' import type { Prettify } from 'ts-essentials' @@ -107,6 +108,7 @@ export const ogImageTemplates = { categories, score, imageUrl, + verificationStatus, }: { title: string description: string @@ -116,6 +118,7 @@ export const ogImageTemplates = { }[] score: number imageUrl: string | null + verificationStatus: VerificationStatus | null }, context ) => { @@ -272,6 +275,37 @@ export const ogImageTemplates = { > + {verificationStatus === 'VERIFICATION_FAILED' && ( +
+
+ SCAM +
+
+ )} ), defaultOptions diff --git a/web/src/components/ServiceLinkButton.astro b/web/src/components/ServiceLinkButton.astro index c24ac61..d7fcc38 100644 --- a/web/src/components/ServiceLinkButton.astro +++ b/web/src/components/ServiceLinkButton.astro @@ -7,13 +7,21 @@ import { cn } from '../lib/cn' import type { HTMLAttributes } from 'astro/types' -type Props = Omit, 'href' | 'rel' | 'target'> & { +type Props = Omit, 'href' | 'rel' | 'target'> & { url: string referral: string | null enableMinWidth?: boolean + isScam?: boolean } -const { url: baseUrl, referral, class: className, enableMinWidth = false, ...htmlProps } = Astro.props +const { + url: baseUrl, + referral, + class: className, + enableMinWidth = false, + isScam = false, + ...htmlProps +} = Astro.props function makeLink(url: string, referral: string | null) { const hostname = new URL(url).hostname @@ -124,28 +132,39 @@ const link = makeLink(baseUrl, referral) if (!z.string().url().safeParse(link.url).success) { console.error(`Invalid service URL with referral: ${link.url}`) } + +const Tag = isScam ? 'span' : 'a' --- - - + { link.textBits.map((textBit) => ( - {textBit.text} + {textBit.text} )) } - - + { + !isScam && ( + + ) + } + diff --git a/web/src/pages/service/[slug].astro b/web/src/pages/service/[slug].astro index 6d8de0f..ada5518 100644 --- a/web/src/pages/service/[slug].astro +++ b/web/src/pages/service/[slug].astro @@ -298,8 +298,6 @@ const statusIcon = { APPROVED: undefined, }[service.verificationStatus] -const isScam = service.verificationStatus === 'VERIFICATION_FAILED' - const shuffledLinks = { clearnet: shuffle(service.serviceUrls), onion: shuffle(service.onionUrls), @@ -416,6 +414,7 @@ const ogImageTemplateData = { categories: service.categories.map((category) => pick(category, ['name', 'icon'])), score: service.overallScore, imageUrl: service.imageUrl, + verificationStatus: service.verificationStatus, } satisfies OgImageAllTemplatesWithProps const serviceVisibilityInfo = getServiceVisibilityInfo(service.serviceVisibility) @@ -793,18 +792,12 @@ const sortedVerificationSteps = orderBy(
    {shownLinks.map((url) => (
  • - {isScam ? ( - - - {urlDomain(url)} - - ) : ( - 0} - /> - )} + 0} + isScam={service.verificationStatus === 'VERIFICATION_FAILED'} + />
  • ))} @@ -828,18 +821,12 @@ const sortedVerificationSteps = orderBy( {hiddenLinks.map((url) => ( ))}