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.

64 lines
1.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. package outwatchapp.pages
  2. import cats.syntax.eq._
  3. import com.softwaremill.tagging._
  4. import monix.bio.Task
  5. import outwatch._
  6. import outwatch.dsl._
  7. import outwatchapp.components.ChartjsDemo
  8. import outwatchapp.components.CounterDemo
  9. import outwatchapp.components.SweetAlertDemo
  10. class HomePage(
  11. counterDemo: VNode @@ CounterDemo,
  12. chartDemo: VNode @@ ChartjsDemo
  13. ) {
  14. val loginDemo = for {
  15. res <- SweetAlertDemo.loginPrompt.map(_.value.toOption)
  16. _ <- Task(println(s"Got $res"))
  17. _ <-
  18. if (res === Some("foo" -> "bar")) SweetAlertDemo.successPrompt
  19. else SweetAlertDemo.failurePrompt
  20. } yield ()
  21. def render = Task.deferAction(implicit s =>
  22. Task(
  23. div(
  24. div(cls := "title", "Home"),
  25. div(
  26. cls := "card",
  27. div(
  28. cls := "card-body",
  29. counterDemo,
  30. chartDemo,
  31. div(
  32. cls := "text-center",
  33. button(
  34. cls := "btn btn-primary",
  35. onClick.preventDefault.doAsync(loginDemo),
  36. "Login"
  37. )
  38. ),
  39. p(
  40. cls := "text-white",
  41. div(
  42. "hm",
  43. htmlTag("blockQuote")(
  44. cls := "blockquote",
  45. p(
  46. cls := "mb-0",
  47. "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante."
  48. ),
  49. footer(
  50. cls := "blockquote-footer",
  51. "Someone famous in ",
  52. cite(title := "Source Title", "Source Title")
  53. )
  54. )
  55. )
  56. )
  57. )
  58. )
  59. )
  60. )
  61. )
  62. }