Skip to content

Commit fa6f63a

Browse files
authored
Merge pull request #1721 from Mirrrrrow/dev
fix(web): display correct gender
2 parents e214dd5 + 4a51f0f commit fa6f63a

File tree

3 files changed

+47
-33
lines changed

3 files changed

+47
-33
lines changed

[core]/esx_multicharacter/web/build/assets/index-DejQJnIG.js renamed to [core]/esx_multicharacter/web/build/assets/index-OCpTJ5nO.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

[core]/esx_multicharacter/web/build/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>ESX MULTICHARACTER</title>
8-
<script type="module" crossorigin src="./assets/index-DejQJnIG.js"></script>
8+
<script type="module" crossorigin src="./assets/index-OCpTJ5nO.js"></script>
99
<link rel="stylesheet" crossorigin href="./assets/index-Kwy28xkx.css">
1010
</head>
1111
<body>
Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,62 @@
1-
import CharacterSelection from './components/CharacterSelection';
2-
import { useState, useEffect } from 'react';
3-
import { useNuiEvent } from './utils/useNuiEvent'
4-
import { Character, Locale } from './types/Character';
5-
import { fetchNui } from './utils/fetchNui';
1+
import CharacterSelection from "./components/CharacterSelection";
2+
import { useState, useEffect } from "react";
3+
import { useNuiEvent } from "./utils/useNuiEvent";
4+
import { Character, Locale } from "./types/Character";
5+
import { fetchNui } from "./utils/fetchNui";
66

77
function App() {
88
const [isVisible, setIsVisible] = useState<boolean>(false);
99
const [characters, setCharacters] = useState<Character[]>([]);
1010
const [Candelete, setCandelete] = useState<boolean>(false);
1111
const [MaxAllowedSlot, setMaxAllowedSlot] = useState<number>(0);
12-
const [locale, setLocale] = useState<Locale>({ char_info_title: '', play: '', title: '' });
12+
const [locale, setLocale] = useState<Locale>({
13+
char_info_title: "",
14+
play: "",
15+
title: "",
16+
});
1317

1418
useEffect(() => {
15-
fetchNui('nuiReady')
16-
}, [])
19+
fetchNui("nuiReady");
20+
}, []);
1721

18-
useNuiEvent('ToggleMulticharacter', (data:any) => {
22+
useNuiEvent("ToggleMulticharacter", (data: any) => {
1923
if (data.show) {
20-
const validCharacters = data.Characters.filter((char: any) => char !== null);
21-
const parsedCharacters: Character[] = validCharacters.map((char: any, index: number) => ({
22-
id: char.id.toString(),
23-
name: `${char.firstname} ${char.lastname}`,
24-
birthDate: char.dateofbirth,
25-
gender: char.sex?.toUpperCase() === 'MALE' ? 'MALE' : 'FEMALE',
26-
occupation: char.job,
27-
disabled: char.disabled,
28-
isActive: index === 0,
29-
}));
24+
const validCharacters = data.Characters.filter(
25+
(char: any) => char !== null
26+
);
27+
const parsedCharacters: Character[] = validCharacters.map(
28+
(char: any, index: number) => ({
29+
id: char.id.toString(),
30+
name: `${char.firstname} ${char.lastname}`,
31+
birthDate: char.dateofbirth,
32+
gender: char.sex,
33+
occupation: char.job,
34+
disabled: char.disabled,
35+
isActive: index === 0,
36+
})
37+
);
3038

3139
setIsVisible(true);
3240
setCharacters(parsedCharacters);
3341
setCandelete(data.CanDelete);
34-
setMaxAllowedSlot(data.AllowedSlot)
35-
setLocale(data.Locale)
42+
setMaxAllowedSlot(data.AllowedSlot);
43+
setLocale(data.Locale);
3644
} else {
3745
setIsVisible(false);
3846
setCharacters([]);
39-
4047
}
41-
})
48+
});
4249

43-
return isVisible && (
44-
<CharacterSelection initialCharacters={characters} Candelete={Candelete} MaxAllowedSlot={MaxAllowedSlot} locale={locale} />
50+
return (
51+
isVisible && (
52+
<CharacterSelection
53+
initialCharacters={characters}
54+
Candelete={Candelete}
55+
MaxAllowedSlot={MaxAllowedSlot}
56+
locale={locale}
57+
/>
58+
)
4559
);
4660
}
4761

48-
export default App;
62+
export default App;

0 commit comments

Comments
 (0)