mirror of
https://github.com/Pandipipas/scoreko-dev.git
synced 2026-06-06 03:32:06 +00:00
Fix custom player select behavior in scoreboard panel
This commit is contained in:
@@ -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;
|
||||
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;
|
||||
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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user