fix: typecheck event prizes form for deploy gate
Local Build and Deploy / deploy (push) Failing after 1m25s
Local Build and Deploy / deploy (push) Failing after 1m25s
Narrow prizeType to the Select union and keep badgeCode as a string so pnpm typecheck passes on the server. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
557138e40b
commit
1273f9aa46
1 file changed
+7
-3
@@ -17,6 +17,8 @@ import {
|
|||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import { useServerAction } from "@/hooks/use-server-action";
|
import { useServerAction } from "@/hooks/use-server-action";
|
||||||
|
|
||||||
|
type PrizeType = "badge" | "credits" | "pixels" | "points" | "item";
|
||||||
|
|
||||||
interface Prize {
|
interface Prize {
|
||||||
id: number;
|
id: number;
|
||||||
position: number;
|
position: number;
|
||||||
@@ -39,7 +41,7 @@ export function EventPrizesManager({ eventId, prizes }: Props) {
|
|||||||
const [showForm, setShowForm] = useState(false);
|
const [showForm, setShowForm] = useState(false);
|
||||||
const [form, setForm] = useState({
|
const [form, setForm] = useState({
|
||||||
position: prizes.length + 1,
|
position: prizes.length + 1,
|
||||||
prizeType: "badge" as string,
|
prizeType: "badge" as PrizeType,
|
||||||
badgeCode: "",
|
badgeCode: "",
|
||||||
credits: 0,
|
credits: 0,
|
||||||
pixels: 0,
|
pixels: 0,
|
||||||
@@ -93,7 +95,9 @@ export function EventPrizesManager({ eventId, prizes }: Props) {
|
|||||||
<Label>Type</Label>
|
<Label>Type</Label>
|
||||||
<Select
|
<Select
|
||||||
value={form.prizeType}
|
value={form.prizeType}
|
||||||
onValueChange={(v) => setForm({ ...form, prizeType: v })}
|
onValueChange={(v) =>
|
||||||
|
setForm({ ...form, prizeType: v as PrizeType })
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue />
|
<SelectValue />
|
||||||
@@ -110,7 +114,7 @@ export function EventPrizesManager({ eventId, prizes }: Props) {
|
|||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label>Badge Code</Label>
|
<Label>Badge Code</Label>
|
||||||
<Input
|
<Input
|
||||||
value={form.badgeCode}
|
value={form.badgeCode ?? ""}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setForm({ ...form, badgeCode: e.target.value })
|
setForm({ ...form, badgeCode: e.target.value })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user