Fix Docker build failure caused by server-only import reaching client bundle
scoring-event.ts exported getEventTypeLabel, a pure display helper used directly in route components, from the same module that imports scoring-calculator.ts (which now pulls in the Discord notification service, a .server-only module). Because that whole chain was value-imported into the client bundle, Vite's server-only-module guard failed the build. Move getEventTypeLabel into a new client-safe scoring-event-types.ts module with no server dependencies, and import it directly where it's rendered.
This commit is contained in:
parent
6b0e32c3d5
commit
ef7a71485c
4 changed files with 15 additions and 14 deletions
11
app/models/scoring-event-types.ts
Normal file
11
app/models/scoring-event-types.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export type EventType = "playoff_game" | "major_tournament" | "final_standings" | "schedule_event";
|
||||
|
||||
export function getEventTypeLabel(eventType: string): string {
|
||||
switch (eventType) {
|
||||
case "playoff_game": return "Bracket";
|
||||
case "major_tournament": return "Major Tournament";
|
||||
case "final_standings": return "Final Standings";
|
||||
case "schedule_event": return "Non-Scoring";
|
||||
default: return eventType;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,18 +5,8 @@ import type { BracketRegion } from "~/lib/bracket-templates";
|
|||
import { recalculateAffectedLeagues } from "./scoring-calculator";
|
||||
import { hasProcessedQualifyingPlacement, recalculateParticipantQP } from "./qualifying-points";
|
||||
import { findParticipantNamesByIds } from "./season-participant";
|
||||
|
||||
export type EventType = "playoff_game" | "major_tournament" | "final_standings" | "schedule_event";
|
||||
|
||||
export function getEventTypeLabel(eventType: string): string {
|
||||
switch (eventType) {
|
||||
case "playoff_game": return "Bracket";
|
||||
case "major_tournament": return "Major Tournament";
|
||||
case "final_standings": return "Final Standings";
|
||||
case "schedule_event": return "Non-Scoring";
|
||||
default: return eventType;
|
||||
}
|
||||
}
|
||||
import type { EventType } from "./scoring-event-types";
|
||||
export { type EventType, getEventTypeLabel } from "./scoring-event-types";
|
||||
|
||||
export interface CreateScoringEventData {
|
||||
sportsSeasonId: string;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import {
|
|||
} from "~/components/ui/select";
|
||||
import { Badge } from "~/components/ui/badge";
|
||||
import { ArrowLeft, Trophy, CheckCircle2, Pencil, Trash2, Brackets, Save } from "lucide-react";
|
||||
import { getEventTypeLabel } from "~/models/scoring-event";
|
||||
import { getEventTypeLabel } from "~/models/scoring-event-types";
|
||||
import { isBracketMajor } from "~/lib/event-utils";
|
||||
import {
|
||||
Table,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import {
|
|||
import { Calendar, Trophy, ArrowLeft, Trash2, ListPlus } from "lucide-react";
|
||||
import { format, parseISO } from "date-fns";
|
||||
import { QualifyingPointsStandings } from "~/components/scoring/QualifyingPointsStandings";
|
||||
import { getEventTypeLabel } from "~/models/scoring-event";
|
||||
import { getEventTypeLabel } from "~/models/scoring-event-types";
|
||||
|
||||
export function meta({ data }: Route.MetaArgs): Route.MetaDescriptors {
|
||||
return [{ title: `Events — ${data?.sportsSeason?.name ?? "Sports Season"} - Brackt Admin` }];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue