Skip to content

Commit

Permalink
Playground: Adding a CHANGELOG banner.
Browse files Browse the repository at this point in the history
Fixes #867.
  • Loading branch information
krisajenkins committed Apr 11, 2019
1 parent 56a4d1c commit 0f3db9e
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 43 deletions.
97 changes: 56 additions & 41 deletions plutus-playground-client/src/MainFrame.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions web-common/src/Bootstrap.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand Down
9 changes: 7 additions & 2 deletions web-common/static/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.