more refactors

This commit is contained in:
2026-02-08 19:57:12 +11:00
parent e94a212a08
commit d038f7a42d
17 changed files with 334 additions and 308 deletions

View File

@@ -2,5 +2,5 @@ package admin
import "git.haelnorr.com/h/oslstats/internal/db"
templ UserList(users *db.Users) {
templ UserList(users *db.List[db.User]) {
}

View File

@@ -4,7 +4,7 @@ import "git.haelnorr.com/h/oslstats/internal/view/layout"
import "git.haelnorr.com/h/oslstats/internal/view/component/admin"
import "git.haelnorr.com/h/oslstats/internal/db"
templ AdminDashboard(users *db.Users) {
templ AdminDashboard(users *db.List[db.User]) {
@layout.AdminDashboard()
@admin.UserList(users)
}

View File

@@ -9,7 +9,7 @@ import "fmt"
import "time"
import "github.com/uptrace/bun"
templ SeasonsPage(seasons *db.SeasonList) {
templ SeasonsPage(seasons *db.List[db.Season]) {
@layout.Global("Seasons") {
<div class="max-w-screen-2xl mx-auto px-2">
@SeasonsList(seasons)
@@ -17,7 +17,7 @@ templ SeasonsPage(seasons *db.SeasonList) {
}
}
templ SeasonsList(seasons *db.SeasonList) {
templ SeasonsList(seasons *db.List[db.Season]) {
{{
sortOpts := []db.OrderOpts{
{
@@ -69,14 +69,14 @@ templ SeasonsList(seasons *db.SeasonList) {
@sort.Dropdown(seasons.PageOpts, sortOpts)
</div>
<!-- Results section -->
if len(seasons.Seasons) == 0 {
if len(seasons.Items) == 0 {
<div class="bg-mantle border border-surface1 rounded-lg p-8 text-center">
<p class="text-subtext0 text-lg">No seasons found</p>
</div>
} else {
<!-- Card grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
for _, s := range seasons.Seasons {
for _, s := range seasons.Items {
<a
class="bg-mantle border border-surface1 rounded-lg p-6 hover:bg-surface0 transition-colors"
href={ fmt.Sprintf("/seasons/%s", s.ShortName) }