Skip to content

Commit

Permalink
Fixed explorer not showing recent volume
Browse files Browse the repository at this point in the history
  • Loading branch information
bone-house committed Oct 31, 2023
1 parent 21262d0 commit 0ecdd21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/explorer/src/AllPlatforms.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Container, Flex, Grid, Table, Text } from '@radix-ui/themes'
import { Box, Flex, Table, Text } from '@radix-ui/themes'
import React from 'react'
import { Money } from './Money'
import { useApi } from './api'
Expand Down
5 changes: 3 additions & 2 deletions apps/explorer/src/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@ const _Graph = ({ width, height, dailyVolume: _dailyVolume, onHover }: AreaProps
const [date1, date2] = extent(_dailyVolume, getDate)
if (!date1 || !date2) return []
const days = 1 + unixDay(date2.getTime() - date1.getTime())

const volumeByDay = _dailyVolume.reduce((prev, x) => ({
...prev,
[new Date(x.date).toString()]: x.total_volume
[new Date(x.date).toDateString()]: x.total_volume
}), {} as Record<string, number>)

return Array.from({length: days}).map((_, dayIndex) => {
const startDate = new Date(date1)
const date = new Date(startDate.setDate(startDate.getDate() + dayIndex))
return {
total_volume: volumeByDay[date.toString()] ?? 0,
total_volume: volumeByDay[date.toDateString()] ?? 0,
date: date.toString()
}
})
Expand Down
4 changes: 2 additions & 2 deletions apps/explorer/src/components/TableRowLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Table } from "@radix-ui/themes"
import { TableRowProps } from "@radix-ui/themes/dist/cjs/components/table"
import React from "react"
import { Link, useNavigate } from "react-router-dom"
import { Link } from "react-router-dom"
import styled from "styled-components"

interface Props extends TableRowProps, Omit<React.RefAttributes<HTMLTableRowElement>, 'role'> {
Expand All @@ -24,7 +24,7 @@ export const TableRowNavLink = ({to, children, ...rest}: Props) => {
return (
<StyledLink to={to}>
<StyledTableRow {...rest}>
{children}
{children}
</StyledTableRow>
</StyledLink>
)
Expand Down

0 comments on commit 0ecdd21

Please sign in to comment.