Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/[locale]/10years/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { Image } from "@/components/Image"
import MainArticle from "@/components/MainArticle"
import Translation from "@/components/Translation"
import { ButtonLink } from "@/components/ui/buttons/Button"
import { LinkBox, LinkOverlay } from "@/components/ui/link-box"
import InlineLink from "@/components/ui/Link"
import { LinkBox, LinkOverlay } from "@/components/ui/link-box"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import YouTube from "@/components/YouTube"

Expand Down
51 changes: 28 additions & 23 deletions app/[locale]/layer-2/networks/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,51 +10,56 @@ import type { CommitHistory, Lang, PageParams } from "@/lib/types"
import I18nProvider from "@/components/I18nProvider"

import { getAppPageContributorInfo } from "@/lib/utils/contributors"
import { dataLoader } from "@/lib/utils/data/dataLoader"
import { getMetadata } from "@/lib/utils/metadata"
import { networkMaturity } from "@/lib/utils/networkMaturity"
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"

import { ethereumNetworkData, layer2Data } from "@/data/networks/networks"
import { walletsData } from "@/data/wallets/wallet-data"

import { BASE_TIME_UNIT } from "@/lib/constants"

import Layer2Networks from "./_components/networks"
import Layer2NetworksPageJsonLD from "./page-jsonld"

import { fetchEthereumMarketcap } from "@/lib/api/fetchEthereumMarketcap"
import { fetchGrowThePie } from "@/lib/api/fetchGrowThePie"
import { fetchGrowThePieBlockspace } from "@/lib/api/fetchGrowThePieBlockspace"
import { fetchGrowThePieMaster } from "@/lib/api/fetchGrowThePieMaster"
import { fetchL2beat } from "@/lib/api/fetchL2beat"

// In seconds
const REVALIDATE_TIME = BASE_TIME_UNIT * 1

const loadData = dataLoader(
[
["ethereumMarketcapData", fetchEthereumMarketcap],
["growThePieData", fetchGrowThePie],
["growThePieBlockspaceData", fetchGrowThePieBlockspace],
["growThePieMasterData", fetchGrowThePieMaster],
["l2beatData", fetchL2beat],
],
REVALIDATE_TIME * 1000
)
import {
getEthereumMarketcapData,
getGrowThePieBlockspaceData,
getGrowThePieData,
getGrowThePieMasterData,
getL2beatData,
} from "@/lib/data"

const Page = async ({ params }: { params: PageParams }) => {
const { locale } = params

setRequestLocale(locale)

// Fetch data using the new data-layer functions (already cached)
const [
ethereumMarketcapData,
growThePieData,
growThePieBlockspaceData,
growThePieMasterData,
l2beatData,
] = await loadData()
] = await Promise.all([
getEthereumMarketcapData(),
getGrowThePieData(),
getGrowThePieBlockspaceData(),
getGrowThePieMasterData(),
getL2beatData(),
])

// Handle null cases - throw error if required data is missing
if (!l2beatData) {
throw new Error("Failed to fetch L2beat data")
}

if (!growThePieData) {
throw new Error("Failed to fetch GrowThePie data")
}

if (!ethereumMarketcapData) {
throw new Error("Failed to fetch Ethereum marketcap data")
}

const layer2DataCompiled = layer2Data
.map((network) => {
Expand Down
32 changes: 15 additions & 17 deletions app/[locale]/layer-2/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,37 @@ import type { CommitHistory, Lang, PageParams } from "@/lib/types"
import I18nProvider from "@/components/I18nProvider"

import { getAppPageContributorInfo } from "@/lib/utils/contributors"
import { dataLoader } from "@/lib/utils/data/dataLoader"
import { getMetadata } from "@/lib/utils/metadata"
import { networkMaturity } from "@/lib/utils/networkMaturity"
import { getRequiredNamespacesForPage } from "@/lib/utils/translations"

import { layer2Data } from "@/data/networks/networks"

import { BASE_TIME_UNIT } from "@/lib/constants"

import Layer2Page from "./_components/layer-2"
import Layer2PageJsonLD from "./page-jsonld"

import { routing } from "@/i18n/routing"
import { fetchGrowThePie } from "@/lib/api/fetchGrowThePie"
import { fetchL2beat } from "@/lib/api/fetchL2beat"

// In seconds
const REVALIDATE_TIME = BASE_TIME_UNIT * 24

const loadData = dataLoader(
[
["growThePieData", fetchGrowThePie],
["l2beatData", fetchL2beat],
],
REVALIDATE_TIME * 1000
)
import { getGrowThePieData, getL2beatData } from "@/lib/data"

const Page = async ({ params }: { params: PageParams }) => {
const { locale } = params

setRequestLocale(locale)

const [growThePieData, l2beatData] = await loadData()
// Fetch data using the new data-layer functions (already cached)
const [growThePieData, l2beatData] = await Promise.all([
getGrowThePieData(),
getL2beatData(),
])

// Handle null cases - throw error if required data is missing
if (!l2beatData) {
throw new Error("Failed to fetch L2beat data")
}

if (!growThePieData) {
throw new Error("Failed to fetch GrowThePie data")
}

const getRandomL2s = () => {
let randomL2s = layer2Data.filter(
Expand Down