package playersview
import "git.haelnorr.com/h/oslstats/internal/db"
import "git.haelnorr.com/h/oslstats/internal/view/baseview"
import "fmt"
templ PlayerLayout(activeSection string, player *db.Player, isOwner bool) {
@baseview.Layout(player.DisplayName() + " - Player Profile") {
{ player.DisplayName() }
if isOwner {
Your Profile
}
if player.SlapID != nil {
Slapshot ID: { fmt.Sprintf("%d", *player.SlapID) }
}
if player.SlapID == nil && isOwner {
@SlapIDSection(player, isOwner)
}
{ children... }
}
}
templ playerNavItem(section string, label string, activeSection string, player *db.Player) {
{{
isActive := section == activeSection
baseClasses := "inline-block px-6 py-3 transition-colors cursor-pointer border-b-2"
activeClasses := "border-blue text-blue font-semibold"
inactiveClasses := "border-transparent text-subtext0 hover:text-text hover:border-surface2"
url := fmt.Sprintf("/players/%d/%s", player.ID, section)
}}
{ label }
}
// Full page wrappers (for GET requests / direct navigation)
templ PlayerStatsPage(player *db.Player, isOwner bool, stats *db.PlayerAllTimeStats, seasons []*db.Season, teams []*db.Team) {
@PlayerLayout("stats", player, isOwner) {
@PlayerStatsTab(player, stats, seasons, teams, "", 0)
}
}
templ PlayerTeamsPage(player *db.Player, isOwner bool, teamInfos []*db.PlayerTeamInfo) {
@PlayerLayout("teams", player, isOwner) {
@PlayerTeamsTab(teamInfos)
}
}
templ PlayerSeasonsPage(player *db.Player, isOwner bool, seasonInfos []*db.PlayerSeasonInfo) {
@PlayerLayout("seasons", player, isOwner) {
@PlayerSeasonsTab(seasonInfos)
}
}