Fix custom player select behavior in scoreboard panel

This commit is contained in:
Pandipipas
2026-02-11 10:27:19 +01:00
parent 32837cbb36
commit 6d7e7b9b10
@@ -62,22 +62,12 @@ const onRightCountryFilter = (value: string, update: (callback: () => void) => v
const playerOptions = computed(() => { const playerOptions = computed(() => {
const base = [{ label: '(Sin asignar)', value: '' }]; 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 entries = Object.entries(playersStore.players) as [string, Schemas.Players[string]][];
const options = entries.map(([id, player]) => ({ const options = entries.map(([id, player]) => ({
value: id, value: id,
label: player.gamertag || id, label: player.gamertag || id,
})); }));
return base.concat(custom).concat(options); return base.concat(options);
}); });
const leftSelectedPlayer = computed(() => playersStore.players[scoreboardStore.scoreboard.leftPlayerId]); const leftSelectedPlayer = computed(() => playersStore.players[scoreboardStore.scoreboard.leftPlayerId]);
@@ -150,15 +140,21 @@ const rightPlayerOptions = computed(() => filterOptions(playerOptions.value, rig
const startLeftCustomPlayer = () => { const startLeftCustomPlayer = () => {
const wasCustom = scoreboardStore.scoreboard.leftPlayerId === CUSTOM_LEFT_PLAYER_ID;
scoreboardStore.scoreboard.leftPlayerId = CUSTOM_LEFT_PLAYER_ID; scoreboardStore.scoreboard.leftPlayerId = CUSTOM_LEFT_PLAYER_ID;
if (!wasCustom) {
scoreboardStore.scoreboard.leftTeamOverride = ''; scoreboardStore.scoreboard.leftTeamOverride = '';
scoreboardStore.scoreboard.leftCountryOverride = ''; scoreboardStore.scoreboard.leftCountryOverride = '';
}
}; };
const startRightCustomPlayer = () => { const startRightCustomPlayer = () => {
const wasCustom = scoreboardStore.scoreboard.rightPlayerId === CUSTOM_RIGHT_PLAYER_ID;
scoreboardStore.scoreboard.rightPlayerId = CUSTOM_RIGHT_PLAYER_ID; scoreboardStore.scoreboard.rightPlayerId = CUSTOM_RIGHT_PLAYER_ID;
if (!wasCustom) {
scoreboardStore.scoreboard.rightTeamOverride = ''; scoreboardStore.scoreboard.rightTeamOverride = '';
scoreboardStore.scoreboard.rightCountryOverride = ''; scoreboardStore.scoreboard.rightCountryOverride = '';
}
}; };
const onLeftFilter = (val: string, update: (fn: () => void) => void) => { const onLeftFilter = (val: string, update: (fn: () => void) => void) => {
@@ -195,7 +191,7 @@ const onRightFilter = (val: string, update: (fn: () => void) => void) => {
const onLeftFocus = () => { const onLeftFocus = () => {
leftFocused.value = true; leftFocused.value = true;
leftInput.value = ''; leftInput.value = leftDisplayName.value;
}; };
const onLeftBlur = () => { const onLeftBlur = () => {
@@ -206,7 +202,7 @@ const onLeftBlur = () => {
const onRightFocus = () => { const onRightFocus = () => {
rightFocused.value = true; rightFocused.value = true;
rightInput.value = ''; rightInput.value = rightDisplayName.value;
}; };
const onRightBlur = () => { const onRightBlur = () => {