package nova.monadic_sfx.screens import nova.monadic_sfx.AppTypes import scalafx.scene.control.TextField import scalafx.scene.control._ import scalafx.scene.layout.VBox import scalafx.scene.Node import scalafx.Includes._ import scalafx.scene.layout.HBox import scalafx.scene.text.Text import scalafx.scene.Parent import scalafx.application.JFXApp.PrimaryStage import monix.eval.Task import nova.monadic_sfx.util.Action class HomeScreen( backend: AppTypes.HttpBackend, system: akka.actor.ActorSystem, onLogout: () => Task[Unit] ) { private lazy val root = Task.deferAction { implicit s => Task { new HBox { children = List( new Text { text = "hello" }, new Button { text = "logout" onAction = () => Action.asyncT(onLogout()) } ) } } } def render = root } object HomeScreen { def apply( backend: AppTypes.HttpBackend, system: akka.actor.ActorSystem, onLogout: () => Task[Unit] ): Task[Parent] = new HomeScreen(backend, system, onLogout).render }