From c3075716242eab472381f5057aa75b24fd471010 Mon Sep 17 00:00:00 2001 From: Tyler Shipe Date: Sun, 16 Jan 2022 11:12:59 -0600 Subject: [PATCH] yarn format --- .../account_page/AccountPerformance.tsx | 44 ++++++------------- pages/account.tsx | 9 +++- tsconfig.json | 20 ++------- 3 files changed, 25 insertions(+), 48 deletions(-) diff --git a/components/account_page/AccountPerformance.tsx b/components/account_page/AccountPerformance.tsx index d89f35fe..80a74a68 100644 --- a/components/account_page/AccountPerformance.tsx +++ b/components/account_page/AccountPerformance.tsx @@ -5,9 +5,7 @@ import { Table, Td, Th, TrBody, TrHead } from '../TableElements' import { useTranslation } from 'next-i18next' import { isEmpty } from 'lodash' import usePagination from '../../hooks/usePagination' -import { - numberCompactFormatter, -} from '../../utils/' +import { numberCompactFormatter } from '../../utils/' import Pagination from '../Pagination' import Chart from '../Chart' @@ -46,24 +44,19 @@ const AccountPerformance = () => { }, [mangoAccount]) const exportPerformanceDataToCSV = () => { - const dataToExport = hourlyPerformanceStats.map((row) => { - const timestamp = new Date(row.time) - return { + const timestamp = new Date(row.time) + return { timestamp: `${timestamp.toLocaleDateString()} ${timestamp.toLocaleTimeString()}`, account_equity: row.account_equity, - pnl: row.pnl - } + pnl: row.pnl, + } }) const title = `${ mangoAccount.name || mangoAccount.publicKey }-Performance-${new Date().toLocaleDateString()}` - const headers = [ - 'Timestamp', - 'Account Equity', - 'PNL' - ] + const headers = ['Timestamp', 'Account Equity', 'PNL'] exportDataToCSV(dataToExport, title, headers, t) } @@ -75,7 +68,6 @@ const AccountPerformance = () => { }, [hourlyPerformanceStats]) useEffect(() => { - const fetchHourlyPerformanceStats = async () => { setLoading(true) const response = await fetch( @@ -85,12 +77,12 @@ const AccountPerformance = () => { const entries: any = Object.entries(parsedResponse) const stats = entries - .map(([key, value]) => { - return { ...value, time: key } - }) - .filter((x) => x) - .reverse() - + .map(([key, value]) => { + return { ...value, time: key } + }) + .filter((x) => x) + .reverse() + setLoading(false) setHourlyPerformanceStats(stats) } @@ -181,16 +173,8 @@ const AccountPerformance = () => { return ( {dayjs(utc).format('DD/MM/YY, h:mma')} - - {stat.account_equity.toFixed( - 6 + 1 - )} - - - {stat.pnl.toFixed( - 6 + 1 - )} - + {stat.account_equity.toFixed(6 + 1)} + {stat.pnl.toFixed(6 + 1)} ) })} diff --git a/pages/account.tsx b/pages/account.tsx index 5689b4b9..4e9ab21b 100644 --- a/pages/account.tsx +++ b/pages/account.tsx @@ -41,7 +41,14 @@ export async function getStaticProps({ locale }) { } } -const TABS = ['Portfolio', 'Orders', 'History', 'Interest', 'Funding', 'Performance'] +const TABS = [ + 'Portfolio', + 'Orders', + 'History', + 'Interest', + 'Funding', + 'Performance', +] export default function Account() { const { t } = useTranslation('common') diff --git a/tsconfig.json b/tsconfig.json index 262ff5a6..bf33c4c2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "es6", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": false, @@ -19,16 +15,6 @@ "isolatedModules": true, "incremental": true }, - "exclude": [ - "node_modules", - ".next", - "out", - "public/datafeeds" - ], - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - "**/*.js" - ] + "exclude": ["node_modules", ".next", "out", "public/datafeeds"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"] }