Skip to content

Commit

Permalink
feat: all snx burned (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrX-SNX authored Jul 8, 2024
1 parent 6d9ead9 commit 2c6e90c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
21 changes: 18 additions & 3 deletions ultrasound/ui/components/SupplyChangeStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import { Flex, Image, Link, Spinner, Tab, TabList, Tabs, Text } from '@chakra-ui
import { useBurnEvents } from '../hooks/useBurnEvents';
import burnSvg from './svgs/burn.svg';
import mintedSvg from './svgs/minted.svg';
import { useState } from 'react';

export function SupplyChangeStats() {
const { data: events, isLoading } = useBurnEvents();
const [selectedTime, setSelectedTime] = useState<'totalBurned' | 'supplyChange7Days'>(
'supplyChange7Days'
);

return (
<Flex
Expand All @@ -30,22 +34,33 @@ export function SupplyChangeStats() {
</Text>
<Tabs variant="soft-rounded" size="sm">
<TabList>
<Tab color="gray.500" _selected={{ color: 'white', bg: 'whiteAlpha.400' }}>
<Tab
color="gray.500"
_selected={{ color: 'white', bg: 'whiteAlpha.400' }}
onClick={() => setSelectedTime('supplyChange7Days')}
>
7D
</Tab>
<Tab
color="gray.500"
_selected={{ color: 'white', bg: 'whiteAlpha.400' }}
onClick={() => setSelectedTime('totalBurned')}
>
All
</Tab>
</TabList>
</Tabs>
</Flex>
<Text fontWeight={700} fontSize="24px">
-{events?.supplyChange7Days} SNX
-{events ? events[selectedTime] : 0} SNX
</Text>
<Flex gap="2" alignItems="center">
<Image src={burnSvg} />
<Text fontSize="16px" color="gray.500" fontWeight={400}>
Burnt
</Text>
<Text fontSize="18px" color="gray.500" fontWeight={700}>
{events?.supplyChange7Days} SNX
{events ? events[selectedTime] : 0} SNX
</Text>
</Flex>
<Flex gap="2" alignItems="center">
Expand Down
3 changes: 3 additions & 0 deletions ultrasound/ui/hooks/useBurnEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ export function useBurnEvents() {

return {
totalBurns: events.length,
totalBurned: totalBurned.toLocaleString('en-US', {
maximumFractionDigits: 2,
}),
groupedByMonths,
groupedByLast30Days,
supplyChange7Days,
Expand Down

0 comments on commit 2c6e90c

Please sign in to comment.