diff --git a/front/components/editor/BasketCourt.tsx b/front/components/editor/BasketCourt.tsx index 92722c7..115c41b 100644 --- a/front/components/editor/BasketCourt.tsx +++ b/front/components/editor/BasketCourt.tsx @@ -23,7 +23,7 @@ export function BasketCourt({ {players.map((player) => { return ( onPlayerRemove(player)} diff --git a/front/components/editor/CourtPlayer.tsx b/front/components/editor/CourtPlayer.tsx index 9f0c9e4..22e1bbe 100644 --- a/front/components/editor/CourtPlayer.tsx +++ b/front/components/editor/CourtPlayer.tsx @@ -43,7 +43,6 @@ export default function CourtPlayer({ setY(y) onChange({ - id: player.id, rightRatio: x, bottomRatio: y, team: player.team, diff --git a/front/tactic/Player.ts b/front/tactic/Player.ts index e7553a8..6530612 100644 --- a/front/tactic/Player.ts +++ b/front/tactic/Player.ts @@ -1,12 +1,6 @@ import { Team } from "./Team" export interface Player { - /** - * unique identifier of the player. - * This identifier must be unique to the associated court. - */ - id: number - /** * the player's team * */ diff --git a/front/views/Editor.tsx b/front/views/Editor.tsx index 8f6483c..df566ff 100644 --- a/front/views/Editor.tsx +++ b/front/views/Editor.tsx @@ -128,7 +128,6 @@ function EditorView({ return [ ...players, { - id: players.length, team: element.team, role: element.key, rightRatio: x, @@ -151,11 +150,7 @@ function EditorView({ default_value={name} on_validated={(new_name) => { onNameChange(new_name).then((success) => { - if (success) { - setStyle({}) - } else { - setStyle(ERROR_STYLE) - } + success ? setStyle({}) : setStyle(ERROR_STYLE) }) }} /> @@ -192,7 +187,9 @@ function EditorView({ onPlayerChange={(player) => { setPlayers((players) => { const idx = players.findIndex( - (p) => p.id === player.id, + (p) => + p.team === player.team && + p.role === player.role, ) return players.toSpliced(idx, 1, player) }) @@ -200,7 +197,9 @@ function EditorView({ onPlayerRemove={(player) => { setPlayers((players) => { const idx = players.findIndex( - (p) => p.id === player.id, + (p) => + p.team === player.team && + p.role === player.role, ) return players.toSpliced(idx, 1) })