From 2e20b9f43e2d41e5249224b95f63ddcedab9068f Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Tue, 31 Mar 2020 23:58:14 +0800 Subject: [PATCH] Remove lamports switch, always display in SOL --- explorer/src/components/AccountsCard.tsx | 36 ++++-------------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/explorer/src/components/AccountsCard.tsx b/explorer/src/components/AccountsCard.tsx index f540f5ca7a..044342bbc7 100644 --- a/explorer/src/components/AccountsCard.tsx +++ b/explorer/src/components/AccountsCard.tsx @@ -16,7 +16,6 @@ function AccountsCard() { const dispatch = useAccountsDispatch(); const addressInput = React.useRef(null); const [error, setError] = React.useState(""); - const [showSOL, setShowSOL] = React.useState(true); const { url } = useCluster(); const onNew = (address: string) => { @@ -40,7 +39,7 @@ function AccountsCard() { return (
- {renderHeader(showSOL, setShowSOL)} + {renderHeader()}
@@ -51,9 +50,7 @@ function AccountsCard() { - + @@ -88,7 +85,7 @@ function AccountsCard() { - {accounts.map(account => renderAccountRow(account, showSOL))} + {accounts.map(account => renderAccountRow(account))}
Status Address - Balance ({showSOL ? "SOL" : "lamports"}) - Balance (SOL) Data (bytes) Owner
- -
@@ -96,36 +93,19 @@ function AccountsCard() { ); } -const renderHeader = ( - showSOL: boolean, - setShowSOL: (show: boolean) => void -) => { +const renderHeader = () => { return (

Look Up Account(s)

- - Display SOL - -
- - -
); }; -const renderAccountRow = (account: Account, showSOL: boolean) => { +const renderAccountRow = (account: Account) => { let statusText; let statusClass; switch (account.status) { @@ -155,11 +135,7 @@ const renderAccountRow = (account: Account, showSOL: boolean) => { let owner = "-"; if (account.details) { data = `${account.details.space}`; - if (showSOL) { - balance = `${(1.0 * account.details.lamports) / LAMPORTS_PER_SOL}`; - } else { - balance = `${account.details.lamports}`; - } + balance = `◎${(1.0 * account.details.lamports) / LAMPORTS_PER_SOL}`; owner = `${account.details.owner.toBase58()}`; }