added team overview
This commit is contained in:
86
internal/view/teamsview/detail_seasons.templ
Normal file
86
internal/view/teamsview/detail_seasons.templ
Normal file
@@ -0,0 +1,86 @@
|
||||
package teamsview
|
||||
|
||||
import "git.haelnorr.com/h/oslstats/internal/db"
|
||||
import "git.haelnorr.com/h/oslstats/internal/view/seasonsview"
|
||||
import "fmt"
|
||||
|
||||
templ TeamDetailSeasons(team *db.Team, seasonInfos []*db.TeamSeasonInfo) {
|
||||
if len(seasonInfos) == 0 {
|
||||
<div class="bg-surface0 border border-surface1 rounded-lg p-8 text-center">
|
||||
<p class="text-subtext0 text-lg">No season history yet.</p>
|
||||
<p class="text-subtext1 text-sm mt-2">This team has not participated in any seasons.</p>
|
||||
</div>
|
||||
} else {
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
for _, info := range seasonInfos {
|
||||
@teamSeasonCard(team, info)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
templ teamSeasonCard(team *db.Team, info *db.TeamSeasonInfo) {
|
||||
{{
|
||||
detailURL := fmt.Sprintf(
|
||||
"/seasons/%s/leagues/%s/teams/%d",
|
||||
info.Season.ShortName, info.League.ShortName, team.ID,
|
||||
)
|
||||
}}
|
||||
<a
|
||||
href={ templ.SafeURL(detailURL) }
|
||||
class="bg-mantle border border-surface1 rounded-lg overflow-hidden
|
||||
hover:bg-surface0 transition hover:cursor-pointer block"
|
||||
>
|
||||
<!-- Card Header -->
|
||||
<div class="bg-surface0 border-b border-surface1 px-4 py-3 flex items-center justify-between">
|
||||
<div class="flex items-center gap-2">
|
||||
<h3 class="text-lg font-bold text-text">{ info.Season.Name }</h3>
|
||||
<span class="text-subtext0 text-sm">—</span>
|
||||
<span class="text-subtext0 text-sm">{ info.League.Name }</span>
|
||||
</div>
|
||||
@seasonsview.StatusBadge(info.Season, true, true)
|
||||
</div>
|
||||
<!-- Card Body -->
|
||||
<div class="p-4">
|
||||
<!-- Position & Points Row -->
|
||||
<div class="flex items-center justify-between mb-3">
|
||||
<div class="flex items-center gap-3">
|
||||
<!-- Position Badge -->
|
||||
<div class="flex items-center gap-1.5">
|
||||
<span class="text-xs text-subtext0 uppercase font-medium">Position</span>
|
||||
<span class="text-2xl font-bold text-text">
|
||||
{ fmt.Sprint(info.Position) }
|
||||
</span>
|
||||
<span class="text-sm text-subtext0">
|
||||
/ { fmt.Sprint(info.TotalTeams) }
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Points -->
|
||||
<div class="text-right">
|
||||
<span class="text-xs text-subtext0 uppercase font-medium">Points</span>
|
||||
<p class="text-2xl font-bold text-blue">{ fmt.Sprint(info.Record.Points) }</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Record Row -->
|
||||
<div class="grid grid-cols-4 gap-2 text-center">
|
||||
<div class="bg-surface0 rounded px-2 py-1.5">
|
||||
<p class="text-xs text-subtext0 font-medium">W</p>
|
||||
<p class="text-sm font-bold text-green">{ fmt.Sprint(info.Record.Wins) }</p>
|
||||
</div>
|
||||
<div class="bg-surface0 rounded px-2 py-1.5">
|
||||
<p class="text-xs text-subtext0 font-medium">OTW</p>
|
||||
<p class="text-sm font-bold text-teal">{ fmt.Sprint(info.Record.OvertimeWins) }</p>
|
||||
</div>
|
||||
<div class="bg-surface0 rounded px-2 py-1.5">
|
||||
<p class="text-xs text-subtext0 font-medium">OTL</p>
|
||||
<p class="text-sm font-bold text-peach">{ fmt.Sprint(info.Record.OvertimeLosses) }</p>
|
||||
</div>
|
||||
<div class="bg-surface0 rounded px-2 py-1.5">
|
||||
<p class="text-xs text-subtext0 font-medium">L</p>
|
||||
<p class="text-sm font-bold text-red">{ fmt.Sprint(info.Record.Losses) }</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
}
|
||||
Reference in New Issue
Block a user