Skip to content

Commit fcfc111

Browse files
round disable now, and round auto set using scores
1 parent 30cde2f commit fcfc111

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/app/team/[id]/page.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,11 @@ function ScoreSection({ teamId }: { teamId: string }) {
4040
const [innovation, setInnovation] = useState(0);
4141
const [teamwork, setTeamwork] = useState(0);
4242
const [comment, setComment] = useState("");
43-
const [round, setRound] = useState(0);
4443
const [editMode, setEditMode] = useState(false);
4544
const [currentScoreId, setCurrentScoreId] = useState<string | null>(null);
46-
45+
4746
const queryClient = useQueryClient();
4847
const { create } = useToast();
49-
5048
const {
5149
data: scores = [],
5250
isLoading: scoresLoading,
@@ -58,7 +56,10 @@ function ScoreSection({ teamId }: { teamId: string }) {
5856
enabled: !!teamId,
5957
staleTime: 0,
6058
});
61-
59+
const [round, setRound] = useState(scores.length +1);
60+
useEffect(()=> {
61+
setRound(scores.length + 1)
62+
}, [scores])
6263
const createScoreMutation = useMutation({
6364
mutationFn: ({
6465
teamId,
@@ -182,7 +183,6 @@ function ScoreSection({ teamId }: { teamId: string }) {
182183
setInnovation(0);
183184
setTeamwork(0);
184185
setComment("");
185-
setRound(0);
186186
setCurrentScoreId(null);
187187
setEditMode(false);
188188
};
@@ -318,9 +318,10 @@ function ScoreSection({ teamId }: { teamId: string }) {
318318
<Input
319319
type="number"
320320
min="0"
321+
disabled
321322
max="10"
322-
value={round}
323-
onChange={(e) => setRound(Number(e.target.value))}
323+
value={scores.length + 1}
324+
// onChange={(e) => setRound(Number(e.target.value))}
324325
/>
325326
</div>
326327
</div>

0 commit comments

Comments
 (0)