Skip to content

Commit 51c7ab3

Browse files
round prefill
change round have prefill and 0 as a option
1 parent 4aa6088 commit 51c7ab3

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/components/changeRound.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import {
1111
import { useMutation, useQueryClient } from "@tanstack/react-query";
1212
import { useState } from "react";
1313

14-
function ChangeRound({ id }: { id: string }) {
14+
function ChangeRound({ id, prefill = "" }: { id: string; prefill?: string }) {
1515
const queryClient = useQueryClient();
1616

17-
const [selectedValue, setSelectedValue] = useState<string>("");
17+
const [selectedValue, setSelectedValue] = useState<string>(prefill);
1818

1919
const mutation = useMutation({
2020
mutationFn: (data: { id: string; round: string }) => {
@@ -45,7 +45,7 @@ function ChangeRound({ id }: { id: string }) {
4545
<SelectContent>
4646
<SelectGroup className="">
4747
<SelectLabel>{`Select Round`}</SelectLabel>
48-
{["1", "2", "3"].map((option) => (
48+
{["0", "1", "2", "3"].map((option) => (
4949
<SelectItem key={option} value={option}>
5050
{option}
5151
</SelectItem>

src/components/columns/LeaderBoardCol.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const columns: ColumnDef<z.infer<typeof leaderboardUserSchema>>[] = [
2525
{
2626
accessorKey: "ID",
2727
header: "Change Round",
28-
cell: ({ row }) => <ChangeRound id={row.original.team_id} />,
28+
cell: ({ row }) => <ChangeRound id={row.original.team_id} prefill={String(row.original.rounds.length)} />,
2929
},
3030
{
3131
accessorKey: "View",

src/components/columns/TeamCol.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const columns: ColumnDef<Team>[] = [
6969
{
7070
accessorKey: "ID",
7171
header: "Change Round",
72-
cell: ({ row }) => <ChangeRound id={row.original.ID} />,
72+
cell: ({ row }) => <ChangeRound id={row.original.ID} prefill={String(row.original.RoundQualified)} />,
7373
},
7474
];
7575

0 commit comments

Comments
 (0)