added fixture scheduling
This commit is contained in:
@@ -6,7 +6,7 @@ import "git.haelnorr.com/h/oslstats/internal/contexts"
|
||||
import "git.haelnorr.com/h/oslstats/internal/view/baseview"
|
||||
import "fmt"
|
||||
|
||||
templ SeasonLeagueTeamDetailPage(twr *db.TeamWithRoster, fixtures []*db.Fixture, available []*db.Player) {
|
||||
templ SeasonLeagueTeamDetailPage(twr *db.TeamWithRoster, fixtures []*db.Fixture, available []*db.Player, scheduleMap map[int]*db.FixtureSchedule) {
|
||||
{{
|
||||
team := twr.Team
|
||||
season := twr.Season
|
||||
@@ -54,7 +54,7 @@ templ SeasonLeagueTeamDetailPage(twr *db.TeamWithRoster, fixtures []*db.Fixture,
|
||||
<!-- Top row: Roster (left) + Fixtures (right) -->
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||
@TeamRosterSection(twr, available)
|
||||
@teamFixturesPane(twr.Team, fixtures)
|
||||
@teamFixturesPane(twr.Team, fixtures, scheduleMap)
|
||||
</div>
|
||||
<!-- Stats below both -->
|
||||
<div class="mt-6">
|
||||
@@ -394,7 +394,7 @@ templ manageRosterModal(twr *db.TeamWithRoster, available []*db.Player, rosterPl
|
||||
</script>
|
||||
}
|
||||
|
||||
templ teamFixturesPane(team *db.Team, fixtures []*db.Fixture) {
|
||||
templ teamFixturesPane(team *db.Team, fixtures []*db.Fixture, scheduleMap map[int]*db.FixtureSchedule) {
|
||||
<section class="space-y-6">
|
||||
<!-- Upcoming -->
|
||||
<div>
|
||||
@@ -406,7 +406,7 @@ templ teamFixturesPane(team *db.Team, fixtures []*db.Fixture) {
|
||||
} else {
|
||||
<div class="bg-surface0 border border-surface1 rounded-lg overflow-hidden divide-y divide-surface1">
|
||||
for _, fixture := range fixtures {
|
||||
@teamFixtureRow(team, fixture)
|
||||
@teamFixtureRow(team, fixture, scheduleMap)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -422,7 +422,7 @@ templ teamFixturesPane(team *db.Team, fixtures []*db.Fixture) {
|
||||
</section>
|
||||
}
|
||||
|
||||
templ teamFixtureRow(team *db.Team, fixture *db.Fixture) {
|
||||
templ teamFixtureRow(team *db.Team, fixture *db.Fixture, scheduleMap map[int]*db.FixtureSchedule) {
|
||||
{{
|
||||
isHome := fixture.HomeTeamID == team.ID
|
||||
var opponent string
|
||||
@@ -431,8 +431,13 @@ templ teamFixtureRow(team *db.Team, fixture *db.Fixture) {
|
||||
} else {
|
||||
opponent = fixture.HomeTeam.Name
|
||||
}
|
||||
sched, hasSchedule := scheduleMap[fixture.ID]
|
||||
_ = sched
|
||||
}}
|
||||
<div class="px-4 py-3 flex items-center justify-between gap-3">
|
||||
<a
|
||||
href={ templ.SafeURL(fmt.Sprintf("/fixtures/%d", fixture.ID)) }
|
||||
class="px-4 py-3 flex items-center justify-between gap-3 hover:bg-surface1 transition hover:cursor-pointer block"
|
||||
>
|
||||
<div class="flex items-center gap-3 min-w-0">
|
||||
<span class="text-xs font-mono text-subtext0 bg-mantle px-2 py-0.5 rounded shrink-0">
|
||||
GW{ fmt.Sprint(*fixture.GameWeek) }
|
||||
@@ -451,10 +456,16 @@ templ teamFixtureRow(team *db.Team, fixture *db.Fixture) {
|
||||
{ opponent }
|
||||
</span>
|
||||
</div>
|
||||
<span class="text-xs text-subtext1 shrink-0">
|
||||
TBD
|
||||
</span>
|
||||
</div>
|
||||
if hasSchedule && sched.ScheduledTime != nil {
|
||||
<span class="text-xs text-green font-medium shrink-0">
|
||||
{ sched.ScheduledTime.Format("Mon 2 Jan 3:04 PM") }
|
||||
</span>
|
||||
} else {
|
||||
<span class="text-xs text-subtext1 shrink-0">
|
||||
TBD
|
||||
</span>
|
||||
}
|
||||
</a>
|
||||
}
|
||||
|
||||
templ teamStatsSection() {
|
||||
|
||||
Reference in New Issue
Block a user