Skip to content

Commit f5940b6

Browse files
replaced score_total to round_total
1 parent 22c11b5 commit f5940b6

3 files changed

Lines changed: 30 additions & 9 deletions

File tree

src/api/fetchTeamDetails.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,21 @@ export const fetchTeamDetails = async ({ uuid }: { uuid: string }) => {
1818
throw err;
1919
}
2020
};
21-
21+
export const fetchTeamRound = async ({ uuid }: { uuid: string }) => {
22+
try {
23+
const response = await axios.get<MainSearch>(
24+
`admin/teams/${uuid}`
25+
);
26+
// console.log(response)
27+
const parsedResponse = MainTeamSearchResponse.parse(response.data)
28+
console.log(parsedResponse)
29+
return parsedResponse.data;
30+
} catch (err) {
31+
console.log(err);
32+
throw err;
33+
}
34+
};
35+
36+
37+
2238

src/components/ViewScores.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,20 @@ import {
1111
} from "@/components/ui/dialog";
1212
import { Card, CardContent } from "./ui/card";
1313
import { Label } from "@radix-ui/react-dropdown-menu";
14+
import { Button } from "./ui/button";
1415

1516
export default function ViewScores({ row }: { row: Row<Leaderboard> }) {
1617
return (
1718
<Dialog>
18-
<DialogTrigger>View Scores</DialogTrigger>
19+
<DialogTrigger asChild>
20+
<Button>View Scores</Button>
21+
</DialogTrigger>
1922
<DialogContent>
2023
<DialogHeader>
2124
<DialogTitle>Here are the scores: </DialogTitle>
2225
<DialogDescription>
2326
<Card>
24-
<CardContent className="space-y-2">
27+
<CardContent className="overflow-y-auto space-y-2">
2528
<div>
2629
<Label className="font-semibold">Team Name:</Label>{" "}
2730
{row.original.team_name}
@@ -33,11 +36,13 @@ export default function ViewScores({ row }: { row: Row<Leaderboard> }) {
3336
innovation,
3437
presentation,
3538
teamwork,
36-
total_score,
39+
round_total,
3740
} = round;
38-
3941
return (
40-
<div key={index} className="border border-black p-2 overflow-y-auto">
42+
<div
43+
key={index}
44+
className=" border border-black p-2"
45+
>
4146
<div>Round {index} score: </div>
4247
<div>
4348
<Label className="font-semibold">Design:</Label>{" "}
@@ -61,7 +66,7 @@ export default function ViewScores({ row }: { row: Row<Leaderboard> }) {
6166
</div>
6267
<div>
6368
<Label className="font-semibold">Total Score:</Label>{" "}
64-
{total_score}
69+
{round_total}
6570
</div>
6671
</div>
6772
);

src/components/changeRound.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function ChangeRound({ row }: SelectCellProps) {
2222
const queryClient = useQueryClient();
2323

2424
const [selectedValue, setSelectedValue] = useState<string>("");
25-
25+
2626
const mutation = useMutation({
2727
mutationFn: (data: { id: string; round: string }) => {
2828
return setTeamRound(data.id, data.round);
@@ -42,7 +42,7 @@ function ChangeRound({ row }: SelectCellProps) {
4242
return (
4343
<div className="w-full">
4444
<Select
45-
value={selectedValue} // Use value for controlled component
45+
value={selectedValue}
4646
disabled={mutation.isPending}
4747
onValueChange={handleValueChange}
4848
>

0 commit comments

Comments
 (0)