Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stats: display previous 24h vol #140

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
14 changes: 2 additions & 12 deletions app/stats/charts/volume-chart.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client"

import * as React from "react"

import numeral from "numeral"
Expand Down Expand Up @@ -57,23 +55,15 @@ export function VolumeChart() {
volume: dataPoint.volume,
}))

// const { data: cumulativeData } = useCumulativeVolume({
// from: now - 2 * timePeriod.day,
// to: now,
// })
// const cumulativeVolumeLabel = React.useMemo(() => {
// if (!cumulativeData) return ""
// return formatStat(cumulativeData[cumulativeData.length - 1].volume)
// }, [cumulativeData])
const cumulativeVolume = chartData?.[chartData.length - 1]?.volume
const cumulativeVolume = chartData?.[chartData.length - 2]?.volume
const cumulativeVolumeLabel = formatStat(cumulativeVolume ?? 0)

return (
<Card className="w-full rounded-none">
<CardHeader className="flex flex-col items-stretch space-y-0 border-b p-0 sm:flex-row">
<div className="flex flex-1 flex-col justify-center gap-1 px-6 py-5 sm:py-6">
<CardTitle className="font-serif text-4xl font-bold tracking-tighter lg:tracking-normal">
{cumulativeVolumeLabel ? (
{cumulativeVolume ? (
cumulativeVolumeLabel
) : (
<Skeleton className="h-10 w-40" />
Expand Down
Loading