fixtures #2
@@ -2,6 +2,7 @@ package handlers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"git.haelnorr.com/h/golib/hws"
|
||||
@@ -41,6 +42,9 @@ func SeasonPage(
|
||||
}); !ok {
|
||||
return
|
||||
}
|
||||
if season.Type == db.SeasonTypeDraft.String() {
|
||||
http.Redirect(w, r, fmt.Sprintf("/seasons/%s/leagues/%s", season.ShortName, "Draft"), http.StatusTemporaryRedirect)
|
||||
}
|
||||
renderSafely(seasonsview.DetailPage(season, leaguesWithTeams), s, r, w)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,33 +3,63 @@ package seasonsview
|
||||
import "git.haelnorr.com/h/oslstats/internal/view/baseview"
|
||||
import "git.haelnorr.com/h/oslstats/internal/db"
|
||||
import "fmt"
|
||||
import "git.haelnorr.com/h/oslstats/internal/contexts"
|
||||
import "git.haelnorr.com/h/oslstats/internal/permissions"
|
||||
|
||||
templ SeasonLeagueLayout(activeSection string, season *db.Season, league *db.League) {
|
||||
{{
|
||||
permCache := contexts.Permissions(ctx)
|
||||
canEditSeason := permCache.HasPermission(permissions.SeasonsUpdate)
|
||||
isDraftSeason := season.Type == db.SeasonTypeDraft.String()
|
||||
}}
|
||||
@baseview.Layout(fmt.Sprintf("%s - %s", season.Name, league.Name)) {
|
||||
<div class="max-w-screen-2xl mx-auto px-4 py-8">
|
||||
<div class="bg-mantle border border-surface1 rounded-lg overflow-hidden">
|
||||
<!-- Header Section -->
|
||||
<div class="bg-surface0 border-b border-surface1 px-6 py-8">
|
||||
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 mb-4">
|
||||
<div>
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
<h1 class="text-4xl font-bold text-text">{ season.Name } - { league.Name }</h1>
|
||||
<span class="text-lg font-mono text-subtext0 bg-surface1 px-2 py-0.5 rounded">{ season.ShortName }</span>
|
||||
<div>
|
||||
<div class="flex items-center gap-3 mb-2">
|
||||
if isDraftSeason {
|
||||
<h1 class="text-4xl font-bold text-text">{ season.Name }</h1>
|
||||
} else {
|
||||
<h1 class="text-4xl font-bold text-text">{ season.Name } - { league.Name }</h1>
|
||||
}
|
||||
<span class="text-lg font-mono text-subtext0 bg-surface1 px-2 py-0.5 rounded">{ season.ShortName }</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
@SeasonTypeBadge(season.Type)
|
||||
@SlapVersionBadge(season.SlapVersion)
|
||||
@StatusBadge(season, false, false)
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
@SeasonTypeBadge(season.Type)
|
||||
@SlapVersionBadge(season.SlapVersion)
|
||||
@StatusBadge(season, false, false)
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<a
|
||||
href={ templ.SafeURL("/seasons/" + season.ShortName) }
|
||||
class="rounded-lg px-4 py-2 hover:cursor-pointer text-center
|
||||
if isDraftSeason {
|
||||
if canEditSeason {
|
||||
<a
|
||||
href={ templ.SafeURL("/seasons/" + season.ShortName + "/edit") }
|
||||
class="rounded-lg px-4 py-2 hover:cursor-pointer text-center
|
||||
bg-blue hover:bg-blue/75 text-mantle transition"
|
||||
>
|
||||
Edit
|
||||
</a>
|
||||
}
|
||||
<a
|
||||
href="/seasons"
|
||||
class="rounded-lg px-4 py-2 hover:cursor-pointer text-center
|
||||
bg-surface1 hover:bg-surface2 text-text transition"
|
||||
>
|
||||
Back to Season
|
||||
</a>
|
||||
>
|
||||
Back to Seasons
|
||||
</a>
|
||||
} else {
|
||||
<a
|
||||
href={ templ.SafeURL("/seasons/" + season.ShortName) }
|
||||
class="rounded-lg px-4 py-2 hover:cursor-pointer text-center
|
||||
bg-surface1 hover:bg-surface2 text-text transition"
|
||||
>
|
||||
Back to Season
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<!-- Season Dates -->
|
||||
|
||||
Reference in New Issue
Block a user