package seasonsview import "git.haelnorr.com/h/oslstats/internal/db" import "git.haelnorr.com/h/oslstats/internal/contexts" import "git.haelnorr.com/h/oslstats/internal/permissions" import "fmt" templ SeasonLeagueFinalsPage( season *db.Season, league *db.League, bracket *db.PlayoffBracket, topGoals []*db.LeagueTopGoalScorer, topAssists []*db.LeagueTopAssister, topSaves []*db.LeagueTopSaver, allStats []*db.LeaguePlayerStats, ) { @SeasonLeagueLayout("finals", season, league) { @SeasonLeagueFinals(season, league, bracket, topGoals, topAssists, topSaves, allStats) } } templ SeasonLeagueFinals( season *db.Season, league *db.League, bracket *db.PlayoffBracket, topGoals []*db.LeagueTopGoalScorer, topAssists []*db.LeagueTopAssister, topSaves []*db.LeagueTopSaver, allStats []*db.LeaguePlayerStats, ) { {{ permCache := contexts.Permissions(ctx) canManagePlayoffs := permCache != nil && permCache.HasPermission(permissions.PlayoffsManage) hasStats := len(topGoals) > 0 || len(topAssists) > 0 || len(topSaves) > 0 || len(allStats) > 0 }}
if bracket != nil { @PlayoffBracketView(season, league, bracket) if hasStats {
@finalsStatsSection(season, league, topGoals, topAssists, topSaves, allStats)
} } else if canManagePlayoffs { @finalsNotYetConfigured(season, league) } else { @finalsNotConfigured() }
} templ finalsStatsSection( season *db.Season, league *db.League, topGoals []*db.LeagueTopGoalScorer, topAssists []*db.LeagueTopAssister, topSaves []*db.LeagueTopSaver, allStats []*db.LeaguePlayerStats, ) {

Finals Stats

if len(topGoals) > 0 || len(topAssists) > 0 || len(topSaves) > 0 {

Trophy Leaders

@topGoalScorersTable(season, league, topGoals) @topAssistersTable(season, league, topAssists)
@topSaversTable(season, league, topSaves)
} if len(allStats) > 0 {

All Finals Stats

@allStatsTable(season, league, allStats)
}
} templ finalsNotYetConfigured(season *db.Season, league *db.League) {

No Finals Configured

Set up the playoff bracket for this league.

} templ finalsNotConfigured() {

No finals configured for this league.

}