Skip to content
Permalink
Browse files

Playground: Adding a CHANGELOG banner.

Fixes #867.
  • Loading branch information...
krisajenkins committed Apr 11, 2019
1 parent 56a4d1c commit 0f3db9ef5e5c357ab8f23b7d3d8bb1fde8a465fa
Showing with 69 additions and 43 deletions.
  1. +56 −41 plutus-playground-client/src/MainFrame.purs
  2. +6 −0 web-common/src/Bootstrap.purs
  3. +7 −2 web-common/static/main.scss
@@ -13,7 +13,7 @@ import Action (simulationPane)
import AjaxUtils (ajaxErrorPane)
import AjaxUtils as AjaxUtils
import Analytics (Event, defaultEvent, trackEvent, ANALYTICS)
import Bootstrap (active, btn, btnGroup, btnSmall, col12, colMd6, container, container_, empty, floatRight, hidden, navItem_, navLink, navTabs_, noGutters, row)
import Bootstrap (active, alert, alertPrimary, btn, btnGroup, btnSmall, col12, colMd6, container, container_, empty, floatRight, hidden, navItem_, navLink, navTabs_, noGutters, row)
import Chain (evaluationPane)
import Control.Bind (bindFlipped)
import Control.Comonad (extract)
@@ -53,7 +53,7 @@ import Halogen as H
import Halogen.Component (ParentHTML)
import Halogen.ECharts (EChartsEffects)
import Halogen.ECharts as EC
import Halogen.HTML (ClassName(ClassName), HTML, a, div, div_, h1, strong_, text)
import Halogen.HTML (ClassName(..), HTML, a, div, div_, h1, strong_, text)
import Halogen.HTML.Events (onClick)
import Halogen.HTML.Properties (class_, classes, href, id_)
import Halogen.Query (HalogenM)
@@ -499,53 +499,68 @@ render ::
MonadAff (EChartsEffects (AceEffects (localStorage :: LOCALSTORAGE | aff))) m
=> State -> ParentHTML Query ChildQuery ChildSlot m
render state@(State {currentView}) =
div
[ class_ $ ClassName "main-frame" ]
[ container_
[ mainHeader
, div [ classes [ row, noGutters ] ]
[ div [ classes [ col12, colMd6 ] ] [ mainTabBar currentView ]
, div [ classes [ col12, colMd6 ] ] [ gistControls state ]
div_
[ bannerMessage
, div
[ class_ $ ClassName "main-frame" ]
[ container_
[ mainHeader
, div [ classes [ row, noGutters ] ]
[ div [ classes [ col12, colMd6 ] ] [ mainTabBar currentView ]
, div [ classes [ col12, colMd6 ] ] [ gistControls state ]
]
]
]
, viewContainer currentView Editor $
[ demoScriptsPane
, editorPane defaultContents (view _compilationResult state)
, case view _compilationResult state of
Failure error -> ajaxErrorPane error
_ -> empty
]
, viewContainer currentView Simulations $
let knownCurrencies = evalState getKnownCurrencies state
initialValue = mkInitialValue knownCurrencies 0
in
[ simulationPane
initialValue
(view _simulations state)
(view _evaluationResult state)
, case (view _evaluationResult state) of
, viewContainer currentView Editor $
[ demoScriptsPane
, editorPane defaultContents (view _compilationResult state)
, case view _compilationResult state of
Failure error -> ajaxErrorPane error
_ -> empty
]
, viewContainer currentView Transactions $
case view _evaluationResult state of
Success evaluation ->
[ evaluationPane evaluation ]
Failure error ->
[ text "Your simulation has errors. Click the "
, strong_ [ text "Simulation" ]
, text " tab above to fix them and recompile."
]
Loading -> [ icon Spinner ]
NotAsked ->
[ text "Click the "
, strong_ [ text "Simulation" ]
, text " tab above and evaluate a simulation to see some results."
]
, viewContainer currentView Simulations $
let knownCurrencies = evalState getKnownCurrencies state
initialValue = mkInitialValue knownCurrencies 0
in
[ simulationPane
initialValue
(view _simulations state)
(view _evaluationResult state)
, case (view _evaluationResult state) of
Failure error -> ajaxErrorPane error
_ -> empty
]
, viewContainer currentView Transactions $
case view _evaluationResult state of
Success evaluation ->
[ evaluationPane evaluation ]
Failure error ->
[ text "Your simulation has errors. Click the "
, strong_ [ text "Simulation" ]
, text " tab above to fix them and recompile."
]
Loading -> [ icon Spinner ]
NotAsked ->
[ text "Click the "
, strong_ [ text "Simulation" ]
, text " tab above and evaluate a simulation to see some results."
]
]
]
where
defaultContents = Map.lookup "Vesting" StaticData.demoFiles

bannerMessage :: forall p i. HTML p i
bannerMessage =
div
[ id_ "banner-message"
, classes [ alert, alertPrimary ]
]
[ text "Plutus Beta - Updated 11th April 2019 - See the "
, a
[ href ("https://github.com/input-output-hk/plutus/blob/" <> gitHead <> "/CHANGELOG") ]
[ text "CHANGELOG" ]
]

viewContainer :: forall p i. View -> View -> Array (HTML p i) -> HTML p i
viewContainer currentView targetView =
if currentView == targetView
@@ -286,6 +286,12 @@ alertInfo = ClassName "alert-info"
alertInfo_ :: forall i p. Array (HTML p i) -> HTML p i
alertInfo_ = div [ classes [ alert, alertInfo ] ]

alertPrimary :: ClassName
alertPrimary = ClassName "alert-primary"

alertPrimary_ :: forall i p. Array (HTML p i) -> HTML p i
alertPrimary_ = div [ classes [ alert, alertPrimary ] ]

empty :: forall p i. HTML p i
empty = text ""

@@ -41,8 +41,6 @@
body {
font-family: 'Open Sans', sans-serif;
background: $body-bg;
padding-top: 15px;
padding-bottom: 15px;
}

p, a, button, i, em {
@@ -236,3 +234,10 @@ h2 {
}
}
}

#banner-message {
border-radius: 0;
letter-spacing: 0.08rem;
text-transform: uppercase;
text-align: center;
}

0 comments on commit 0f3db9e

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