Skip to content
Permalink
Browse files

Merge pull request #903 from input-output-hk/frontend-tweaks

Frontend tweaks.
  • Loading branch information...
krisajenkins committed Apr 11, 2019
2 parents 3e5eb91 + 0849d74 commit b07a31bf9a12abfa0de720194fd6dfa3dcad45f9
@@ -7,7 +7,7 @@ import Ace.Halogen.Component (AceEffects, AceMessage(TextChanged), AceQuery(GetE
import Ace.Types (ACE, Editor, Annotation)
import AjaxUtils (runAjaxTo)
import Analytics (Event, defaultEvent, trackEvent, ANALYTICS)
import Bootstrap (active, btn, btnGroup, btnInfo, btnPrimary, btnSmall, col6_, container, container_, empty, hidden, listGroupItem_, listGroup_, navItem_, navLink, navTabs_, noGutters, pullRight, row)
import Bootstrap (active, btn, btnGroup, btnInfo, btnPrimary, btnSmall, col_, container, container_, empty, hidden, listGroupItem_, listGroup_, navItem_, navLink, navTabs_, noGutters, pullRight, row)
import Control.Monad.Aff.Class (class MonadAff, liftAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Class (class MonadEff, liftEff)
@@ -592,7 +592,7 @@ render ::
render state = div [ class_ $ ClassName "main-frame" ]
[ container_ [ mainHeader
, div [ classes [ row, noGutters ] ]
[ col6_ [ mainTabBar state.view ]
[ col_ [ mainTabBar state.view ]
]
]
, viewContainer state.view Editor $ [ loadScriptsPane
@@ -81,8 +81,6 @@ mkSimulatorWallet currencies id =
, simulatorWalletBalance: mkInitialValue currencies 10
}

-- TODO Converting the hash to a CurrencySymbol this way may be wrong. I think maybe we have to decode it first?
-- TODO Ditto TokenNames
mkInitialValue :: Array KnownCurrency -> Int -> Value
mkInitialValue currencies initialBalance = Value { getValue: value }
where
@@ -11,7 +11,7 @@ import Data.Lens.At (at)
import Data.Lens.Index (ix)
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Ledger.Extra (LedgerMap(..))
import Ledger.Extra (LedgerMap(..), unionWith)
import Ledger.Value.TH (CurrencySymbol(..), TokenName(TokenName))
import Node.FS (FS)
import Test.Unit (TestSuite, suite, test)
@@ -23,6 +23,7 @@ all =
suite "Ledger.Extra" do
indexTests
atTests
unionWithTests

currencies :: CurrencySymbol
currencies = CurrencySymbol { unCurrencySymbol: "Currency"}
@@ -33,6 +34,9 @@ usd = TokenName { unTokenName: "USD"}
eur :: TokenName
eur = TokenName { unTokenName: "EUR"}

gbp :: TokenName
gbp = TokenName { unTokenName: "GBP"}

baseValue :: LedgerMap CurrencySymbol (LedgerMap TokenName Int)
baseValue = LedgerMap [ Tuple currencies (LedgerMap [ Tuple usd 10 ]) ]

@@ -47,6 +51,7 @@ indexTests =
# set (ix currencies <<< ix usd) 20
# preview (ix currencies <<< ix usd)
)

atTests :: forall eff. TestSuite eff
atTests =
suite "At" do
@@ -64,3 +69,28 @@ atTests =
equal Nothing (baseValue
# set (ix currencies <<< at usd) Nothing
# preview (ix currencies <<< ix usd))

unionWithTests :: forall eff. TestSuite eff
unionWithTests =
suite "unionWith" do
let
valueA = (LedgerMap [ Tuple currencies (LedgerMap [ Tuple usd 10
, Tuple eur 20
]) ])
valueB = (LedgerMap [ Tuple currencies (LedgerMap [ Tuple eur 30
, Tuple gbp 40
]) ])
test "addition" $
equalGShow
(LedgerMap [ Tuple currencies (LedgerMap [ Tuple usd 10
, Tuple eur 50
, Tuple gbp 40
]) ])
(unionWith (unionWith (+)) valueA valueB)
test "choice" $
equalGShow
(LedgerMap [ Tuple currencies (LedgerMap [ Tuple usd 10
, Tuple eur 20
, Tuple gbp 40
]) ])
(unionWith (unionWith const) valueA valueB)

0 comments on commit b07a31b

Please sign in to comment.
You can’t perform that action at this time.