From 45f63ff681525ee59dee4b4d53756ceef1435b02 Mon Sep 17 00:00:00 2001 From: Sacha Al Himdani Date: Tue, 23 Sep 2025 14:34:35 +0200 Subject: [PATCH] Display countries on trust center Signed-off-by: Sacha Al Himdani --- .../trustCenter/TrustCenterVendorsCard.tsx | 2 +- apps/console/src/hooks/useTrustCenterQueries.ts | 2 ++ .../components/PublicTrustCenterVendors.tsx | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/console/src/components/trustCenter/TrustCenterVendorsCard.tsx b/apps/console/src/components/trustCenter/TrustCenterVendorsCard.tsx index 8fc656d74..5384e2856 100644 --- a/apps/console/src/components/trustCenter/TrustCenterVendorsCard.tsx +++ b/apps/console/src/components/trustCenter/TrustCenterVendorsCard.tsx @@ -125,7 +125,7 @@ function VendorRow(props: { const { __ } = useTranslate(); return ( - +
{vendor.name} diff --git a/apps/console/src/hooks/useTrustCenterQueries.ts b/apps/console/src/hooks/useTrustCenterQueries.ts index e35bd5718..7bbd41a0b 100644 --- a/apps/console/src/hooks/useTrustCenterQueries.ts +++ b/apps/console/src/hooks/useTrustCenterQueries.ts @@ -1,6 +1,7 @@ import { useQuery, useMutation } from "@tanstack/react-query"; import { GraphQLError } from "graphql"; import { buildEndpoint } from "/providers/RelayProviders"; +import { type CountryCode } from "@probo/helpers"; export interface TrustCenterDocument { id: string; @@ -25,6 +26,7 @@ export interface TrustCenterVendor { category: string; privacyPolicyUrl?: string | null; websiteUrl?: string | null; + countries: CountryCode[]; } interface TrustCenterQueryData { diff --git a/apps/console/src/trust/components/PublicTrustCenterVendors.tsx b/apps/console/src/trust/components/PublicTrustCenterVendors.tsx index e8080bf8f..672aaee77 100644 --- a/apps/console/src/trust/components/PublicTrustCenterVendors.tsx +++ b/apps/console/src/trust/components/PublicTrustCenterVendors.tsx @@ -8,7 +8,7 @@ import { Th, } from "@probo/ui"; import { useTranslate } from "@probo/i18n"; -import { faviconUrl, sprintf } from "@probo/helpers"; +import { faviconUrl, sprintf, getCountryName, type CountryCode } from "@probo/helpers"; import type { TrustCenterVendor } from "../pages/PublicTrustCenterPage"; type Props = { @@ -19,6 +19,8 @@ type Props = { export function PublicTrustCenterVendors({ vendors, organizationName }: Props) { const { __ } = useTranslate(); + const hasCountriesData = vendors.some(vendor => vendor.countries && vendor.countries.length > 0); + if (vendors.length === 0) { return ( @@ -50,6 +52,7 @@ export function PublicTrustCenterVendors({ vendors, organizationName }: Props) { {__("Company")} {__("Website")} + {hasCountriesData && {__("Countries")}} @@ -66,6 +69,10 @@ export function PublicTrustCenterVendors({ vendors, organizationName }: Props) { } }; + const formatCountries = (countries: CountryCode[]) => { + return countries.map(code => getCountryName(__, code)).join(", "); + }; + return ( @@ -98,6 +105,13 @@ export function PublicTrustCenterVendors({ vendors, organizationName }: Props) { )} + {hasCountriesData && ( + + + {formatCountries(vendor.countries)} + + + )} ); })}