Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADP-3457] Adapt long text to media #4789

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/ui/src/Cardano/Wallet/UI/Deposit/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down
5 changes: 2 additions & 3 deletions lib/ui/src/Cardano/Wallet/UI/Deposit/Html/Pages/Addresses.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ import Lucid
, ToHtml (..)
, class_
, div_
, h5_
, id_
, input_
, min_
Expand All @@ -75,7 +74,8 @@ addressesH = do
customerAddressH :: Monad m => Address -> HtmlT m ()
customerAddressH addr = div_ [class_ "d-flex justify-content-end"] $ do
div_ (copyableHidden "address") $ toHtml encodedAddr
div_ [class_ ""] $ toHtml addrShortened
div_ [class_ "d-block d-md-none"] $ toHtml addrShortened
div_ [class_ "d-none d-md-block"] $ toHtml encodedAddr
div_ [class_ "ms-1"] $ copyButton "address"
where
encodedAddr = encodeMainnetAddress addr
Expand All @@ -88,7 +88,6 @@ addressElementH :: (BL.ByteString -> Html ()) -> WalletPresent -> Html ()
addressElementH alert = \case
WalletPresent (WalletPublicIdentity _xpub customers) -> do
div_ [class_ "row mt-5"] $ do
h5_ [class_ "text-center"] "Addresses"
div_ [class_ "col"] $ record $ do
simpleField "Customer Number"
$ input_
Expand Down
31 changes: 6 additions & 25 deletions lib/ui/src/Cardano/Wallet/UI/Deposit/Html/Pages/Wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import Cardano.Address.Derivation
import Cardano.Wallet.Deposit.IO
( WalletPublicIdentity (..)
)
import Cardano.Wallet.Deposit.Read
( Address
)
import Cardano.Wallet.Deposit.REST
( ErrDatabase
)
Expand Down Expand Up @@ -58,9 +55,6 @@ import Cardano.Wallet.UI.Deposit.API
, walletPostMnemonicLink
, walletPostXPubLink
)
import Cardano.Wallet.UI.Lib.Address
( encodeMainnetAddress
)
import Cardano.Wallet.UI.Type
( WHtml
, WalletType (..)
Expand Down Expand Up @@ -89,7 +83,6 @@ import Lucid
, button_
, class_
, div_
, h5_
, hr_
, id_
, p_
Expand All @@ -98,7 +91,6 @@ import Lucid

import qualified Data.ByteString.Char8 as B8
import qualified Data.ByteString.Lazy.Char8 as BL
import qualified Data.Text as T

data WalletPresent
= WalletPresent WalletPublicIdentity
Expand Down Expand Up @@ -126,24 +118,15 @@ walletH = sseH walletLink "wallet" ["wallet"]
base64 :: ByteString -> ByteString
base64 = convertToBase Base64

customerAddressH :: Monad m => Address -> HtmlT m ()
customerAddressH addr = div_ [class_ "d-flex justify-content-end"] $ do
div_ (copyableHidden "address") $ toHtml encodedAddr
div_ [class_ ""] $ toHtml addrShortened
div_ [class_ "ms-1"] $ copyButton "address"
where
encodedAddr = encodeMainnetAddress addr
addrShortened =
T.take 10 (T.drop 5 encodedAddr)
<> " .. "
<> T.takeEnd 10 encodedAddr

pubKeyH :: Monad m => XPub -> HtmlT m ()
pubKeyH xpub = div_ [class_ "d-flex justify-content-end"] $ do
div_ (copyableHidden "public_key") $ toHtml xpubByteString
div_ [class_ ""] $ toHtml $ headAndTail 4 $ B8.dropEnd 1 xpubByteString
div_ [class_ "ms-1"]
$ copyButton "public_key"
div_ [class_ "d-block d-lg-none"]
$ toHtml
$ headAndTail 5
$ B8.dropEnd 1 xpubByteString
div_ [class_ "d-none d-lg-block"] $ toHtml xpubByteString
div_ [class_ "ms-1"] $ copyButton "public_key"
where
xpubByteString = base64 $ xpubToBytes xpub

Expand Down Expand Up @@ -182,12 +165,10 @@ walletElementH :: (BL.ByteString -> Html ()) -> WalletPresent -> Html ()
walletElementH alert = \case
WalletPresent (WalletPublicIdentity xpub customers) -> do
div_ [class_ "row mt-5 "] $ do
h5_ [class_ "text-center"] "Details"
div_ [class_ "col"] $ record $ do
simpleField "Public Key" $ pubKeyH xpub
simpleField "Tracked Addresses" $ toHtml $ toText customers
div_ [class_ "row mt-5"] $ do
h5_ [class_ "text-center"] "Administration"
div_ [class_ "col"] $ do
deleteWalletButtonH
div_ [id_ "delete-result"] mempty
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/src/Cardano/Wallet/UI/Deposit/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ import Cardano.Wallet.UI.Deposit.Handlers.Wallet
)
import Cardano.Wallet.UI.Deposit.Html.Pages.Addresses
( addressElementH
, customerAddressH
)
import Cardano.Wallet.UI.Deposit.Html.Pages.Page
( Page (..)
, headerElementH
, page
)
import Cardano.Wallet.UI.Deposit.Html.Pages.Wallet
( customerAddressH
, deleteWalletModalH
( deleteWalletModalH
, walletElementH
)
import Control.Monad.Trans
Expand Down
Loading