added better links to teams and players
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
package seasonsview
|
||||
|
||||
import "git.haelnorr.com/h/oslstats/internal/db"
|
||||
import "git.haelnorr.com/h/oslstats/internal/view/component/links"
|
||||
import "fmt"
|
||||
|
||||
templ SeasonLeagueTablePage(season *db.Season, league *db.League, leaderboard []*db.LeaderboardEntry) {
|
||||
@SeasonLeagueLayout("table", season, league) {
|
||||
@SeasonLeagueTable(leaderboard)
|
||||
@SeasonLeagueTable(season, league, leaderboard)
|
||||
}
|
||||
}
|
||||
|
||||
templ SeasonLeagueTable(leaderboard []*db.LeaderboardEntry) {
|
||||
templ SeasonLeagueTable(season *db.Season, league *db.League, leaderboard []*db.LeaderboardEntry) {
|
||||
if len(leaderboard) == 0 {
|
||||
<div class="bg-surface0 border border-surface1 rounded-lg p-8 text-center">
|
||||
<p class="text-subtext0 text-lg">No teams in this league yet.</p>
|
||||
@@ -43,7 +44,7 @@ templ SeasonLeagueTable(leaderboard []*db.LeaderboardEntry) {
|
||||
</thead>
|
||||
<tbody class="divide-y divide-surface1">
|
||||
for _, entry := range leaderboard {
|
||||
@leaderboardRow(entry)
|
||||
@leaderboardRow(entry, season, league)
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -52,7 +53,7 @@ templ SeasonLeagueTable(leaderboard []*db.LeaderboardEntry) {
|
||||
}
|
||||
}
|
||||
|
||||
templ leaderboardRow(entry *db.LeaderboardEntry) {
|
||||
templ leaderboardRow(entry *db.LeaderboardEntry, season *db.Season, league *db.League) {
|
||||
{{
|
||||
r := entry.Record
|
||||
goalDiff := r.GoalsFor - r.GoalsAgainst
|
||||
@@ -68,15 +69,7 @@ templ leaderboardRow(entry *db.LeaderboardEntry) {
|
||||
{ fmt.Sprint(entry.Position) }
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<div class="flex items-center gap-2">
|
||||
if entry.Team.Color != "" {
|
||||
<span
|
||||
class="w-3 h-3 rounded-full shrink-0"
|
||||
style={ "background-color: " + templ.SafeCSS(entry.Team.Color) }
|
||||
></span>
|
||||
}
|
||||
<span class="text-sm font-medium text-text">{ entry.Team.Name }</span>
|
||||
</div>
|
||||
@links.TeamLinkInSeason(entry.Team, season, league)
|
||||
</td>
|
||||
<td class="px-3 py-3 text-center text-sm text-subtext0">
|
||||
{ fmt.Sprint(r.Played) }
|
||||
|
||||
Reference in New Issue
Block a user