From dc36271aa61d2790eae8fcf7b79e06cd2610a3f3 Mon Sep 17 00:00:00 2001
From: Daniel <10026790+dnlggr@users.noreply.github.com>
Date: Tue, 19 Jul 2022 13:56:48 +0200
Subject: [PATCH] feat: improve earn report (#409)
---
src/components/EarnReport.tsx | 49 +++++++++++++++++++++++-----
src/i18n/locales/en/translation.json | 10 +++++-
2 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/src/components/EarnReport.tsx b/src/components/EarnReport.tsx
index 70186002..23f2baad 100644
--- a/src/components/EarnReport.tsx
+++ b/src/components/EarnReport.tsx
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'
import * as Api from '../libs/JmWalletApi'
// @ts-ignore
import { useSettings } from '../context/SettingsContext'
+import Balance from './Balance'
import styles from './EarnReport.module.css'
interface YielgenReportTableProps {
@@ -15,6 +16,37 @@ const YieldgenReportTable = ({ lines, maxAmountOfRows = 15 }: YielgenReportTable
const { t } = useTranslation()
const settings = useSettings()
+ const reportHeadingMap: { [name: string]: { heading: string; format?: string } } = {
+ timestamp: {
+ heading: t('earn.report.heading_timestamp'),
+ },
+ 'cj amount/satoshi': {
+ heading: t('earn.report.heading_cj_amount'),
+ format: 'balance',
+ },
+ 'my input count': {
+ heading: t('earn.report.heading_input_count'),
+ },
+ 'my input value/satoshi': {
+ heading: t('earn.report.heading_input_value'),
+ format: 'balance',
+ },
+ 'cjfee/satoshi': {
+ heading: t('earn.report.heading_cj_fee'),
+ format: 'balance',
+ },
+ 'earned/satoshi': {
+ heading: t('earn.report.heading_earned'),
+ format: 'balance',
+ },
+ 'confirm time/min': {
+ heading: t('earn.report.heading_confirm_time'),
+ },
+ 'notes\n': {
+ heading: t('earn.report.heading_notes'),
+ },
+ }
+
const empty = !lines || lines.length < 2
const headers = empty ? [] : lines[0].split(',')
@@ -37,7 +69,7 @@ const YieldgenReportTable = ({ lines, maxAmountOfRows = 15 }: YielgenReportTable
{headers.map((name, index) => (
-
@@ -45,18 +77,17 @@ const YieldgenReportTable = ({ lines, maxAmountOfRows = 15 }: YielgenReportTable
{visibleLines.map((line, trIndex) => (
{name}
+ {reportHeadingMap[name]?.heading || name}
))}