Skip to content

Commit

Permalink
Use raw blocks in table instead of conversion from date
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Nov 3, 2023
1 parent d7adf7c commit 9fe22c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Text } from '@/components/Text'
import { TextButton } from '@/components/_buttons/Button'
import { DialogModal } from '@/components/_overlays/DialogModal'
import { absoluteRoutes } from '@/config/routes'
import { useBlockTimeEstimation } from '@/hooks/useBlockTimeEstimation'
import { getMemberAvatar } from '@/providers/assets/assets.helpers'
import { SentryLogger } from '@/utils/logs'
import { shortenString } from '@/utils/misc'
Expand Down Expand Up @@ -54,7 +53,7 @@ export const TablePaymentsHistory: FC<TablePaymentsHistoryProps> = ({ data, isLo
const mappedData: TableProps['data'] = useMemo(
() =>
data.map((data) => ({
date: <Date date={data.date} />,
date: <Date date={data.date} block={data.block} />,
type: <Type type={data.type} />,
amount: <TokenAmount tokenAmount={data.amount} />,
sender: <Sender sender={data.sender} />,
Expand Down Expand Up @@ -145,15 +144,14 @@ const Sender = ({ sender }: { sender: PaymentHistory['sender'] }) => {
}
}

const Date = ({ date }: { date: Date }) => {
const { convertMsTimestampToBlock } = useBlockTimeEstimation()
const Date = ({ date, block }: { date: Date; block: number }) => {
return (
<>
<Text as="p" variant="t200-strong">
{formatDateTime(date)}
</Text>
<Text as="p" variant="t100" margin={{ top: 1 }} color="colorText">
{formatNumber(convertMsTimestampToBlock(date.getTime()) || 0)} block
{formatNumber(block || 0)} block
</Text>
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export const mapEventToPaymentHistory =
const eventData = { ...event.data, nftPlatformFeePercentage }
return {
type: getType(eventData),
block: inBlock + 1,
block: inBlock,
amount: getAmount(eventData),
date: new Date(timestamp),
description: getDescription(eventData) || '-',
Expand Down

0 comments on commit 9fe22c2

Please sign in to comment.