diff --git a/explorer/src/interfaces/swr/enum.ts b/explorer/src/interfaces/swr/enum.ts index abf8bc93..d4f90aad 100644 --- a/explorer/src/interfaces/swr/enum.ts +++ b/explorer/src/interfaces/swr/enum.ts @@ -6,13 +6,13 @@ export enum SWRKeys { GET_RELATED_ATTESTATION = "getRelatedAttestations", GET_ATTESTATION_LIST = "getAttestationList", GET_ATTESTATION_COUNT = "getAttestationCount", - GET_RECENT_ATTESTATION = "getRecentAttestations", + GET_RECENT_ATTESTATION_SCHEMA = "getRecentAttestationsSchema", + GET_RECENT_ATTESTATION_PORTAL = "getRecentAttestationsPortal", + GET_RECENT_ATTESTATION_GLOBAL = "getRecentAttestations", GET_MODULE_LIST = "getModuleList", GET_MODULE_COUNT = "getModuleCount", - SEARCH = "search", GET_PORTALS_BY_ISSUER = "getPortalsByIssuer", GET_PORTAL_BY_ID = "getPortalByID", GET_PORTAL_MODULE_LIST = "getPortalModuleList", GET_PORTAL_LIST = "getPortalList", - GET_RECENT_ATTESTATION_GLOBAL = "GET_RECENT_ATTESTATION_GLOBAL", } diff --git a/explorer/src/pages/Portal/index.tsx b/explorer/src/pages/Portal/index.tsx index c19b0a4b..e8f20d35 100644 --- a/explorer/src/pages/Portal/index.tsx +++ b/explorer/src/pages/Portal/index.tsx @@ -15,6 +15,7 @@ import { useNetworkContext } from "@/providers/network-provider/context"; import { PortalLoadingSkeleton } from "./components/PortalLoadingSkeleton"; import { PortalModules } from "./components/PortalModules"; +import { RecentAttestations } from "../Schema/components/RecentAttestations"; export const Portal = () => { const { id } = useParams(); @@ -92,6 +93,7 @@ export const Portal = () => { ))} + ); diff --git a/explorer/src/pages/Schema/components/RecentAttestations/index.tsx b/explorer/src/pages/Schema/components/RecentAttestations/index.tsx index d4325724..28067f4f 100644 --- a/explorer/src/pages/Schema/components/RecentAttestations/index.tsx +++ b/explorer/src/pages/Schema/components/RecentAttestations/index.tsx @@ -9,18 +9,22 @@ import { SWRKeys } from "@/interfaces/swr/enum"; import { useNetworkContext } from "@/providers/network-provider/context"; import { APP_ROUTES } from "@/routes/constants"; -export const RecentAttestations: React.FC<{ schemaId?: string }> = ({ schemaId }) => { +export const RecentAttestations: React.FC<{ schemaId?: string; portalId?: string }> = ({ schemaId, portalId }) => { const { sdk, network: { chain, network }, } = useNetworkContext(); const fetchKey = schemaId - ? `${SWRKeys.GET_RECENT_ATTESTATION}/${schemaId}/${chain.id}` + ? `${SWRKeys.GET_RECENT_ATTESTATION_SCHEMA}/${schemaId}/${chain.id}` + : portalId + ? `${SWRKeys.GET_RECENT_ATTESTATION_PORTAL}/${portalId}/${chain.id}` : `${SWRKeys.GET_RECENT_ATTESTATION_GLOBAL}/${chain.id}`; const fetchFunction = schemaId ? () => sdk.attestation.findBy(5, 0, { schema: schemaId }, "attestedDate", "desc") + : portalId + ? () => sdk.attestation.findBy(5, 0, { portal: portalId }, "attestedDate", "desc") : () => sdk.attestation.findBy(5, 0, {}, "attestedDate", "desc"); const { data: attestations, isLoading } = useSWR(fetchKey, fetchFunction, {