From 96068b518168e8011ba939644005907024a2bbbc Mon Sep 17 00:00:00 2001 From: Kris Jenkins Date: Wed, 15 Jul 2020 12:06:37 +0100 Subject: [PATCH] FE: Improved formatting of long currency names in the wallet balances table. --- web-common/src/Chain/View.purs | 18 +++++++++++++----- web-common/static/chain.scss | 5 ----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/web-common/src/Chain/View.purs b/web-common/src/Chain/View.purs index d36005d4d68..1561e2debc8 100644 --- a/web-common/src/Chain/View.purs +++ b/web-common/src/Chain/View.purs @@ -27,6 +27,7 @@ import Data.Newtype (unwrap) import Data.Number.Extra (toLocaleString) import Data.Set (Set) import Data.Set as Set +import Data.String.Extra (abbreviate) import Data.Tuple.Nested ((/\)) import Halogen.HTML (ClassName(..), HTML, IProp, br_, div, div_, h2_, hr_, li_, small_, span_, strong_, table, tbody_, td, text, th, th_, thead_, tr, tr_, ul_) import Halogen.HTML.Events (onClick) @@ -212,7 +213,14 @@ balancesTable sequenceId walletKeys balances = [ colSpan (Set.size s) , class_ textTruncate ] - [ showCurrency currency ] + [ let + formatted = showCurrency currency + in + ClipboardAction + <$> showShortCopyLong + formatted + (Just [ text $ abbreviate 15 formatted ]) + ] ] ) headings @@ -409,7 +417,7 @@ valueView (Value { getValue: (AssocMap.Map currencies) }) = div_ (interleave hr_ currencyView (JsonTuple (currency /\ (AssocMap.Map tokens))) = div_ [ div [ class_ Bootstrap.textTruncate ] - [ strong_ [ showCurrency currency ] ] + [ strong_ [ text $ showCurrency currency ] ] , div_ (tokenView <$> tokens) ] @@ -424,10 +432,10 @@ valueView (Value { getValue: (AssocMap.Map currencies) }) = div_ (interleave hr_ formatAmount :: Int -> String formatAmount = toLocaleString <<< toNumber -showCurrency :: forall p i. CurrencySymbol -> HTML p i -showCurrency (CurrencySymbol { unCurrencySymbol: "" }) = text "Ada" +showCurrency :: CurrencySymbol -> String +showCurrency (CurrencySymbol { unCurrencySymbol: "" }) = "Ada" -showCurrency (CurrencySymbol { unCurrencySymbol: symbol }) = text symbol +showCurrency (CurrencySymbol { unCurrencySymbol: symbol }) = symbol showToken :: forall p i. TokenName -> HTML p i showToken (TokenName { unTokenName: "" }) = text "Lovelace" diff --git a/web-common/static/chain.scss b/web-common/static/chain.scss index 2fcabca0e80..ea710d8d523 100644 --- a/web-common/static/chain.scss +++ b/web-common/static/chain.scss @@ -138,11 +138,6 @@ height: 3rem; } - thead th { - text-align: center; - vertical-align: middle; - } - tbody tr th:first-child { max-width: 12rem; overflow: hidden;