adding websocket connection to room state
This commit is contained in:
parent
df35f09b71
commit
2c66a9a8c2
|
@ -31,7 +31,8 @@ lazy val frontend = project
|
||||||
* It provides static types for the browser DOM APIs.
|
* It provides static types for the browser DOM APIs.
|
||||||
*/
|
*/
|
||||||
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.4.0",
|
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.4.0",
|
||||||
libraryDependencies += "com.raquo" %%% "laminar" % "15.0.1"
|
libraryDependencies += "com.raquo" %%% "laminar" % "15.0.1",
|
||||||
|
libraryDependencies += "io.laminext" %%% "websocket" % "0.15.0"
|
||||||
)
|
)
|
||||||
.dependsOn(common)
|
.dependsOn(common)
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ object Main {
|
||||||
)
|
)
|
||||||
// TODO is this ok for state creation? link with auth component and use in another?
|
// TODO is this ok for state creation? link with auth component and use in another?
|
||||||
val appStateSignal = Var(AppState(Some(TestModels.me.id))).signal
|
val appStateSignal = Var(AppState(Some(TestModels.me.id))).signal
|
||||||
|
val staticStateSignal = Var(TestModels.testRoom).signal
|
||||||
|
|
||||||
def appElement(): Element = {
|
def appElement(): Element = {
|
||||||
div(
|
div(
|
||||||
|
@ -32,7 +33,7 @@ object Main {
|
||||||
className := "h-24 w-full flex flex-for justify-center items-center bg-green-200",
|
className := "h-24 w-full flex flex-for justify-center items-center bg-green-200",
|
||||||
p(className := "text-2xl", "Here be header"),
|
p(className := "text-2xl", "Here be header"),
|
||||||
),
|
),
|
||||||
RoomView.renderRoom(TestModels.testRoom)
|
RoomView.renderRoom(staticStateSignal)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@ import industries.sunshine.planningpoker.common.Models.*
|
||||||
object RoomView {
|
object RoomView {
|
||||||
// TODO this will take in signal of the room observable
|
// TODO this will take in signal of the room observable
|
||||||
// NOTE i guess "other players" would have to be in circle with 'me' as empty space in the bottom
|
// NOTE i guess "other players" would have to be in circle with 'me' as empty space in the bottom
|
||||||
def renderRoom(state: RoomStateView): Element = {
|
def renderRoom(roomStateSignal: Signal[RoomStateView]): Element = {
|
||||||
val roomStateSignal = Var(state).signal
|
|
||||||
// i want to number other players, for the star arrangement
|
// i want to number other players, for the star arrangement
|
||||||
val otherPlayers = roomStateSignal.map { state =>
|
val otherPlayers = roomStateSignal.map { state =>
|
||||||
state.players.filterNot(_.id == state.me).zipWithIndex
|
state.players.filterNot(_.id == state.me).zipWithIndex
|
||||||
|
|
Loading…
Reference in New Issue