-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
677 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.