own hand control - adding interactivity

This commit is contained in:
efim 2023-04-27 21:36:06 +04:00
parent 9a27a5c943
commit da9b96de84
1 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,10 @@ package industries.sunshine.planningpoker
import scala.scalajs.js
import com.raquo.laminar.api.L.{*, given}
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 {
def render(roomStateSignal: Signal[RoomStateView]): Element = {
@ -14,9 +18,11 @@ object OwnHandControls {
}
private def renderCard(value: String): Element = {
val submitVote = Fetch.get(s"/api/vote/$value").text
div(
className := "w-24 h-48 m-1 rounded-l flex justify-center items-center m-3",
className := "text-black bg-gray-50 border-black border-2",
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",
onClick.flatMap(_ => submitVote) --> Observer(resp => g.console.info(resp.toString())),
div(
className := "-rotate-45 text-xl",
value