chore: gitignore generated _templ.go files, track .templ sources
Generated _templ.go files are deterministic output from .templ sources, same as output.css from input.css. Remove them from version control to reduce diff noise and merge conflicts. Add build:templ and live:templ tasks to the Taskfile so generation happens as part of the build.
This commit is contained in:
47
features/c4game/pages/game.templ
Normal file
47
features/c4game/pages/game.templ
Normal file
@@ -0,0 +1,47 @@
|
||||
package pages
|
||||
|
||||
import (
|
||||
"github.com/ryanhamamura/c4/features/c4game/components"
|
||||
sharedcomponents "github.com/ryanhamamura/c4/features/common/components"
|
||||
"github.com/ryanhamamura/c4/features/common/layouts"
|
||||
"github.com/ryanhamamura/c4/game"
|
||||
"github.com/starfederation/datastar-go/datastar"
|
||||
)
|
||||
|
||||
templ GamePage(g *game.Game, myColor int, messages []components.ChatMessage) {
|
||||
@layouts.Base("Connect 4") {
|
||||
<main
|
||||
class="flex flex-col items-center gap-4 p-4"
|
||||
data-signals="{chatMsg: ''}"
|
||||
data-init={ datastar.GetSSE("/games/%s/events", g.ID) }
|
||||
>
|
||||
@sharedcomponents.BackToLobby()
|
||||
@sharedcomponents.StealthTitle("text-3xl font-bold")
|
||||
@components.PlayerInfo(g, myColor)
|
||||
@components.StatusBanner(g, myColor)
|
||||
<div class="c4-game-area">
|
||||
@components.Board(g, myColor)
|
||||
@components.Chat(messages, g.ID)
|
||||
</div>
|
||||
if g.Status == game.StatusWaitingForPlayer {
|
||||
@components.InviteLink(g.ID)
|
||||
}
|
||||
</main>
|
||||
}
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user