From 6d7e7b9b101d3a14344626085d7b784f32f01e50 Mon Sep 17 00:00:00 2001 From: Pandipipas <62224708+Pandipipas@users.noreply.github.com> Date: Wed, 11 Feb 2026 10:27:19 +0100 Subject: [PATCH] Fix custom player select behavior in scoreboard panel --- .../example/components/ScoreboardPanel.vue | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/dashboard/example/components/ScoreboardPanel.vue b/src/dashboard/example/components/ScoreboardPanel.vue index 37a8124..de90df6 100644 --- a/src/dashboard/example/components/ScoreboardPanel.vue +++ b/src/dashboard/example/components/ScoreboardPanel.vue @@ -62,22 +62,12 @@ const onRightCountryFilter = (value: string, update: (callback: () => void) => v const playerOptions = computed(() => { const base = [{ label: '(Sin asignar)', value: '' }]; - const custom = [ - { - value: CUSTOM_LEFT_PLAYER_ID, - label: scoreboardStore.scoreboard.leftNameOverride || 'Jugador personalizado (izq)', - }, - { - value: CUSTOM_RIGHT_PLAYER_ID, - label: scoreboardStore.scoreboard.rightNameOverride || 'Jugador personalizado (der)', - }, - ]; const entries = Object.entries(playersStore.players) as [string, Schemas.Players[string]][]; const options = entries.map(([id, player]) => ({ value: id, label: player.gamertag || id, })); - return base.concat(custom).concat(options); + return base.concat(options); }); const leftSelectedPlayer = computed(() => playersStore.players[scoreboardStore.scoreboard.leftPlayerId]); @@ -150,15 +140,21 @@ const rightPlayerOptions = computed(() => filterOptions(playerOptions.value, rig const startLeftCustomPlayer = () => { + const wasCustom = scoreboardStore.scoreboard.leftPlayerId === CUSTOM_LEFT_PLAYER_ID; scoreboardStore.scoreboard.leftPlayerId = CUSTOM_LEFT_PLAYER_ID; - scoreboardStore.scoreboard.leftTeamOverride = ''; - scoreboardStore.scoreboard.leftCountryOverride = ''; + if (!wasCustom) { + scoreboardStore.scoreboard.leftTeamOverride = ''; + scoreboardStore.scoreboard.leftCountryOverride = ''; + } }; const startRightCustomPlayer = () => { + const wasCustom = scoreboardStore.scoreboard.rightPlayerId === CUSTOM_RIGHT_PLAYER_ID; scoreboardStore.scoreboard.rightPlayerId = CUSTOM_RIGHT_PLAYER_ID; - scoreboardStore.scoreboard.rightTeamOverride = ''; - scoreboardStore.scoreboard.rightCountryOverride = ''; + if (!wasCustom) { + scoreboardStore.scoreboard.rightTeamOverride = ''; + scoreboardStore.scoreboard.rightCountryOverride = ''; + } }; const onLeftFilter = (val: string, update: (fn: () => void) => void) => { @@ -195,7 +191,7 @@ const onRightFilter = (val: string, update: (fn: () => void) => void) => { const onLeftFocus = () => { leftFocused.value = true; - leftInput.value = ''; + leftInput.value = leftDisplayName.value; }; const onLeftBlur = () => { @@ -206,7 +202,7 @@ const onLeftBlur = () => { const onRightFocus = () => { rightFocused.value = true; - rightInput.value = ''; + rightInput.value = rightDisplayName.value; }; const onRightBlur = () => {