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
29 changes: 6 additions & 23 deletions app/[locale]/10years/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ import YouTube from "@/components/YouTube"

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

// Import static torch holders data
import tenYearEventRegions from "@/data/tenYearEventRegions"
import tenYearStories from "@/data/tenYearStories"
import torchHoldersData from "@/data/torchHolders.json"

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

import AdoptionSwiper from "./_components/AdoptionSwiper/lazy"
import { adoptionStyles } from "./_components/data"
import InnovationSwiper from "./_components/InnovationSwiper/lazy"
Expand All @@ -43,8 +41,6 @@ import {
import TenYearJsonLD from "./page-jsonld"

import { routing } from "@/i18n/routing"
import { fetch10YearEvents } from "@/lib/api/fetch10YearEvents"
import { fetch10YearStories } from "@/lib/api/fetch10YearStories"
import {
getHolderEvents,
getTransferEvents,
Expand All @@ -53,29 +49,16 @@ import {
} from "@/lib/torch"
import Curved10YearsText from "@/public/images/10-year-anniversary/10y-torch-heading.svg"

// In seconds
const REVALIDATE_TIME = BASE_TIME_UNIT * 1

const loadData = dataLoader(
[
["fetched10YearEvents", fetch10YearEvents],
["fetched10YearStories", fetch10YearStories],
],
REVALIDATE_TIME * 1000
)

const zIndexClasses = ["z-50", "z-40", "z-30", "z-20", "z-10", "z-0"]

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

setRequestLocale(locale)

const [fetched10YearEvents, fetched10YearStories] = await loadData()

const allTorchHolders: TorchHolder[] = torchHoldersData as TorchHolder[]

const stories = parseStoryDates(fetched10YearStories, locale)
const stories = parseStoryDates(tenYearStories, locale)

// Get i18n messages
const allMessages = await getMessages({ locale })
Expand Down Expand Up @@ -166,11 +149,11 @@ const Page = async ({ params }: { params: PageParams }) => {
<div className="w-full px-8 pb-8">
<div className="w-full">
<Tabs
defaultValue={Object.keys(fetched10YearEvents)[0]}
defaultValue={Object.keys(tenYearEventRegions)[0]}
className="w-full"
>
<TabsList className="w-full flex-nowrap justify-start overflow-x-auto overflow-y-hidden rounded-none border-b-2 border-b-primary p-0">
{Object.entries(fetched10YearEvents).map(([key, data]) => (
{Object.entries(tenYearEventRegions).map(([key, data]) => (
<TabsTrigger
key={key}
value={key}
Expand All @@ -181,7 +164,7 @@ const Page = async ({ params }: { params: PageParams }) => {
</TabsTrigger>
))}
</TabsList>
{Object.entries(fetched10YearEvents).map(([key, data]) => {
{Object.entries(tenYearEventRegions).map(([key, data]) => {
const events = data.events.sort((a, b) =>
a.country.localeCompare(b.country)
)
Expand Down
Loading