|
|
|
@ -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)
|
|
|
|
|
})
|
|
|
|
|