forfeits added
This commit is contained in:
@@ -220,11 +220,28 @@ templ fixtureResultDisplay(fixture *db.Fixture, result *db.FixtureResult) {
|
||||
isOT := strings.EqualFold(result.EndReason, "Overtime")
|
||||
homeWon := result.Winner == "home"
|
||||
awayWon := result.Winner == "away"
|
||||
isForfeit := result.IsForfeit
|
||||
isMutualForfeit := isForfeit && result.ForfeitType != nil && *result.ForfeitType == "mutual"
|
||||
isOutrightForfeit := isForfeit && result.ForfeitType != nil && *result.ForfeitType == "outright"
|
||||
_ = isMutualForfeit
|
||||
forfeitTeamName := ""
|
||||
if isOutrightForfeit && result.ForfeitTeam != nil {
|
||||
if *result.ForfeitTeam == "home" {
|
||||
forfeitTeamName = fixture.HomeTeam.Name
|
||||
} else {
|
||||
forfeitTeamName = fixture.AwayTeam.Name
|
||||
}
|
||||
}
|
||||
}}
|
||||
<div class="bg-mantle border border-surface1 rounded-lg overflow-hidden">
|
||||
<div class="bg-surface0 border-b border-surface1 px-4 py-3 flex items-center justify-between">
|
||||
<h2 class="text-lg font-bold text-text">Match Result</h2>
|
||||
<div class="flex items-center gap-2">
|
||||
if isForfeit {
|
||||
<span class="px-2 py-0.5 bg-red/20 text-red rounded text-xs font-medium">
|
||||
Forfeited
|
||||
</span>
|
||||
}
|
||||
if result.Finalized {
|
||||
<span class="px-2 py-0.5 bg-green/20 text-green rounded text-xs font-medium">
|
||||
Finalized
|
||||
@@ -263,55 +280,154 @@ templ fixtureResultDisplay(fixture *db.Fixture, result *db.FixtureResult) {
|
||||
<p class="text-red/80 text-xs">{ *result.TamperingReason }</p>
|
||||
</div>
|
||||
}
|
||||
<!-- Score Display -->
|
||||
<div class="flex items-center justify-center gap-6 py-4">
|
||||
<div class="flex items-center gap-3">
|
||||
if homeWon {
|
||||
<span class="text-2xl">🏆</span>
|
||||
if isForfeit {
|
||||
<!-- Forfeit Display -->
|
||||
<div class="flex flex-col items-center py-4 space-y-4">
|
||||
if isMutualForfeit {
|
||||
<div class="flex items-center justify-center gap-6">
|
||||
<div class="flex items-center gap-3">
|
||||
if fixture.HomeTeam.Color != "" {
|
||||
<span
|
||||
class="px-2.5 py-1 rounded text-sm font-bold"
|
||||
style={ fmt.Sprintf("background-color: %s22; color: %s; border: 1px solid %s44",
|
||||
fixture.HomeTeam.Color, fixture.HomeTeam.Color, fixture.HomeTeam.Color) }
|
||||
>
|
||||
{ fixture.HomeTeam.ShortName }
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2.5 py-1 bg-surface1 text-text rounded text-sm font-bold">
|
||||
{ fixture.HomeTeam.ShortName }
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<div class="flex flex-col items-center">
|
||||
<span class="px-3 py-1.5 bg-peach/20 text-peach rounded-lg text-sm font-bold">
|
||||
MUTUAL FORFEIT
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
if fixture.AwayTeam.Color != "" {
|
||||
<span
|
||||
class="px-2.5 py-1 rounded text-sm font-bold"
|
||||
style={ fmt.Sprintf("background-color: %s22; color: %s; border: 1px solid %s44",
|
||||
fixture.AwayTeam.Color, fixture.AwayTeam.Color, fixture.AwayTeam.Color) }
|
||||
>
|
||||
{ fixture.AwayTeam.ShortName }
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2.5 py-1 bg-surface1 text-text rounded text-sm font-bold">
|
||||
{ fixture.AwayTeam.ShortName }
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-sm text-subtext0">Both teams receive an overtime loss</p>
|
||||
} else if isOutrightForfeit {
|
||||
<div class="flex items-center justify-center gap-6">
|
||||
<div class="flex items-center gap-3">
|
||||
if homeWon {
|
||||
<span class="text-2xl">🏆</span>
|
||||
}
|
||||
if fixture.HomeTeam.Color != "" {
|
||||
<span
|
||||
class="px-2.5 py-1 rounded text-sm font-bold"
|
||||
style={ fmt.Sprintf("background-color: %s22; color: %s; border: 1px solid %s44",
|
||||
fixture.HomeTeam.Color, fixture.HomeTeam.Color, fixture.HomeTeam.Color) }
|
||||
>
|
||||
{ fixture.HomeTeam.ShortName }
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2.5 py-1 bg-surface1 text-text rounded text-sm font-bold">
|
||||
{ fixture.HomeTeam.ShortName }
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<div class="flex flex-col items-center">
|
||||
<span class="px-3 py-1.5 bg-red/20 text-red rounded-lg text-sm font-bold">
|
||||
FORFEIT
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
if fixture.AwayTeam.Color != "" {
|
||||
<span
|
||||
class="px-2.5 py-1 rounded text-sm font-bold"
|
||||
style={ fmt.Sprintf("background-color: %s22; color: %s; border: 1px solid %s44",
|
||||
fixture.AwayTeam.Color, fixture.AwayTeam.Color, fixture.AwayTeam.Color) }
|
||||
>
|
||||
{ fixture.AwayTeam.ShortName }
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2.5 py-1 bg-surface1 text-text rounded text-sm font-bold">
|
||||
{ fixture.AwayTeam.ShortName }
|
||||
</span>
|
||||
}
|
||||
if awayWon {
|
||||
<span class="text-2xl">🏆</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="text-sm text-subtext0">
|
||||
{ forfeitTeamName } forfeited the match
|
||||
</p>
|
||||
}
|
||||
if fixture.HomeTeam.Color != "" {
|
||||
<span
|
||||
class="px-2.5 py-1 rounded text-sm font-bold"
|
||||
style={ fmt.Sprintf("background-color: %s22; color: %s; border: 1px solid %s44",
|
||||
fixture.HomeTeam.Color, fixture.HomeTeam.Color, fixture.HomeTeam.Color) }
|
||||
>
|
||||
{ fixture.HomeTeam.ShortName }
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2.5 py-1 bg-surface1 text-text rounded text-sm font-bold">
|
||||
{ fixture.HomeTeam.ShortName }
|
||||
</span>
|
||||
}
|
||||
<span class="text-4xl font-bold text-text">{ fmt.Sprint(result.HomeScore) }</span>
|
||||
</div>
|
||||
<div class="flex flex-col items-center">
|
||||
<span class="text-4xl text-subtext0 font-light leading-none">–</span>
|
||||
if isOT {
|
||||
<span class="px-1.5 py-0.5 bg-peach/20 text-peach rounded text-xs font-semibold mt-1">
|
||||
OT
|
||||
</span>
|
||||
if result.ForfeitReason != nil && *result.ForfeitReason != "" {
|
||||
<div class="bg-surface0 border border-surface1 rounded-lg p-3 max-w-md w-full">
|
||||
<p class="text-xs text-subtext1 font-medium mb-1">Reason</p>
|
||||
<p class="text-sm text-subtext0">{ *result.ForfeitReason }</p>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="text-4xl font-bold text-text">{ fmt.Sprint(result.AwayScore) }</span>
|
||||
if fixture.AwayTeam.Color != "" {
|
||||
<span
|
||||
class="px-2.5 py-1 rounded text-sm font-bold"
|
||||
style={ fmt.Sprintf("background-color: %s22; color: %s; border: 1px solid %s44",
|
||||
fixture.AwayTeam.Color, fixture.AwayTeam.Color, fixture.AwayTeam.Color) }
|
||||
>
|
||||
{ fixture.AwayTeam.ShortName }
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2.5 py-1 bg-surface1 text-text rounded text-sm font-bold">
|
||||
{ fixture.AwayTeam.ShortName }
|
||||
</span>
|
||||
}
|
||||
if awayWon {
|
||||
<span class="text-2xl">🏆</span>
|
||||
}
|
||||
} else {
|
||||
<!-- Normal Score Display -->
|
||||
<div class="flex items-center justify-center gap-6 py-4">
|
||||
<div class="flex items-center gap-3">
|
||||
if homeWon {
|
||||
<span class="text-2xl">🏆</span>
|
||||
}
|
||||
if fixture.HomeTeam.Color != "" {
|
||||
<span
|
||||
class="px-2.5 py-1 rounded text-sm font-bold"
|
||||
style={ fmt.Sprintf("background-color: %s22; color: %s; border: 1px solid %s44",
|
||||
fixture.HomeTeam.Color, fixture.HomeTeam.Color, fixture.HomeTeam.Color) }
|
||||
>
|
||||
{ fixture.HomeTeam.ShortName }
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2.5 py-1 bg-surface1 text-text rounded text-sm font-bold">
|
||||
{ fixture.HomeTeam.ShortName }
|
||||
</span>
|
||||
}
|
||||
<span class="text-4xl font-bold text-text">{ fmt.Sprint(result.HomeScore) }</span>
|
||||
</div>
|
||||
<div class="flex flex-col items-center">
|
||||
<span class="text-4xl text-subtext0 font-light leading-none">–</span>
|
||||
if isOT {
|
||||
<span class="px-1.5 py-0.5 bg-peach/20 text-peach rounded text-xs font-semibold mt-1">
|
||||
OT
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<div class="flex items-center gap-3">
|
||||
<span class="text-4xl font-bold text-text">{ fmt.Sprint(result.AwayScore) }</span>
|
||||
if fixture.AwayTeam.Color != "" {
|
||||
<span
|
||||
class="px-2.5 py-1 rounded text-sm font-bold"
|
||||
style={ fmt.Sprintf("background-color: %s22; color: %s; border: 1px solid %s44",
|
||||
fixture.AwayTeam.Color, fixture.AwayTeam.Color, fixture.AwayTeam.Color) }
|
||||
>
|
||||
{ fixture.AwayTeam.ShortName }
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2.5 py-1 bg-surface1 text-text rounded text-sm font-bold">
|
||||
{ fixture.AwayTeam.ShortName }
|
||||
</span>
|
||||
}
|
||||
if awayWon {
|
||||
<span class="text-2xl">🏆</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -321,13 +437,169 @@ templ fixtureUploadPrompt(fixture *db.Fixture) {
|
||||
<div class="text-4xl mb-3">📋</div>
|
||||
<p class="text-lg text-text font-medium mb-2">No Result Uploaded</p>
|
||||
<p class="text-sm text-subtext1 mb-4">Upload match log files to record the result of this fixture.</p>
|
||||
<a
|
||||
href={ templ.SafeURL(fmt.Sprintf("/fixtures/%d/results/upload", fixture.ID)) }
|
||||
class="inline-block px-4 py-2 bg-blue hover:bg-blue/80 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Upload Match Logs
|
||||
</a>
|
||||
<div class="flex items-center justify-center gap-3">
|
||||
<a
|
||||
href={ templ.SafeURL(fmt.Sprintf("/fixtures/%d/results/upload", fixture.ID)) }
|
||||
class="inline-block px-4 py-2 bg-blue hover:bg-blue/80 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Upload Match Logs
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
@click="$dispatch('open-forfeit-modal')"
|
||||
class="inline-block px-4 py-2 bg-red hover:bg-red/80 text-mantle rounded-lg
|
||||
font-medium transition hover:cursor-pointer"
|
||||
>
|
||||
Forfeit Match
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@forfeitModal(fixture)
|
||||
}
|
||||
|
||||
templ forfeitModal(fixture *db.Fixture) {
|
||||
<div
|
||||
x-data="{
|
||||
open: false,
|
||||
forfeitType: 'outright',
|
||||
forfeitTeam: '',
|
||||
forfeitReason: '',
|
||||
}"
|
||||
@open-forfeit-modal.window="open = true"
|
||||
x-show="open"
|
||||
x-cloak
|
||||
class="fixed inset-0 z-50 overflow-y-auto"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
>
|
||||
<!-- Background overlay -->
|
||||
<div
|
||||
x-show="open"
|
||||
x-transition:enter="ease-out duration-300"
|
||||
x-transition:enter-start="opacity-0"
|
||||
x-transition:enter-end="opacity-100"
|
||||
x-transition:leave="ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100"
|
||||
x-transition:leave-end="opacity-0"
|
||||
class="fixed inset-0 bg-base/75 transition-opacity"
|
||||
@click="open = false"
|
||||
></div>
|
||||
<!-- Modal panel -->
|
||||
<div class="flex min-h-full items-center justify-center p-4">
|
||||
<div
|
||||
x-show="open"
|
||||
x-transition:enter="ease-out duration-300"
|
||||
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave="ease-in duration-200"
|
||||
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
|
||||
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
||||
class="relative transform overflow-hidden rounded-lg bg-mantle border-2 border-surface1 shadow-xl transition-all sm:w-full sm:max-w-lg"
|
||||
@click.stop
|
||||
>
|
||||
<form
|
||||
hx-post={ fmt.Sprintf("/fixtures/%d/forfeit", fixture.ID) }
|
||||
hx-swap="none"
|
||||
>
|
||||
<div class="bg-mantle px-4 pb-4 pt-5 sm:p-6">
|
||||
<div class="sm:flex sm:items-start">
|
||||
<div class="mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full bg-red/10 sm:mx-0 sm:h-10 sm:w-10">
|
||||
<svg class="h-6 w-6 text-red" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left w-full">
|
||||
<h3 class="text-lg font-semibold leading-6 text-text">Forfeit Match</h3>
|
||||
<div class="mt-2">
|
||||
<p class="text-sm text-subtext0 mb-4">
|
||||
This will record a forfeit result. This action is immediate and cannot be undone.
|
||||
</p>
|
||||
<!-- Forfeit Type Selection -->
|
||||
<div class="space-y-3">
|
||||
<label class="text-sm font-medium text-text">Forfeit Type</label>
|
||||
<div class="space-y-2">
|
||||
<label class="flex items-center gap-3 p-3 bg-surface0 border border-surface1 rounded-lg hover:bg-surface1 transition hover:cursor-pointer"
|
||||
:class="forfeitType === 'outright' && 'border-red/50 bg-red/5'"
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name="forfeit_type"
|
||||
value="outright"
|
||||
x-model="forfeitType"
|
||||
class="text-red focus:ring-red hover:cursor-pointer"
|
||||
/>
|
||||
<div>
|
||||
<span class="text-sm font-medium text-text">Outright Forfeit</span>
|
||||
<p class="text-xs text-subtext0">One team forfeits. They receive a loss, the opponent receives a win.</p>
|
||||
</div>
|
||||
</label>
|
||||
<label class="flex items-center gap-3 p-3 bg-surface0 border border-surface1 rounded-lg hover:bg-surface1 transition hover:cursor-pointer"
|
||||
:class="forfeitType === 'mutual' && 'border-peach/50 bg-peach/5'"
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name="forfeit_type"
|
||||
value="mutual"
|
||||
x-model="forfeitType"
|
||||
class="text-peach focus:ring-peach hover:cursor-pointer"
|
||||
/>
|
||||
<div>
|
||||
<span class="text-sm font-medium text-text">Mutual Forfeit</span>
|
||||
<p class="text-xs text-subtext0">Both teams forfeit. Each receives an overtime loss.</p>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Team Selection (outright only) -->
|
||||
<div x-show="forfeitType === 'outright'" x-cloak class="mt-4 space-y-2">
|
||||
<label class="text-sm font-medium text-text">Which team is forfeiting?</label>
|
||||
<select
|
||||
name="forfeit_team"
|
||||
x-model="forfeitTeam"
|
||||
class="w-full px-3 py-2 bg-surface0 border border-surface1 rounded-lg text-text focus:border-red focus:outline-none hover:cursor-pointer"
|
||||
>
|
||||
<option value="">Select a team...</option>
|
||||
<option value="home">{ fixture.HomeTeam.Name } (Home)</option>
|
||||
<option value="away">{ fixture.AwayTeam.Name } (Away)</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- Reason -->
|
||||
<div class="mt-4 space-y-2">
|
||||
<label class="text-sm font-medium text-text">Reason (optional)</label>
|
||||
<textarea
|
||||
name="forfeit_reason"
|
||||
x-model="forfeitReason"
|
||||
placeholder="Provide a reason for the forfeit..."
|
||||
class="w-full px-3 py-2 bg-surface0 border border-surface1 rounded-lg text-text
|
||||
focus:border-blue focus:outline-none resize-none"
|
||||
rows="3"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-surface0 px-4 py-3 sm:flex sm:flex-row-reverse sm:px-6 gap-2">
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex w-full justify-center rounded-lg bg-red px-4 py-2 text-sm font-semibold text-mantle shadow-sm hover:bg-red/75 hover:cursor-pointer transition sm:w-auto"
|
||||
:disabled="forfeitType === 'outright' && forfeitTeam === ''"
|
||||
:class="forfeitType === 'outright' && forfeitTeam === '' && 'opacity-50 cursor-not-allowed'"
|
||||
>
|
||||
Confirm Forfeit
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="open = false"
|
||||
class="mt-3 inline-flex w-full justify-center rounded-lg bg-surface1 px-4 py-2 text-sm font-semibold text-text shadow-sm hover:bg-surface2 hover:cursor-pointer transition sm:mt-0 sm:w-auto"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -159,21 +159,35 @@ templ fixtureListItem(fixture *db.Fixture, sched *db.FixtureSchedule, hasSchedul
|
||||
</span>
|
||||
</div>
|
||||
if hasResult {
|
||||
<span class="flex items-center gap-2">
|
||||
if res.Winner == "home" {
|
||||
<span class="text-sm font-bold text-text">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm text-subtext0">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
} else if res.Winner == "away" {
|
||||
<span class="text-sm text-subtext0">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm font-bold text-text">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
} else {
|
||||
<span class="text-sm text-text">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm text-text">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
}
|
||||
</span>
|
||||
if res.IsForfeit {
|
||||
<span class="flex items-center gap-2">
|
||||
if res.ForfeitType != nil && *res.ForfeitType == "mutual" {
|
||||
<span class="px-2 py-0.5 bg-peach/20 text-peach rounded text-xs font-medium">
|
||||
Mutual Forfeit
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2 py-0.5 bg-red/20 text-red rounded text-xs font-medium">
|
||||
Forfeit
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
} else {
|
||||
<span class="flex items-center gap-2">
|
||||
if res.Winner == "home" {
|
||||
<span class="text-sm font-bold text-text">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm text-subtext0">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
} else if res.Winner == "away" {
|
||||
<span class="text-sm text-subtext0">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm font-bold text-text">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
} else {
|
||||
<span class="text-sm text-text">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm text-text">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
} else if hasSchedule && sched.ScheduledTime != nil {
|
||||
<span class="text-xs text-green font-medium">
|
||||
@localtime(sched.ScheduledTime, "short")
|
||||
|
||||
@@ -520,13 +520,17 @@ templ teamResultRow(team *db.Team, fixture *db.Fixture, resultMap map[int]*db.Fi
|
||||
won := (isHome && res.Winner == "home") || (!isHome && res.Winner == "away")
|
||||
lost := (isHome && res.Winner == "away") || (!isHome && res.Winner == "home")
|
||||
_ = lost
|
||||
isForfeit := res.IsForfeit
|
||||
isMutualForfeit := isForfeit && res.ForfeitType != nil && *res.ForfeitType == "mutual"
|
||||
}}
|
||||
<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">
|
||||
if won {
|
||||
if isMutualForfeit {
|
||||
<span class="text-xs font-bold px-2 py-0.5 bg-peach/20 text-peach rounded shrink-0">FF</span>
|
||||
} else if won {
|
||||
<span class="text-xs font-bold px-2 py-0.5 bg-green/20 text-green rounded shrink-0">W</span>
|
||||
} else if lost {
|
||||
<span class="text-xs font-bold px-2 py-0.5 bg-red/20 text-red rounded shrink-0">L</span>
|
||||
@@ -550,21 +554,35 @@ templ teamResultRow(team *db.Team, fixture *db.Fixture, resultMap map[int]*db.Fi
|
||||
{ opponent }
|
||||
</span>
|
||||
</div>
|
||||
<span class="flex items-center gap-2 shrink-0">
|
||||
if res.Winner == "home" {
|
||||
<span class="text-sm font-bold text-text">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm text-subtext0">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
} else if res.Winner == "away" {
|
||||
<span class="text-sm text-subtext0">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm font-bold text-text">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
} else {
|
||||
<span class="text-sm text-text">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm text-text">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
}
|
||||
</span>
|
||||
if isForfeit {
|
||||
<span class="flex items-center gap-2 shrink-0">
|
||||
if isMutualForfeit {
|
||||
<span class="px-2 py-0.5 bg-peach/20 text-peach rounded text-xs font-medium">
|
||||
Mutual Forfeit
|
||||
</span>
|
||||
} else {
|
||||
<span class="px-2 py-0.5 bg-red/20 text-red rounded text-xs font-medium">
|
||||
Forfeit
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
} else {
|
||||
<span class="flex items-center gap-2 shrink-0">
|
||||
if res.Winner == "home" {
|
||||
<span class="text-sm font-bold text-text">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm text-subtext0">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
} else if res.Winner == "away" {
|
||||
<span class="text-sm text-subtext0">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm font-bold text-text">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
} else {
|
||||
<span class="text-sm text-text">{ fmt.Sprint(res.HomeScore) }</span>
|
||||
<span class="text-xs text-subtext0">–</span>
|
||||
<span class="text-sm text-text">{ fmt.Sprint(res.AwayScore) }</span>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
</a>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user