From 7e548132e8884d137a5b6c944b671c82ae5fcf9f Mon Sep 17 00:00:00 2001 From: tokodev Date: Tue, 19 Sep 2023 11:03:15 +0200 Subject: [PATCH] Small tweaks to solve first review issues --- packages/nextjs/pages/index.tsx | 55 ++++++++++++++++-------------- packages/nextjs/tailwind.config.js | 6 ++-- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index bc22fec..b725152 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -26,7 +26,13 @@ type Cohort = { totalWithdrawn: string; }; -const Home: NextPage<{ stats: Stats; cohortsData?: Cohort[] }> = ({ stats, cohortsData }) => { +const Home: NextPage<{ + stats: Stats; + cohortsData?: Cohort[]; + totalCohorts: number; + totalHackers: number; + totalEthStreamed: number; +}> = ({ stats, cohortsData, totalCohorts, totalHackers, totalEthStreamed }) => { return ( <> @@ -256,7 +262,7 @@ const Home: NextPage<{ stats: Stats; cohortsData?: Cohort[] }> = ({ stats, cohor {/* Cohorts*/}
-
+
{/* Cohorts Text Content */}
@@ -290,16 +296,16 @@ const Home: NextPage<{ stats: Stats; cohortsData?: Cohort[] }> = ({ stats, cohor
- - - - + + + + - + {cohortsData?.map(cohort => ( window.open(cohort.url, "_blank")} > @@ -316,26 +322,13 @@ const Home: NextPage<{ stats: Stats; cohortsData?: Cohort[] }> = ({ stats, cohor {/* Badges with Cohorts table data aggregation*/}
- Cohorts {cohortsData?.length} + Cohorts {totalCohorts}
- Hackers{" "} - - { - // Calculation for Total Number of Hackers - cohortsData?.reduce((acc, cohort) => acc + Object.keys(cohort.builders).length, 0) - } - + Hackers {totalHackers}
- ETH Streamed{" "} - - { - // Calculation for Total ETH Streamed - cohortsData?.reduce((acc, cohort) => acc + parseFloat(cohort.totalWithdrawn), 0).toFixed(2) - }{" "} - Ξ - + ETH Streamed {totalEthStreamed} Ξ
@@ -344,7 +337,7 @@ const Home: NextPage<{ stats: Stats; cohortsData?: Cohort[] }> = ({ stats, cohor {/* Learn More */} -
+

LEARN MORE

{/* Card Container */} @@ -390,10 +383,22 @@ export const getStaticProps: GetStaticProps<{ stats: Stats }> = async () => { const cohortsData = (await resCohorts.json()) as Cohort[]; + // Calculate total number of cohorts + const totalCohorts = cohortsData?.length; + + // Calculate total number of hackers + const totalHackers = cohortsData.reduce((acc, cohort) => acc + Object.keys(cohort.builders).length, 0); + + // Calculate Total ETH Streamed by all cohorts + const totalEthStreamed = cohortsData?.reduce((acc, cohort) => acc + parseFloat(cohort.totalWithdrawn), 0).toFixed(2); + return { props: { stats, cohortsData, + totalCohorts, + totalHackers, + totalEthStreamed, }, // 6 hours refresh. revalidate: 21600, diff --git a/packages/nextjs/tailwind.config.js b/packages/nextjs/tailwind.config.js index 3ea0fcf..7547dc4 100644 --- a/packages/nextjs/tailwind.config.js +++ b/packages/nextjs/tailwind.config.js @@ -19,7 +19,6 @@ module.exports = { "base-100": "#D8DCFF", "base-200": "#FFD4B5", "base-300": "#F4F4F4", - "base-400": "#EBECFD", "base-content": "#212638", info: "#9FA9FF", success: "#34EEB6", @@ -49,7 +48,6 @@ module.exports = { "base-100": "#385183", "base-200": "#2A3655", "base-300": "#212638", - "base-400": "#EBECFD", "base-content": "#F9FBFF", info: "#385183", success: "#34EEB6", @@ -74,10 +72,10 @@ module.exports = { "neue-machina": ["PPNeueMachina", "sans-serif"], }, backgroundColor: { - 'base-400': '#EBECFD', + 'skin': '#EBECFD', }, boxShadow: { - 'custom': '0px 0px 11.65074px 0px rgba(139, 178, 241, 0.50)', + 'even': '0px 0px 11.65074px 0px rgba(139, 178, 241, 0.50)', }, screens: { 'xs': '450px',
NameHackersBalance
NameHackersBalance