46 lines
1.2 KiB
Plaintext
46 lines
1.2 KiB
Plaintext
package seasonsview
|
|
|
|
import "git.haelnorr.com/h/oslstats/internal/db"
|
|
|
|
// StatusBadge renders a season status badge
|
|
// Parameters:
|
|
// - season: pointer to db.Season
|
|
// - compact: bool - true for list view (text only, small), false for detail view (icon + text, large)
|
|
// - useShortLabels: bool - true for "Active/Finals", false for "In Progress/Finals in Progress"
|
|
templ StatusBadge(season *db.Season, compact bool, useShortLabels bool) {
|
|
{{
|
|
seasonStatus := season.GetStatus()
|
|
status := ""
|
|
statusBg := ""
|
|
|
|
switch seasonStatus {
|
|
case db.StatusUpcoming:
|
|
status = "Upcoming"
|
|
statusBg = "bg-blue"
|
|
case db.StatusInProgress:
|
|
if useShortLabels {
|
|
status = "Active"
|
|
} else {
|
|
status = "In Progress"
|
|
}
|
|
statusBg = "bg-green"
|
|
case db.StatusFinalsSoon:
|
|
status = "Finals Soon"
|
|
statusBg = "bg-peach"
|
|
case db.StatusFinals:
|
|
if useShortLabels {
|
|
status = "Finals"
|
|
} else {
|
|
status = "Finals in Progress"
|
|
}
|
|
statusBg = "bg-yellow"
|
|
case db.StatusCompleted:
|
|
status = "Completed"
|
|
statusBg = "bg-teal"
|
|
}
|
|
}}
|
|
<span class={ "inline-block px-3 py-1 rounded-full text-sm font-semibold text-mantle " + statusBg }>
|
|
{ status }
|
|
</span>
|
|
}
|