Skip to content

Commit

Permalink
Fix “open project” button
Browse files Browse the repository at this point in the history
  • Loading branch information
hrajchert committed Jun 30, 2021
1 parent 4f2a9e3 commit c9ff2ce
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions marlowe-playground-client/src/Home.purs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
module Home where

import Prelude hiding (div)
import Auth (_GithubUser, authStatusAuthRole)
import Data.Lens (has)
import Data.Maybe (Maybe(..))
import Halogen (ClassName(..), ComponentHTML)
import Halogen.Classes (arrowLeftDown, arrowLeftUp, arrowRightDown, arrowRightUp, flex, marloweLogo, newProjectBlocklyIcon, newProjectHaskellIcon, newProjectJavascriptIcon, primaryButton, secondaryButton, simulationIcon, simulationIconBlack, vl)
import Halogen (ComponentHTML)
import Halogen.Classes (arrowLeftDown, arrowLeftUp, arrowRightDown, arrowRightUp, marloweLogo, newProjectBlocklyIcon, newProjectHaskellIcon, newProjectJavascriptIcon, primaryButton, secondaryButton, simulationIconBlack)
import Halogen.Css (classNames)
import Halogen.HTML (a, button, div, h1, h2_, hr_, img, p_, span, span_, text)
import Halogen.HTML (a, button, div, h1, img, span, span_, text)
import Halogen.HTML.Events (onClick)
import Halogen.HTML.Properties (href, src, target)
import MainFrame.Types (Action(..), ChildSlots, ModalView(..), State)
import MainFrame.Types (Action(..), ChildSlots, ModalView(..), State, _authStatus)
import Network.RemoteData (_Success)
import NewProject.Types as NewProject
import Projects.Types (Lang(..))

Expand All @@ -19,7 +22,11 @@ render state =
, div [ classNames [ "mb-6" ] ]
[ button
[ classNames (secondaryButton <> [ "mr-small", "w-56", "text-base", "cursor-pointer" ])
, onClick ((const <<< Just <<< OpenModal) NewProject)
, onClick \_ ->
if has (_authStatus <<< _Success <<< authStatusAuthRole <<< _GithubUser) state then
Just $ OpenModal OpenProject
else
Just $ OpenModal $ GithubLogin (OpenModal OpenProject)
]
[ text "Open existing project" ]
, button
Expand Down

0 comments on commit c9ff2ce

Please sign in to comment.