Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
mokelgit committed Dec 5, 2024
2 parents ae8e891 + 441aa4a commit 4a5adf5
Show file tree
Hide file tree
Showing 9 changed files with 677 additions and 5 deletions.
32 changes: 32 additions & 0 deletions app/(layout)/da-overview/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Container from "@/components/layout/Container";
import Heading from "@/components/layout/Heading";

import Image from "next/image";
import Icon from "@/components/layout/Icon";


export default async function Layout({
children,
}: {
children: React.ReactNode;
}) {

return(
<>
<Container className="flex flex-col w-full pt-[45px] md:pt-[30px] gap-y-[15px]" isPageRoot >
<div className="flex items-center h-[43px] gap-x-[8px] ">
<Icon icon="gtp:gtp-data-availability" className="w-[24px] h-[24px]"/>
<Heading className="text-[36px] leading-snug " as="h1">
{"Data Availability Overview"}
</Heading>
</div>
<div className="text-[14px] mb-[15px]">
This is about DA
</div>
</Container>
<Container>
{children}
</Container>
</>
)
}
160 changes: 160 additions & 0 deletions app/(layout)/da-overview/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
"use client"
import { useEffect, useState, useMemo } from "react";
import { TopRowContainer, TopRowParent, TopRowChild } from "@/components/layout/TopRow";
import DAHeadCharts from "@/components/layout/DA-Overview/DAHeadCharts";
import DATable from "@/components/layout/DA-Overview/DATable";

export default function DAOverviewPage() {
const [selectedTimespan, setSelectedTimespan] = useState("365d");
const [isMonthly, setIsMonthly] = useState(false);

const timespans = useMemo(() => {
let xMax = Date.now();

if (!isMonthly) {
return {
"1d": {
shortLabel: "1d",
label: "1 day",
value: 1,
},
"7d": {
shortLabel: "7d",
label: "7 days",
value: 7,
xMin: xMax - 7 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
"30d": {
shortLabel: "30d",
label: "30 days",
value: 30,
xMin: xMax - 30 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
"90d": {
shortLabel: "90d",
label: "90 days",
value: 90,
xMin: xMax - 90 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
"365d": {
shortLabel: "1y",
label: "1 year",
value: 365,
xMin: xMax - 365 * 24 * 60 * 60 * 1000,
xMax: xMax,
},

max: {
shortLabel: "Max",
label: "Max",
value: 0,
xMin: xMax - 365 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
};
} else {
return {
"180d": {
shortLabel: "6m",
label: "6 months",
value: 90,
xMin: xMax - 180 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
"365d": {
shortLabel: "1y",
label: "1 year",
value: 365,
xMin: xMax - 365 * 24 * 60 * 60 * 1000,
xMax: xMax,
},

max: {
shortLabel: "Max",
label: "Max",
value: 0,
xMin: xMax - 365 * 24 * 60 * 60 * 1000,
xMax: xMax,
},
};
}
}, [isMonthly]);

return (
<>
<TopRowContainer className="-py-[3px]">
<TopRowParent className="-py-[10px]">
<TopRowChild
isSelected={!isMonthly}
onClick={() => {
const isTransferrableTimespan =
selectedTimespan === "max" || selectedTimespan === "365d";
if (!isTransferrableTimespan) {
setSelectedTimespan("max");
}
setIsMonthly(false);
}}
style={{
paddingTop: "10.5px",
paddingBottom: "10.5px",
paddingLeft: "16px",
paddingRight: "16px",
}}
>
{"Daily"}
</TopRowChild>
<TopRowChild
isSelected={isMonthly}
onClick={() => {
const isTransferrableTimespan =
selectedTimespan === "max" || selectedTimespan === "365d";
if (!isTransferrableTimespan) {
setSelectedTimespan("max");
}
setIsMonthly(true);
}}
style={{
paddingTop: "10.5px",
paddingBottom: "10.5px",
paddingLeft: "16px",
paddingRight: "16px",
}}
>
{"Monthly"}
</TopRowChild>
</TopRowParent>
<TopRowParent className="-py-[10px]">
{Object.keys(timespans).map((key) => {
{
return (
<TopRowChild
className={`px-[10px]`}
onClick={() => {
setSelectedTimespan(key);
}}
key={key}
style={{
paddingTop: "10.5px",
paddingBottom: "10.5px",
paddingLeft: "16px",
paddingRight: "16px",
}}
isSelected={selectedTimespan === key}
>
{selectedTimespan === key
? timespans[key].label
: timespans[key].shortLabel}
</TopRowChild>
);
}
})}
</TopRowParent>
</TopRowContainer>
<DAHeadCharts selectedTimespan={selectedTimespan} timespans={timespans} />
<DATable />
</>
)
}
3 changes: 2 additions & 1 deletion app/(layout)/economics/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ export default function Economics() {
<Container className={` ${selectedTimespan === "1d" ? "pb-[0px]" : "pb-[30px]"}`}>
{econData && <EconHeadCharts chart_data={econData.data.all_l2s} selectedTimespan={selectedTimespan} setSelectedTimespan={setSelectedTimespan} isMonthly={isMonthly} setIsMonthly={setIsMonthly} />}
</Container>
{econData && master && <ChainBreakdown data={econData.data.chain_breakdown} master={master} selectedTimespan={selectedTimespan} setSelectedTimespan={setSelectedTimespan} isMonthly={isMonthly} setIsMonthly={setIsMonthly} />}
{econData && master && <ChainBreakdown data={Object.fromEntries(Object.entries(econData.data.chain_breakdown).filter(([key]) => key !== "totals"))} master={master} selectedTimespan={selectedTimespan} setSelectedTimespan={setSelectedTimespan} isMonthly={isMonthly} setIsMonthly={setIsMonthly} totals={econData.data.chain_breakdown["totals"]} />}
{/* </div> */}

</>
);
}
6 changes: 6 additions & 0 deletions components/Share.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ export default function Share() {
<>
<div>
<div>
<div className="absolute inset-0 z-40 w-full h-full overflow-hidden pointer-events-none rounded-full">
{/* Glint effect */}
<div className="w-full h-full"></div>
<div className="absolute top-1/2 -translate-y-1/2 w-full h-1 bg-gradient-to-r from-transparent via-white to-transparent opacity-60 transform -skew-x-20 animate-glint blur-sm"></div>
</div>
<button
className="select-none flex items-center space-x-2 justify-between font-semibold bg-forest-50 dark:bg-[#1F2726] rounded-full px-4 py-2"
onClick={() => {
Expand Down Expand Up @@ -290,6 +295,7 @@ export default function Share() {
: "w-[calc(100vw-30px)] xs:w-[calc(100vw-46px)] md:w-[579px]"
}`}
>

<div className="flex w-full h-[32px] justify-between items-center justify-self-start ">
<div className="flex items-center gap-x-[10px]">
<Icon
Expand Down
Loading

0 comments on commit 4a5adf5

Please sign in to comment.