You need to sign in or sign up before continuing.
Commit 6c2102e9 by G

fix somes types typo around naming convention. ex : firstName -> first_name

parent 6a0aa9cd
...@@ -16,16 +16,20 @@ export const UserAuthenticationContext = createContext<UserAuthenticationContext ...@@ -16,16 +16,20 @@ export const UserAuthenticationContext = createContext<UserAuthenticationContext
userInformations: { userInformations: {
username: "", username: "",
email: "", email: "",
firstName: "", // biome-ignore lint/style/useNamingConvention: <Api response>
lastName: "", first_name: "",
// biome-ignore lint/style/useNamingConvention: <Api response>
last_name: "",
marchand: { marchand: {
// biome-ignore lint/style/useNamingConvention: <Api reponse> // biome-ignore lint/style/useNamingConvention: <Api response>
marchand_id: "", marchand_id: "",
nom: "", nom: "",
code: "", code: "",
adresse: "", adresse: "",
urlSuccess: "", // biome-ignore lint/style/useNamingConvention: <Api response>
urlEchec: "", url_success: "",
// biome-ignore lint/style/useNamingConvention: <Api response>
url_echec: "",
entreprise: 0, entreprise: 0,
user: 0, user: 0,
}, },
...@@ -42,16 +46,20 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac ...@@ -42,16 +46,20 @@ export const UserAuthenticationContextProvider = ({ children }: { children: Reac
const [userInformations, setUserInformations] = useState<IuserInformations>({ const [userInformations, setUserInformations] = useState<IuserInformations>({
username: "JohnDoe", username: "JohnDoe",
email: "JohnDoe@example.com", email: "JohnDoe@example.com",
firstName: "John", // biome-ignore lint/style/useNamingConvention: <Api response>
lastName: "Doe", first_name: "John",
// biome-ignore lint/style/useNamingConvention: <Api response>
last_name: "Doe",
marchand: { marchand: {
// biome-ignore lint/style/useNamingConvention: <Api response> // biome-ignore lint/style/useNamingConvention: <Api response>
marchand_id: "id123", marchand_id: "id123",
nom: "Beasy", nom: "Beasy",
code: "BEASY-EXAMPLE-1", code: "BEASY-EXAMPLE-1",
adresse: "Plateau 2, 1023, Immeuble Chardy", adresse: "Plateau 2, 1023, Immeuble Chardy",
urlSuccess: "https://example.com/success", // biome-ignore lint/style/useNamingConvention: <Api response>
urlEchec: "https://example.com/echec", url_success: "https://example.com/success",
// biome-ignore lint/style/useNamingConvention: <Api response>
url_echec: "https://example.com/echec",
entreprise: 0, entreprise: 0,
user: 0, user: 0,
}, },
......
...@@ -42,10 +42,40 @@ const useTransactionsHistory = () => { ...@@ -42,10 +42,40 @@ const useTransactionsHistory = () => {
}, },
[data], [data],
); );
const filterDataByReference = (data: Transaction[], reference: string) => {
if (!data?.length) return [];
return data.filter(
(transaction) => transaction.reference.includes(reference) && transaction.reference,
);
};
const filterByOperators = (data: Transaction[]) => {
if (!data?.length) return [];
// create a set
const set = new Set<PaymentCode>();
for (const key of Object.keys(operatorsFilter)) {
if (operatorsFilter[key as keyof OperatorsFilter]) {
set.add(key as PaymentCode);
}
}
return data.filter((transaction) => {
// return true if the set is empty, as there is no need to check
if (set.size === 0) return true;
// return true if the set contains the value
return set.has(transaction.type_paiement_label);
});
};
const transactionsHistory: Transaction[] = useMemo(() => { const transactionsHistory: Transaction[] = useMemo(() => {
if (!data) return []; if (!data) return [];
return filterByReference(referenceFilter); const filteredByOperators = filterByOperators(data);
}, [data, filterByReference, referenceFilter]); const filteredByReference = filterDataByReference(filteredByOperators, referenceFilter);
return filteredByReference;
// return filterByReference(referenceFilter);
}, [data, referenceFilter, filterByOperators, filterDataByReference]);
return { return {
transactionsHistory, transactionsHistory,
......
...@@ -45,7 +45,7 @@ const UserProfileScreen = () => { ...@@ -45,7 +45,7 @@ const UserProfileScreen = () => {
<Box height={"100%"} flex={1} flexDirection={"column"}> <Box height={"100%"} flex={1} flexDirection={"column"}>
<Text fontWeight={"bold"} variant={"black"} fontSize={20}> <Text fontWeight={"bold"} variant={"black"} fontSize={20}>
{userInformations.firstName} {userInformations.lastName} {userInformations.first_name} {userInformations.last_name}
</Text> </Text>
<Text>{userInformations.email}</Text> <Text>{userInformations.email}</Text>
</Box> </Box>
...@@ -138,7 +138,9 @@ const UserProfileScreen = () => { ...@@ -138,7 +138,9 @@ const UserProfileScreen = () => {
<Text variant={"black"} fontWeight={"bold"}> <Text variant={"black"} fontWeight={"bold"}>
Url succès Url succès
</Text> </Text>
<Text textAlign={"center"}>{userInformations.marchand.urlSuccess}</Text> <Text textAlign={"center"}>
{userInformations.marchand.url_success}
</Text>
</Box> </Box>
<Box <Box
width={"100%"} width={"100%"}
...@@ -150,7 +152,7 @@ const UserProfileScreen = () => { ...@@ -150,7 +152,7 @@ const UserProfileScreen = () => {
<Text variant={"black"} fontWeight={"bold"}> <Text variant={"black"} fontWeight={"bold"}>
Url échec Url échec
</Text> </Text>
<Text textAlign={"center"}>{userInformations.marchand.urlEchec}</Text> <Text textAlign={"center"}>{userInformations.marchand.url_echec}</Text>
</Box> </Box>
</Box> </Box>
</Box> </Box>
......
...@@ -19,8 +19,10 @@ export interface ImerchandInformations { ...@@ -19,8 +19,10 @@ export interface ImerchandInformations {
nom: string; nom: string;
code: string; code: string;
adresse: string; adresse: string;
urlSuccess: string; // biome-ignore lint/style/useNamingConvention: <Api response>
urlEchec: string; url_success: string;
// biome-ignore lint/style/useNamingConvention: <Api response>
url_echec: string;
entreprise: number; entreprise: number;
user: number; user: number;
} }
...@@ -28,7 +30,9 @@ export interface ImerchandInformations { ...@@ -28,7 +30,9 @@ export interface ImerchandInformations {
export interface IuserInformations { export interface IuserInformations {
username: string; username: string;
email: string; email: string;
firstName: string; // biome-ignore lint/style/useNamingConvention: <Api response>
lastName: string; first_name: string;
// biome-ignore lint/style/useNamingConvention: <Api response>
last_name: string;
marchand: ImerchandInformations; marchand: ImerchandInformations;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment