Skip to content

Commit

Permalink
feat: add download button in chart on rgbpp page
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Aug 9, 2024
1 parent 37b8b48 commit be766a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/pages/RGBPP/TransactionList/Chart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ const useOption = (
}
}

const toCSV = (dataList: ChartItem.Bitcoin[]) => {
if (!dataList) return []
return dataList.map(data => [data.timestamp, data.addressesCount, data.transactionsCount])
}

export const Chart = ({ isThumbnail = false }: { isThumbnail?: boolean }) => {
const [t] = useTranslation()
const isMobile = useIsMobile()
Expand All @@ -167,6 +172,7 @@ export const Chart = ({ isThumbnail = false }: { isThumbnail?: boolean }) => {
fetchData={explorerService.api.fetchStatisticBitcoin}
getEChartOption={useOption}
queryKey="fetchStatisticBitcoin"
toCSV={toCSV}
/>
</div>
)
Expand Down
6 changes: 6 additions & 0 deletions src/pages/RGBPP/TransactionList/Chart/styles.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.container {
max-width: 100%;
width: 100%;

:global(.chartDetailTitlePanel) {
span {
margin: 0 !important;
}
}
}

0 comments on commit be766a0

Please sign in to comment.