mirror of
https://github.com/Pandipipas/scoreko-dev.git
synced 2026-06-06 03:32:06 +00:00
Remove legacy realName fallback from player normalization (#31)
This commit is contained in:
@@ -12,13 +12,10 @@ const normalizePlayer = (input: unknown): Player => {
|
||||
const candidate = typeof input === 'object' && input !== null ? (input as Record<string, unknown>) : {};
|
||||
return {
|
||||
gamertag: typeof candidate.gamertag === 'string' ? candidate.gamertag : '',
|
||||
name: typeof candidate.name === 'string' ? candidate.name : '',
|
||||
team: typeof candidate.team === 'string' ? candidate.team : '',
|
||||
country: typeof candidate.country === 'string' ? candidate.country : '',
|
||||
twitter: typeof candidate.twitter === 'string' ? candidate.twitter : '',
|
||||
realName: typeof candidate.realName === 'string' ? candidate.realName : '',
|
||||
pronouns: typeof candidate.pronouns === 'string' ? candidate.pronouns : '',
|
||||
twitch: typeof candidate.twitch === 'string' ? candidate.twitch : '',
|
||||
notes: typeof candidate.notes === 'string' ? candidate.notes : '',
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -25,13 +25,10 @@ const fileInput = ref<HTMLInputElement | null>(null);
|
||||
|
||||
const emptyPlayer: Player = {
|
||||
gamertag: '',
|
||||
team: '',
|
||||
name: '',
|
||||
country: '',
|
||||
team: '',
|
||||
twitter: '',
|
||||
realName: '',
|
||||
pronouns: '',
|
||||
twitch: '',
|
||||
notes: '',
|
||||
};
|
||||
|
||||
const form = reactive<Player>({ ...emptyPlayer });
|
||||
@@ -88,7 +85,8 @@ const openCreateDialog = () => {
|
||||
|
||||
const openEditDialog = (row: PlayerRow) => {
|
||||
editingId.value = row.id;
|
||||
const { id: _id, ...playerData } = row;
|
||||
const { id, ...playerData } = row;
|
||||
void id;
|
||||
Object.assign(form, playerData);
|
||||
isDialogOpen.value = true;
|
||||
};
|
||||
@@ -132,7 +130,7 @@ const handleImport = async (event: Event) => {
|
||||
const text = await file.text();
|
||||
const parsed = JSON.parse(text) as unknown;
|
||||
playersStore.setPlayers(parsed as PlayersMap);
|
||||
} catch (error) {
|
||||
} catch {
|
||||
window.alert('No se pudo importar el JSON. Verifica el formato.');
|
||||
} finally {
|
||||
if (target) {
|
||||
@@ -242,8 +240,8 @@ const handleImport = async (event: Event) => {
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<QInput
|
||||
v-model="form.team"
|
||||
label="Team"
|
||||
v-model="form.name"
|
||||
label="Name"
|
||||
dense
|
||||
outlined
|
||||
/>
|
||||
@@ -268,6 +266,14 @@ const handleImport = async (event: Event) => {
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<QInput
|
||||
v-model="form.team"
|
||||
label="Team"
|
||||
dense
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<QInput
|
||||
v-model="form.twitter"
|
||||
@@ -276,40 +282,6 @@ const handleImport = async (event: Event) => {
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<QInput
|
||||
v-model="form.realName"
|
||||
label="Nombre real"
|
||||
dense
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<QInput
|
||||
v-model="form.pronouns"
|
||||
label="Pronombres"
|
||||
dense
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<QInput
|
||||
v-model="form.twitch"
|
||||
label="Twitch"
|
||||
dense
|
||||
outlined
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<QInput
|
||||
v-model="form.notes"
|
||||
type="textarea"
|
||||
label="Notas"
|
||||
dense
|
||||
outlined
|
||||
autogrow
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</QForm>
|
||||
</QCardSection>
|
||||
|
||||
Reference in New Issue
Block a user