own hand control - adding interactivity
This commit is contained in:
parent
9a27a5c943
commit
da9b96de84
|
@ -3,6 +3,10 @@ package industries.sunshine.planningpoker
|
||||||
import scala.scalajs.js
|
import scala.scalajs.js
|
||||||
import com.raquo.laminar.api.L.{*, given}
|
import com.raquo.laminar.api.L.{*, given}
|
||||||
import industries.sunshine.planningpoker.common.Models.*
|
import industries.sunshine.planningpoker.common.Models.*
|
||||||
|
import io.laminext.fetch.Fetch
|
||||||
|
import scala.scalajs.js.Dynamic.{global => g}
|
||||||
|
|
||||||
|
import concurrent.ExecutionContext.Implicits.global
|
||||||
|
|
||||||
object OwnHandControls {
|
object OwnHandControls {
|
||||||
def render(roomStateSignal: Signal[RoomStateView]): Element = {
|
def render(roomStateSignal: Signal[RoomStateView]): Element = {
|
||||||
|
@ -14,9 +18,11 @@ object OwnHandControls {
|
||||||
}
|
}
|
||||||
|
|
||||||
private def renderCard(value: String): Element = {
|
private def renderCard(value: String): Element = {
|
||||||
|
val submitVote = Fetch.get(s"/api/vote/$value").text
|
||||||
|
|
||||||
div(
|
div(
|
||||||
className := "w-24 h-48 m-1 rounded-l flex justify-center items-center m-3",
|
className := "cursor-pointer w-24 h-48 m-1 rounded-l flex justify-center items-center m-3 text-black bg-gray-50 border-black border-2",
|
||||||
className := "text-black bg-gray-50 border-black border-2",
|
onClick.flatMap(_ => submitVote) --> Observer(resp => g.console.info(resp.toString())),
|
||||||
div(
|
div(
|
||||||
className := "-rotate-45 text-xl",
|
className := "-rotate-45 text-xl",
|
||||||
value
|
value
|
||||||
|
|
Loading…
Reference in New Issue