diff --git a/src/components/CCIP/Landing/NetworkGrid.tsx b/src/components/CCIP/Landing/NetworkGrid.tsx index dc062c67041..82b4e6ab915 100644 --- a/src/components/CCIP/Landing/NetworkGrid.tsx +++ b/src/components/CCIP/Landing/NetworkGrid.tsx @@ -1,4 +1,4 @@ -import { useState } from "react" +import { useEffect, useState } from "react" import NetworkCard from "../Cards/NetworkCard" import SeeMore from "../SeeMore/SeeMore" import "./NetworkGrid.css" @@ -18,6 +18,16 @@ const BEFORE_SEE_MORE = 2 * 7 // Number of networks to show before the "See more function NetworkGrid({ networks, environment }: NetworkGridProps) { const [seeMore, setSeeMore] = useState(networks.length <= BEFORE_SEE_MORE) + + // Enables displaying all content when `showAll=true` is present in the URL query parameters. + // This is added to help expose additional content for the Algolia crawler. + useEffect(() => { + const urlParams = new URLSearchParams(window.location.search) + if (urlParams.get("showAll") === "true") { + setSeeMore(true) + } + }, []) + return ( <>
diff --git a/src/components/CCIP/Tables/ChainTable.tsx b/src/components/CCIP/Tables/ChainTable.tsx index ab947a7268c..83fe03968bf 100644 --- a/src/components/CCIP/Tables/ChainTable.tsx +++ b/src/components/CCIP/Tables/ChainTable.tsx @@ -19,6 +19,7 @@ interface TableProps { lanes: { name: string logo: string + noOfSupportedTokens: number onRamp?: { address: string version: string @@ -48,6 +49,15 @@ function ChainTable({ lanes, explorerUrl, sourceNetwork, environment }: TablePro } }, [search]) + // Enables displaying all content when `showAll=true` is present in the URL query parameters. + // This is added to help expose additional content for the Algolia crawler. + useEffect(() => { + const urlParams = new URLSearchParams(window.location.search) + if (urlParams.get("showAll") === "true") { + setSeeMore(true) + } + }, []) + useEffect(() => { const fetchOperationalState = async (network) => { if (network) { @@ -92,7 +102,7 @@ function ChainTable({ lanes, explorerUrl, sourceNetwork, environment }: TablePro .slice(0, seeMore ? lanes.length : BEFORE_SEE_MORE) .map((network, index) => ( - +
{ + const urlParams = new URLSearchParams(window.location.search) + if (urlParams.get("showAll") === "true") { + setSeeMore(true) + } + }, []) + return ( <>
diff --git a/src/config/data/ccip/data.ts b/src/config/data/ccip/data.ts index 5a63ca728ef..ee6b213e678 100644 --- a/src/config/data/ccip/data.ts +++ b/src/config/data/ccip/data.ts @@ -531,6 +531,7 @@ export const getAllNetworkLanes = async ({ logo: string key: string directory: SupportedChain + noOfSupportedTokens: number onRamp: { address: string version: string @@ -541,6 +542,7 @@ export const getAllNetworkLanes = async ({ } }[] = Object.keys(allLanes).map((lane) => { const laneData = allLanes[lane] + const noOfSupportedTokens = laneData?.supportedTokens ? Object.keys(laneData.supportedTokens).length : 0 const directory = directoryToSupportedChain(lane || "") const title = getTitle(directory) @@ -552,6 +554,7 @@ export const getAllNetworkLanes = async ({ onRamp: laneData.onRamp, offRamp: laneData.offRamp, key: lane, + noOfSupportedTokens, directory, } })