diff --git a/explorer/src/enums/queryParams.ts b/explorer/src/enums/queryParams.ts index 597ed184..6034791d 100644 --- a/explorer/src/enums/queryParams.ts +++ b/explorer/src/enums/queryParams.ts @@ -3,4 +3,5 @@ export enum EQueryParams { SORT_BY_DATE = "sort_by_date", SEARCH_QUERY = "search_query", ITEMS_PER_PAGE = "page_size", + WHERE = "where", } diff --git a/explorer/src/pages/Attestations/index.tsx b/explorer/src/pages/Attestations/index.tsx index ac775987..4b24962d 100644 --- a/explorer/src/pages/Attestations/index.tsx +++ b/explorer/src/pages/Attestations/index.tsx @@ -1,4 +1,4 @@ -import { OrderDirection } from "@verax-attestation-registry/verax-sdk/lib/types/.graphclient"; +import { Attestation_filter, OrderDirection } from "@verax-attestation-registry/verax-sdk/lib/types/.graphclient"; import { useRef, useState } from "react"; import { useSearchParams } from "react-router-dom"; import useSWR from "swr"; @@ -23,6 +23,7 @@ export const Attestations: React.FC = () => { network: { chain }, } = useNetworkContext(); + //TODO: implement counter logic for where clause. const { data: attestationsCount } = useSWR( `${SWRKeys.GET_ATTESTATION_COUNT}/${chain.id}`, () => sdk.attestation.getAttestationIdCounter() as Promise, @@ -34,6 +35,9 @@ export const Attestations: React.FC = () => { const page = pageBySearchParams(searchParams, totalItems); const sortByDateDirection = searchParams.get(EQueryParams.SORT_BY_DATE); const itemsPerPage = Number(searchParams.get(EQueryParams.ITEMS_PER_PAGE)) || ITEMS_PER_PAGE_DEFAULT; + const where = searchParams.get(EQueryParams.WHERE) + ? (JSON.parse(searchParams.get(EQueryParams.WHERE) ?? "") as Attestation_filter) + : undefined; const [skip, setSkip] = useState(getItemsByPage(page, itemsPerPage)); @@ -43,7 +47,7 @@ export const Attestations: React.FC = () => { sdk.attestation.findBy( itemsPerPage, skip, - undefined, + where, "attestedDate", (sortByDateDirection as OrderDirection) || ETableSorting.DESC, ), diff --git a/explorer/src/pages/Home/data.tsx b/explorer/src/pages/Home/data.tsx index 38c671c4..86b57c88 100644 --- a/explorer/src/pages/Home/data.tsx +++ b/explorer/src/pages/Home/data.tsx @@ -34,6 +34,64 @@ export const issuersData: IIssuer[] = [ "https://trustgo.trustalabs.ai/etrusta/0x085ed975a8b6b860de3c2b871da60a3f9f48a5b8/lineaverax/h?f=linea&chainId=324", CTATitle: "Go To Trusta Labs", address: "0x9e728394E55e6535BF66f913e911Ae1f572D8db0", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Gitcoin Passport", @@ -44,6 +102,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://passport.gitcoin.co/#/dashboard/verax", CTATitle: "Get your passport", address: "0x96DB2c6D93A8a12089f7a6EdA5464e967308AdEd", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "PADO Labs", @@ -55,6 +123,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://www.padolabs.org/events", CTATitle: "Go to pado", address: "0xDB736B13E2f522dBE18B2015d0291E4b193D8eF6", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "zkPass", @@ -66,6 +144,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://verax.zkpass.org/verax", CTATitle: "Go To zkPass", address: "0x182085Ce8b0faDdc8503D9921dF6Af076281A6A9", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Openid3", @@ -75,6 +163,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://auth.openid3.xyz", CTATitle: "Go to openid3", address: "0xdbCaf063873dC6be53c007Cf8f8447E303Cac8A3", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Nomis", @@ -85,6 +183,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://nomis.cc/linea-voyage", CTATitle: "Go To Nomis", address: "0x8535156C75750d79ee0D9829c5D4Ae6f5D9DbCB5", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Orange Protocol", @@ -95,6 +203,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://www.orangeprotocol.io/", CTATitle: "Go to orange", address: "0x3176383A7590D6B5c6F6268209f4c7FDeb7244Dc", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "0xScore", @@ -105,6 +223,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://0xscore.pro/linea-attestation", CTATitle: "Go To 0xScore", address: "0x04636DdD2feF7e9DB42a24821E489AD071749fEA", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Aspecta", @@ -115,6 +243,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://aspecta.id/campaign/builders-voyage", CTATitle: "Go To Aspecta", address: "0x36933bd4288648d95a8275e663003ae7efd2199d", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Automata Network", @@ -125,6 +263,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://pom.ata.network", CTATitle: "Go To Automata", address: "0x95d06B395F04dc1bBD0CE9fcC501D7044ea25DAd", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Reclaim Protocol", @@ -135,6 +283,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://publish-credentials.reclaimprotocol.org/create-credential", CTATitle: "Go To Reclaim Protocol", address: "0xc15718EEC68DbCA02C4B4215B87beef46C3106d5", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "RubyScore", @@ -145,6 +303,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://rubyscore.io/attestation", CTATitle: "Go To RubyScore", address: "0xb9cc0bb020cf55197c4c3d826ac87cadba51f272", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Zeronym by Holonym", @@ -155,6 +323,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://holonym.id/", CTATitle: "Go To Holonym", address: "0xdca2e9ae8423d7b0f94d7f9fc09e698a45f3c851", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Hapi", @@ -165,6 +343,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://hapi.one", CTATitle: "Go To Hapi", address: "0x62773b3217e066a9a4ebd98db4360d89671453df", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Okapi", @@ -176,6 +364,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://www.okapi.xyz", CTATitle: "Go To Okapi", address: "0xab3fa8a72eb66a128e8a84baa8c9578180806c6f", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Index Network", @@ -187,6 +385,16 @@ export const issuersData: IIssuer[] = [ CTALink: "https://index.network/", CTATitle: "Go To Index Network", address: "0x0000000000000000000000000000000000000000", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, { name: "Privado ID", @@ -198,5 +406,15 @@ export const issuersData: IIssuer[] = [ CTALink: "https://www.privado.id/", CTATitle: "Go To Privado ID", address: "0x80203136fae3111b810106baa500231d4fd08fc6", + attestationDefinitions: [ + { + name: "OKX KYC", + logo: Trusta, + description: "Attest you have completed your KYC on OKX with a zero-knowledge proof", + portal: "0x3b30d7c4e5aa3d7da11431af23e8d1f7d25bb0b8", + schema: "0xc0980771b02c57e851f0ecca619d593de82dc84b25db9c9273bbf5b1537276ae", + url: "https://google.com", + }, + ], }, ]; diff --git a/explorer/src/pages/Home/interface.ts b/explorer/src/pages/Home/interface.ts index 04769790..d4e0d41e 100644 --- a/explorer/src/pages/Home/interface.ts +++ b/explorer/src/pages/Home/interface.ts @@ -9,4 +9,14 @@ export interface IIssuer { CTALink?: string; CTATitle: string; description: string; + attestationDefinitions: AttestationDefinition[]; +} + +export interface AttestationDefinition { + logo: React.FC>; + name: string; + description: string; + portal: Address; + schema: Address; + url: string; } diff --git a/explorer/src/pages/Issuer/components/Attestations/index.tsx b/explorer/src/pages/Issuer/components/Attestations/index.tsx new file mode 100644 index 00000000..0a4e658e --- /dev/null +++ b/explorer/src/pages/Issuer/components/Attestations/index.tsx @@ -0,0 +1,48 @@ +import { useLocation, useNavigate } from "react-router-dom"; +import useSWR from "swr"; + +import { SWRKeys } from "@/interfaces/swr/enum"; +import { useNetworkContext } from "@/providers/network-provider/context"; +import { APP_ROUTES, CHAIN_ID_ROUTE } from "@/routes/constants"; +import { formatNumber } from "@/utils/amountUtils"; + +import { IAttestationProps } from "./interface"; + +export const Attestations: React.FC = ({ address }) => { + const { + sdk, + network: { network }, + } = useNetworkContext(); + const navigate = useNavigate(); + const location = useLocation(); + + const { data: portals } = useSWR(`${SWRKeys.GET_PORTALS_BY_ISSUER}/${address}`, () => + sdk.portal.findBy(undefined, undefined, { ownerAddress: address }), + ); + + const attestationCounter = portals ? portals.reduce((total, portal) => total + portal.attestationCounter, 0) : 0; + + const handleAttestationCounterClick = () => { + const whereClauseJSON = { + portal_in: portals?.map((portal) => portal.id), + }; + const whereClause = `?where=${encodeURIComponent(JSON.stringify(whereClauseJSON))}`; + navigate(APP_ROUTES.ATTESTATIONS.replace(CHAIN_ID_ROUTE, network) + whereClause, { + state: { from: location.pathname }, + }); + }; + + return ( +
+
+ Attestations +
+ {formatNumber(attestationCounter)} +
+
+
+ ); +}; diff --git a/explorer/src/pages/Issuer/components/Attestations/interface.ts b/explorer/src/pages/Issuer/components/Attestations/interface.ts new file mode 100644 index 00000000..d2231420 --- /dev/null +++ b/explorer/src/pages/Issuer/components/Attestations/interface.ts @@ -0,0 +1,5 @@ +import { Address } from "viem"; + +export interface IAttestationProps { + address: Address; +} diff --git a/explorer/src/pages/Issuer/components/Banner/index.tsx b/explorer/src/pages/Issuer/components/Banner/index.tsx index f037de06..e98f8ad3 100644 --- a/explorer/src/pages/Issuer/components/Banner/index.tsx +++ b/explorer/src/pages/Issuer/components/Banner/index.tsx @@ -1,31 +1,38 @@ import { ArrowUpRight } from "lucide-react"; -import issuerBG from "@/assets/backgrounds/issuer-bg.jpeg"; import { Button } from "@/components/Buttons"; import { EButtonType } from "@/components/Buttons/enum"; +import { Chips } from "@/components/Chips"; import { IBannerProps } from "./interface"; -export const Banner: React.FC = ({ name, CTALink, CTATitle, logo }) => { +export const Banner: React.FC = ({ name, CTALink, CTATitle, logo, keywords }) => { const IssuerLogo = logo; - return ( -
- issuer background -
- -
- {name} +
+
+
+
+
+ +
+
{name}
+ {CTALink && ( +
+
+ {keywords.map((keyword) => ( + + ))}
- {CTALink && ( -
); }; diff --git a/explorer/src/pages/Issuer/components/Banner/interface.ts b/explorer/src/pages/Issuer/components/Banner/interface.ts index 08527188..df89a91c 100644 --- a/explorer/src/pages/Issuer/components/Banner/interface.ts +++ b/explorer/src/pages/Issuer/components/Banner/interface.ts @@ -3,4 +3,5 @@ export interface IBannerProps { logo: React.FC>; CTALink?: string; CTATitle: string; + keywords: string[]; } diff --git a/explorer/src/pages/Issuer/components/Description/index.tsx b/explorer/src/pages/Issuer/components/Description/index.tsx index 6c1a7bee..8409559a 100644 --- a/explorer/src/pages/Issuer/components/Description/index.tsx +++ b/explorer/src/pages/Issuer/components/Description/index.tsx @@ -1,15 +1,8 @@ -import { Chips } from "@/components/Chips"; - import { IDescriptionProps } from "./interface"; -export const Description: React.FC = ({ description, keywords }) => { +export const Description: React.FC = ({ description }) => { return ( -
-
- {keywords.map((keyword) => ( - - ))} -
+
{/* TODO: uncomment when data will be available */} {/*
@@ -21,7 +14,8 @@ export const Description: React.FC = ({ description, keywords
Schemas
*/} -
{description}
+
Info
+
{description}
); }; diff --git a/explorer/src/pages/Issuer/components/Description/interface.ts b/explorer/src/pages/Issuer/components/Description/interface.ts index 22b1b453..de070a7a 100644 --- a/explorer/src/pages/Issuer/components/Description/interface.ts +++ b/explorer/src/pages/Issuer/components/Description/interface.ts @@ -1,4 +1,3 @@ export interface IDescriptionProps { description: string; - keywords: string[]; } diff --git a/explorer/src/pages/Issuer/components/Portals/index.tsx b/explorer/src/pages/Issuer/components/Portals/index.tsx index 6977de55..a65ffe51 100644 --- a/explorer/src/pages/Issuer/components/Portals/index.tsx +++ b/explorer/src/pages/Issuer/components/Portals/index.tsx @@ -5,7 +5,6 @@ import useSWR from "swr"; import { Button } from "@/components/Buttons"; import { EButtonType } from "@/components/Buttons/enum"; -import { HelperIndicator } from "@/components/HelperIndicator"; import { SWRKeys } from "@/interfaces/swr/enum"; import { useNetworkContext } from "@/providers/network-provider/context"; import { CHAIN_ID_ROUTE, toPortalById } from "@/routes/constants"; @@ -27,55 +26,44 @@ export const Portals: React.FC = ({ address }) => { if (!portals) return null; return ( -
-
- {t("issuer.portals.title")} -
-
- {portals.map(({ ownerAddress, description, id, isRevocable, name }) => { - const additionalInfo = [ - { - title: t("common.id"), - value: id, - }, - { - title: t("issuer.portals.ownerAddress"), - value: ownerAddress, - }, - { - title: t("common.revocable"), - value: isRevocable ? t("common.yes") : t("common.no"), - }, - ]; - - return ( -
-
{name}
-
{description}
- {additionalInfo.map((info) => ( -
-
- {info.title} -
-
- {info.value} -
-
- ))} -
- ); - })} +
+
{t("issuer.portals.title")}
+
+ + + + + + + + + + {portals.map(({ id, name, description, attestationCounter }) => ( + + + + + + ))} + +
+ Name + + Description + + Attestations +
+ {description}{attestationCounter}
); diff --git a/explorer/src/pages/Issuer/components/Schemas/index.tsx b/explorer/src/pages/Issuer/components/Schemas/index.tsx new file mode 100644 index 00000000..84f9cd82 --- /dev/null +++ b/explorer/src/pages/Issuer/components/Schemas/index.tsx @@ -0,0 +1,57 @@ +import { ArrowRight, ArrowUpRight } from "lucide-react"; +import { useLocation, useNavigate } from "react-router-dom"; + +import { Button } from "@/components/Buttons"; +import { EButtonType } from "@/components/Buttons/enum"; +import { useNetworkContext } from "@/providers/network-provider/context"; +import { APP_ROUTES, CHAIN_ID_ROUTE } from "@/routes/constants"; + +import { ISchemasProps } from "./interface"; + +export const Schemas: React.FC = ({ issuerSchemas }) => { + const { + network: { network }, + } = useNetworkContext(); + const navigate = useNavigate(); + const location = useLocation(); + + if (issuerSchemas === undefined || issuerSchemas.length === 0) return null; + + const handleSeeAttestationsClick = (portal: string, schema: string) => { + const whereClauseJSON = { portal: portal, schemaId: schema }; + const whereClause = `?where=${encodeURIComponent(JSON.stringify(whereClauseJSON))}`; + navigate(APP_ROUTES.ATTESTATIONS.replace(CHAIN_ID_ROUTE, network) + whereClause, { + state: { from: location.pathname }, + }); + }; + + return ( +
+ {issuerSchemas.map((issuerSchema) => ( +
+
+ + {issuerSchema.name} +
+
{issuerSchema.description}
+
+
+
+ ))} +
+ ); +}; diff --git a/explorer/src/pages/Issuer/components/Schemas/interface.ts b/explorer/src/pages/Issuer/components/Schemas/interface.ts new file mode 100644 index 00000000..d02a564c --- /dev/null +++ b/explorer/src/pages/Issuer/components/Schemas/interface.ts @@ -0,0 +1,6 @@ +import { AttestationDefinition } from "@/pages/Home/interface"; + +export interface ISchemasProps { + issuerSchemas?: AttestationDefinition[]; + CTALink?: string; +} diff --git a/explorer/src/pages/Issuer/index.tsx b/explorer/src/pages/Issuer/index.tsx index 5e9b95e8..028bc6ae 100644 --- a/explorer/src/pages/Issuer/index.tsx +++ b/explorer/src/pages/Issuer/index.tsx @@ -2,9 +2,10 @@ import { useLocation, useNavigate, useParams } from "react-router-dom"; import { APP_ROUTES } from "@/routes/constants"; +import { Attestations } from "./components/Attestations"; import { Banner } from "./components/Banner"; import { Description } from "./components/Description"; -import { Portals } from "./components/Portals"; +import { Schemas } from "./components/Schemas"; import { issuersData } from "../Home/data"; export const Issuer: React.FC = () => { @@ -12,7 +13,7 @@ export const Issuer: React.FC = () => { const navigate = useNavigate(); const location = useLocation(); - const { name, description, CTALink, CTATitle, logo, keywords, address } = + const { name, description, CTALink, CTATitle, logo, keywords, address, attestationDefinitions } = issuersData.find((issuer) => issuer.address === id) || {}; if (!name || !description || !logo || !keywords || !address || !CTATitle) { @@ -22,9 +23,11 @@ export const Issuer: React.FC = () => { return (
- - - + + + + + {/* */}
); }; diff --git a/explorer/src/utils/amountUtils.ts b/explorer/src/utils/amountUtils.ts index 68317e29..d0a972e1 100644 --- a/explorer/src/utils/amountUtils.ts +++ b/explorer/src/utils/amountUtils.ts @@ -4,3 +4,13 @@ export const displayAmountWithComma = (str: string | number): string => .replace(/\B(?=(\d{3})+(?!\d))/g, ","); export const randomNumber = (min: number, max: number) => Math.floor(Math.random() * (max - min) + min); + +export const formatNumber = (num: number): string => { + if (num >= 1_000_000) { + return (num / 1_000_000).toFixed(1).replace(/\.0$/, "") + "M"; + } + if (num >= 1_000) { + return (num / 1_000).toFixed(1).replace(/\.0$/, "") + "K"; + } + return num.toString(); +};