Skip to content

Commit

Permalink
Deposit UI random embellishments
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed Sep 20, 2024
1 parent 53723c3 commit 491824d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/ui/src/Cardano/Wallet/UI/Common/Html/Pages/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module Cardano.Wallet.UI.Common.Html.Pages.Lib
, showAda
, showAdaOfLoveLace
, showThousandDots
, fadeInId
)
where

Expand Down Expand Up @@ -58,6 +59,7 @@ import Lucid
, id_
, role_
, scope_
, style_
, table_
, td_
, tr_
Expand Down Expand Up @@ -132,6 +134,10 @@ fieldHtml as = field as . toHtml
fieldShow :: (Show a, Monad m) => [Attribute] -> Text -> a -> ListOf (AssocRow m)
fieldShow attrs key val = field attrs (toHtml key) (toHtml $ show val)

fadeInId :: Monad m => HtmlT m ()
fadeInId = style_ [] $ toHtml @Text
".smooth.htmx-added { opacity: 0; } .smooth { opacity: 1; transition: opacity 1s ease-out; }"

-- | A tag that can self populate with data that is fetched as GET from a link
-- whenever some specific events are received from an SSE endpoint.
-- It also self populate on load.
Expand All @@ -156,6 +162,7 @@ sseH link target events = do
[ id_ target
, hxGet_ $ linkText link
, hxTrigger_ "load"
, class_ "smooth"
]
""
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import Cardano.Wallet.UI.Common.Html.Htmx
import Cardano.Wallet.UI.Common.Html.Lib
( linkText
)
import Cardano.Wallet.UI.Common.Html.Pages.Lib
( fadeInId
)
import Data.Text
( Text
)
Expand Down Expand Up @@ -109,7 +112,9 @@ pageFromBodyH faviconLink PageConfig{..} body =
favicon faviconLink
useHtmxVersion (1, 9, 12)
useHtmxExtension "json-enc"
body_ body
body_ $ do
fadeInId
body

data PageConfig = PageConfig
{ prefix :: Text
Expand Down
3 changes: 2 additions & 1 deletion lib/ui/src/Cardano/Wallet/UI/Deposit/Html/Pages/Wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ instance Show WalletPresent where
show WalletClosing = "WalletClosing"

walletH :: WHtml ()
walletH = sseH walletLink "wallet" ["wallet"]
walletH = do
sseH walletLink "wallet" ["wallet"]

base64 :: ByteString -> ByteString
base64 = convertToBase Base64
Expand Down

0 comments on commit 491824d

Please sign in to comment.