diff --git a/src/dashboard/example/components/ScoreboardPanel.vue b/src/dashboard/example/components/ScoreboardPanel.vue index 3889a67..ffe0b1e 100644 --- a/src/dashboard/example/components/ScoreboardPanel.vue +++ b/src/dashboard/example/components/ScoreboardPanel.vue @@ -14,8 +14,6 @@ const leftInput = ref(''); const rightInput = ref(''); const leftFocused = ref(false); const rightFocused = ref(false); -const leftIgnoreInputSync = ref(false); -const rightIgnoreInputSync = ref(false); const leftCountryInput = ref(''); const rightCountryInput = ref(''); @@ -153,12 +151,32 @@ const startRightCustomPlayer = () => { const onLeftFilter = (val: string, update: (fn: () => void) => void) => { update(() => { leftFilter.value = val; + + if (!leftFocused.value) { + return; + } + + leftInput.value = val; + scoreboardStore.scoreboard.leftNameOverride = val; + if (val.trim()) { + startLeftCustomPlayer(); + } }); }; const onRightFilter = (val: string, update: (fn: () => void) => void) => { update(() => { rightFilter.value = val; + + if (!rightFocused.value) { + return; + } + + rightInput.value = val; + scoreboardStore.scoreboard.rightNameOverride = val; + if (val.trim()) { + startRightCustomPlayer(); + } }); }; @@ -204,7 +222,6 @@ const onLeftSelect = (playerId: string) => { return; } - leftIgnoreInputSync.value = true; leftFocused.value = false; scoreboardStore.scoreboard.leftNameOverride = ''; leftFilter.value = ''; @@ -218,7 +235,6 @@ const onRightSelect = (playerId: string) => { return; } - rightIgnoreInputSync.value = true; rightFocused.value = false; scoreboardStore.scoreboard.rightNameOverride = ''; rightFilter.value = ''; @@ -312,43 +328,6 @@ const saveRightSelectedPlayerChanges = () => { }; -watch( - leftInput, - (value) => { - if (leftIgnoreInputSync.value) { - leftIgnoreInputSync.value = false; - return; - } - - if (!leftFocused.value) { - return; - } - - scoreboardStore.scoreboard.leftNameOverride = value; - if (value.trim()) { - startLeftCustomPlayer(); - } - }, -); - -watch( - rightInput, - (value) => { - if (rightIgnoreInputSync.value) { - rightIgnoreInputSync.value = false; - return; - } - - if (!rightFocused.value) { - return; - } - - scoreboardStore.scoreboard.rightNameOverride = value; - if (value.trim()) { - startRightCustomPlayer(); - } - }, -); watch( () => scoreboardStore.scoreboard.leftPlayerId,