add score column to gw events table
This commit is contained in:
parent
7f9df46132
commit
eaf5094bd7
2 changed files with 26 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ export interface GwEvent {
|
||||||
endDate: string
|
endDate: string
|
||||||
eventNumber: number // GW #XX
|
eventNumber: number // GW #XX
|
||||||
status?: GwEventStatus
|
status?: GwEventStatus
|
||||||
|
crewTotalScore?: number // Included when user has a crew with participation
|
||||||
createdAt?: string
|
createdAt?: string
|
||||||
updatedAt?: string
|
updatedAt?: string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,11 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper for formatting scores with commas
|
||||||
|
function formatScore(score: number): string {
|
||||||
|
return score.toLocaleString()
|
||||||
|
}
|
||||||
|
|
||||||
function formatEventStatus(status: string, startDate: string): string {
|
function formatEventStatus(status: string, startDate: string): string {
|
||||||
if (status === 'upcoming') {
|
if (status === 'upcoming') {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
|
|
@ -293,6 +298,11 @@
|
||||||
<span class="event-dates">
|
<span class="event-dates">
|
||||||
{formatDate(event.startDate)} – {formatDate(event.endDate)}
|
{formatDate(event.startDate)} – {formatDate(event.endDate)}
|
||||||
</span>
|
</span>
|
||||||
|
<span class="event-score">
|
||||||
|
{#if event.crewTotalScore !== undefined}
|
||||||
|
{formatScore(event.crewTotalScore)}
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
<span class="event-status status-{event.status ?? 'unknown'}"
|
<span class="event-status status-{event.status ?? 'unknown'}"
|
||||||
>{formatEventStatus(event.status ?? 'unknown', event.startDate)}</span
|
>{formatEventStatus(event.status ?? 'unknown', event.startDate)}</span
|
||||||
>
|
>
|
||||||
|
|
@ -593,8 +603,8 @@
|
||||||
|
|
||||||
.event-item {
|
.event-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
gap: spacing.$unit-2x;
|
||||||
padding: spacing.$unit spacing.$unit-2x;
|
padding: spacing.$unit spacing.$unit-2x;
|
||||||
border-radius: layout.$item-corner;
|
border-radius: layout.$item-corner;
|
||||||
transition: background-color 0.15s;
|
transition: background-color 0.15s;
|
||||||
|
|
@ -609,6 +619,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: spacing.$unit;
|
gap: spacing.$unit;
|
||||||
|
width: 140px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-number {
|
.event-number {
|
||||||
|
|
@ -618,15 +629,28 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-dates {
|
.event-dates {
|
||||||
|
flex: 1;
|
||||||
font-size: typography.$font-small;
|
font-size: typography.$font-small;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.event-score {
|
||||||
|
width: 140px;
|
||||||
|
font-size: typography.$font-small;
|
||||||
|
font-weight: typography.$medium;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
text-align: right;
|
||||||
|
color: var(--text-primary);
|
||||||
|
}
|
||||||
|
|
||||||
.event-status {
|
.event-status {
|
||||||
|
width: 80px;
|
||||||
font-size: typography.$font-small;
|
font-size: typography.$font-small;
|
||||||
padding: 2px 6px;
|
padding: 2px 6px;
|
||||||
border-radius: layout.$item-corner-small;
|
border-radius: layout.$item-corner-small;
|
||||||
|
text-align: center;
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
&.status-active {
|
&.status-active {
|
||||||
background: var(--color-green-light, #dcfce7);
|
background: var(--color-green-light, #dcfce7);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue