circe codec derivation to models

This commit is contained in:
efim
2023-04-23 15:00:00 +04:00
parent c6bfdacd1d
commit df35f09b71
7 changed files with 148 additions and 48 deletions

View File

@@ -23,7 +23,7 @@ object Main {
myId: Option[PlayerID]
)
// TODO is this ok for state creation? link with auth component and use in another?
val appStateSignal = Var(AppState(Some(RoomStateView.me.id))).signal
val appStateSignal = Var(AppState(Some(TestModels.me.id))).signal
def appElement(): Element = {
div(
@@ -32,7 +32,7 @@ object Main {
className := "h-24 w-full flex flex-for justify-center items-center bg-green-200",
p(className := "text-2xl", "Here be header"),
),
RoomView.renderRoom(RoomStateView.testRoom)
RoomView.renderRoom(TestModels.testRoom)
)
}
}

View File

@@ -40,11 +40,11 @@ object TableView {
myId: Option[PlayerID]
): CardState = {
state match {
case isOpen: VotingRound =>
case isOpen: RoundState.Voting =>
if (myId.forall(_ == id)) {
isOpen.myCard.fold(NoCard(name))(vote => Open(vote))
} else isOpen.alreadyVoted.find(_.id == id).fold(NoCard(name))(_ => CardBack)
case isClosed: ViewingRound =>
case isClosed: RoundState.Viewing =>
isClosed.votes
.get(id)
.fold {