You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.0 KiB

  1. package nova.monadic_sfx.screens
  2. import akka.actor.typed._
  3. import monix.eval.Task
  4. import nova.monadic_sfx.AppTypes
  5. import nova.monadic_sfx.implicits._
  6. import scalafx.scene.Parent
  7. import scalafx.scene.control._
  8. import scalafx.scene.layout.HBox
  9. import scalafx.scene.text.Text
  10. class HomeScreen(
  11. backend: AppTypes.HttpBackend,
  12. system: ActorSystem[SpawnProtocol.Command],
  13. onLogout: () => Task[Unit]
  14. ) {
  15. val myButton = new Button {
  16. id = "LogoutButton"
  17. text = "logout"
  18. // onAction = () => Action.asyncT(onLogout())
  19. }
  20. val myObs = myButton.observableAction
  21. // myObs.foreachL(_ => ())
  22. private lazy val root = Task {
  23. new HBox {
  24. children = List(
  25. new Text {
  26. text = "hello"
  27. },
  28. myButton
  29. )
  30. }
  31. }
  32. def render = root
  33. }
  34. object HomeScreen {
  35. def apply(
  36. backend: AppTypes.HttpBackend,
  37. system: ActorSystem[SpawnProtocol.Command],
  38. onLogout: () => Task[Unit]
  39. ): Task[Parent] =
  40. new HomeScreen(backend, system, onLogout).render
  41. }