package components import ( "fmt" "github.com/ryanhamamura/games/chat" "github.com/starfederation/datastar-go/datastar" ) // ColorFunc resolves a player slot to a CSS color string. type ColorFunc func(slot int) string // Config holds the game-specific settings for rendering a chat component. type Config struct { // CSSPrefix is used for element IDs and CSS classes (e.g. "c4" or "snake"). CSSPrefix string // PostURL is the URL to POST chat messages to (e.g. "/games/{id}/chat"). PostURL string // Color resolves a player slot to a CSS color string. Color ColorFunc // StopKeyPropagation adds data-on:keydown.stop="" to the input to prevent // key events from propagating (needed for snake to avoid steering while typing). StopKeyPropagation bool } templ Chat(messages []chat.Message, cfg Config) {