package pages
import (
"fmt"
"github.com/ryanhamamura/games/chat"
chatcomponents "github.com/ryanhamamura/games/chat/components"
"github.com/ryanhamamura/games/connect4"
"github.com/ryanhamamura/games/features/c4game/components"
sharedcomponents "github.com/ryanhamamura/games/features/common/components"
"github.com/ryanhamamura/games/features/common/layouts"
)
templ GamePage(g *connect4.Game, myColor int, messages []chat.Message, chatCfg chatcomponents.Config) {
@layouts.Base("Connect 4") {
@GameContent(g, myColor, messages, chatCfg)
}
}
templ GameContent(g *connect4.Game, myColor int, messages []chat.Message, chatCfg chatcomponents.Config) {
@sharedcomponents.BackToLobby()
@sharedcomponents.StealthTitle("text-3xl font-bold")
@components.PlayerInfo(g, myColor)
@components.StatusBanner(g, myColor)
@components.Board(g, myColor)
@chatcomponents.Chat(messages, chatCfg)
if g.Status == connect4.StatusWaitingForPlayer {
@components.InviteLink(g.ID)
}
}
templ JoinPage(gameID string) {
@layouts.Base("Connect 4 - Join") {
@sharedcomponents.GameJoinPrompt(
"/login?return_url=/games/"+gameID,
"/register?return_url=/games/"+gameID,
"/games/"+gameID,
)
}
}
templ NicknamePage(gameID string) {
@layouts.Base("Connect 4 - Join") {
@sharedcomponents.NicknamePrompt("/games/" + gameID + "/join")
}
}