Commit b6001e18 authored by Cédric F.'s avatar Cédric F.

Add money symbol via CSS

parent 9585b23e
Pipeline #13791460 passed with stage
in 1 minute and 27 seconds
/usr/bin/bitcoin-qt -par=-1 -server -txindex -rpcuser=Ijxzsrmsrlqhddgkfj55fgkceMcstsoazikasesuc -rpcpassword=sta2bjbfyqctytqujolcatbvvksjulrUqrzc6wuMc
bitcoind -par=-1 -server -txindex -rpcuser=root -rpcpassword=secret
......@@ -88,8 +88,8 @@ http {
add_header X-Cache-Status $upstream_cache_status;
# proxy_pass https://localhost:9109/; # dcrd
proxy_pass http://localhost:8332/; # bitcoind
proxy_pass https://localhost:9109/; # dcrd
# proxy_pass http://localhost:8332/; # bitcoind
}
location / {
......
......@@ -58,6 +58,10 @@
background: orange;
box-shadow: 0 0 10px 5px orange;
}
.amount::after {
content: " DCR";
}
</style>
</head>
<body class="bg-black text-white">
......
......@@ -62,9 +62,9 @@ view model =
]
else
[ dlBuilder <|
[ ( "total received", Maybe.map dcrAmount <| totalReceived model )
, ( "total sent", Maybe.map dcrAmount <| totalSent model )
, ( "balance", Maybe.map dcrAmount <| balance model )
[ ( "total received", Maybe.map formatAmount <| totalReceived model )
, ( "total sent", Maybe.map formatAmount <| totalSent model )
, ( "balance", Maybe.map formatAmount <| balance model )
]
]
in
......@@ -100,11 +100,11 @@ view model =
[ td [] [ a [ href tx.hash ] [ text <| shortHash tx.hash ] ]
, td [] [ text tx.type_ ]
, td []
[ text <|
(Transaction.sentToAddress model.address tx
|> Maybe.map dcrAmount
|> Maybe.withDefault "?"
)
[ (Transaction.sentToAddress model.address tx
|> Maybe.map formatAmount
|> Maybe.withDefault
(span [] [ text "?" ])
)
]
, td [] [ text <| Transaction.formatTime tx ]
, td [] [ text <| toString tx.confirmations ]
......
......@@ -111,16 +111,32 @@ view model =
[ class "card bg-dark" ]
[ h5 [ class "card-header" ]
[ span [] [ text <| "Block " ++ model.hash ]
, dcrDataLink <| "block" ++ model.hash
, dcrDataLink <| "block/" ++ model.hash
]
, div [ class "card-body" ]
[ p [ class "card-text" ]
[ dlBuilder <|
[ ( "height", Just <| toString model.height )
, ( "time", Just <| TimeExtra.toISOString model.time )
, ( "confirmations", Just <| toString model.confirmations )
, ( "size", Just <| toString model.size ++ " bytes" )
, ( "ticket price", Maybe.map dcrAmount model.ticketPrice )
[ ( "height"
, Just <|
span []
[ text <| toString model.height ]
)
, ( "time"
, Just <|
span []
[ text <| TimeExtra.toISOString model.time ]
)
, ( "confirmations"
, Just <|
span []
[ text <| toString model.confirmations ]
)
, ( "size"
, Just <|
span []
[ text <| toString model.size ++ " bytes" ]
)
, ( "ticket price", Maybe.map formatAmount model.ticketPrice )
]
]
]
......
......@@ -159,7 +159,7 @@ view model =
(\vOut ->
li [ class "list-group-item bg-secondary" ]
[ span [ class "badge badge-info" ] [ text vOut.scriptPubKey.type_ ]
, span [ class "float-right" ] [ text <| dcrAmount vOut.value ]
, span [ class "float-right" ] [ formatAmount vOut.value ]
, formatAddresses vOut.scriptPubKey
, code [ class "mt-2" ] [ text vOut.scriptPubKey.asm ]
]
......@@ -187,12 +187,13 @@ view model =
, dt [ class "col-3 text-right" ] [ text "size" ]
, dd [ class "col-9" ] [ text <| toString model.size ++ " bytes" ]
, dt [ class "col-3 text-right" ] [ text "total sent" ]
, dd [ class "col-9" ] [ text <| dcrAmount (totalSent model) ]
, dd [ class "col-9" ] [ formatAmount (totalSent model) ]
, dt [ class "col-3 text-right" ] [ text "fee" ]
, dd [ class "col-9" ]
[ text <|
dcrAmount (fee model)
++ (" (" ++ (dcrAmount (feePerKb model)) ++ "/kB)")
[ formatAmount (fee model)
, span [] [ text " (" ]
, formatAmount (feePerKb model)
, span [] [ text "/kB)" ]
]
]
]
......
......@@ -16,14 +16,15 @@ pluralize count singular =
phrase ++ "s"
dcrAmount : Float -> String
dcrAmount float =
formatAmount : Float -> Html a
formatAmount float =
let
rounded =
-- remove any floating point arithmetic errors
float * 1.0e8 |> round |> toFloat |> (flip (/)) 1.0e8
in
(toString rounded) ++ " DCR"
span [ class "amount" ]
[ text <| toString rounded ]
shortHash : String -> String
......@@ -31,7 +32,7 @@ shortHash hash =
String.concat [ String.left 2 hash, "...", String.right 2 hash ]
dlBuilder : List ( String, Maybe String ) -> Html a
dlBuilder : List ( String, Maybe (Html a) ) -> Html a
dlBuilder list =
let
filter ( label, value ) =
......@@ -42,7 +43,7 @@ dlBuilder list =
Just value ->
Just <|
[ dt [ class "col-3 text-right" ] [ text label ]
, dd [ class "col-9" ] [ text value ]
, dd [ class "col-9" ] [ value ]
]
in
dl [ class "row" ] (List.concat <| List.filterMap filter list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment