diff --git a/packages/nextjs/pages/batches/components/BatchCta.tsx b/packages/nextjs/pages/batches/components/BatchCta.tsx new file mode 100644 index 0000000..cb0bc24 --- /dev/null +++ b/packages/nextjs/pages/batches/components/BatchCta.tsx @@ -0,0 +1,34 @@ +import { formatDate } from "../utils/formatDate"; +import TrackedLink from "~~/components/TrackedLink"; + +interface BatchCtaProps { + openBatchNumber: number | null; + openBatchStartDate: number | null; +} + +export const BatchCta = ({ openBatchNumber, openBatchStartDate }: BatchCtaProps) => { + return ( +
+
+
+

+ Batch #{openBatchNumber} +

+

+ Complete SpeedRunEthereum and join BuidlGuidl to be part of the next batch starting + {openBatchStartDate ? ` on ${formatDate(openBatchStartDate)}` : " soon"}! +

+
+
+ + Go SpeedRunEthereum + +
+
+
+ ); +}; diff --git a/packages/nextjs/pages/batches/index.tsx b/packages/nextjs/pages/batches/index.tsx index ee03b3e..90d5de1 100644 --- a/packages/nextjs/pages/batches/index.tsx +++ b/packages/nextjs/pages/batches/index.tsx @@ -1,6 +1,8 @@ import { useState } from "react"; import Image from "next/image"; import Link from "next/link"; +import { BatchCta } from "./components/BatchCta"; +import { formatDate } from "./utils/formatDate"; import type { GetStaticProps } from "next"; import { Footer } from "~~/components/Footer"; import { MetaHeader } from "~~/components/MetaHeader"; @@ -31,14 +33,6 @@ interface PageProps { openBatchStartDate: number | null; } -const formatDate = (timestamp: number): string => { - return new Date(timestamp).toLocaleDateString("en-US", { - year: "numeric", - month: "short", - day: "numeric", - }); -}; - // Custom header for the batches page since the "Go to app" button is different const BatchesHeader = () => { return ( @@ -151,29 +145,8 @@ const Batches = ({ batchData, openBatchNumber, openBatchStartDate }: PageProps) - {/* Next Batch CTA - call to action */} -
-
-
-

- Batch #{openBatchNumber} -

-

- Complete SpeedRunEthereum and join BuidlGuidl to be part of the next batch starting - {openBatchStartDate ? ` on ${formatDate(openBatchStartDate)}` : " soon"}! -

-
-
- - Go SpeedRunEthereum - -
-
-
+ {/* Next Batch CTA */} + @@ -285,28 +258,7 @@ const Batches = ({ batchData, openBatchNumber, openBatchStartDate }: PageProps)
{/* Next Batch CTA */} -
-
-
-

- Batch #{openBatchNumber} -

-

- Complete SpeedRunEthereum and join BuidlGuidl to be part of the next batch starting - {openBatchStartDate ? ` on ${formatDate(openBatchStartDate)}` : " soon"}! -

-
-
- - Go SpeedRunEthereum - -
-
-
+
{"Winners"} diff --git a/packages/nextjs/pages/batches/utils/formatDate.ts b/packages/nextjs/pages/batches/utils/formatDate.ts new file mode 100644 index 0000000..5c798e6 --- /dev/null +++ b/packages/nextjs/pages/batches/utils/formatDate.ts @@ -0,0 +1,7 @@ +export const formatDate = (timestamp: number): string => { + return new Date(timestamp).toLocaleDateString("en-US", { + year: "numeric", + month: "short", + day: "numeric", + }); +};