package components
import (
"fmt"
"github.com/ryanhamamura/c4/game"
"github.com/starfederation/datastar-go/datastar"
)
templ Board(g *game.Game, myColor int) {
for col := 0; col < 7; col++ {
@column(g, col, myColor)
}
}
templ column(g *game.Game, colIdx int, myColor int) {
if g.Status == game.StatusInProgress && myColor == g.CurrentTurn {
for row := 0; row < 6; row++ {
@cell(g, row, colIdx)
}
} else {
for row := 0; row < 6; row++ {
@cell(g, row, colIdx)
}
}
}
templ cell(g *game.Game, row int, col int) {
}
func cellClass(g *game.Game, row, col int) string {
color := g.Board[row][col]
activeTurn := 0
if g.Status == game.StatusInProgress {
activeTurn = g.CurrentTurn
}
class := "cell"
switch color {
case 1:
class += " red"
case 2:
class += " yellow"
}
if g.IsWinningCell(row, col) {
class += " winning"
}
if color != 0 && color == activeTurn {
class += " active-turn"
}
return class
}
// suppress unused import
var _ = fmt.Sprintf