Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beasy-mobile
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
G
beasy-mobile
Commits
6c2102e9
Commit
6c2102e9
authored
Jul 01, 2024
by
G
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix somes types typo around naming convention. ex : firstName -> first_name
parent
6a0aa9cd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
18 deletions
+62
-18
UserAuthenticationContext.tsx
src/contexts/UserAuthenticationContext.tsx
+17
-9
useTransactionsHistory.tsx
src/hooks/useTransactionsHistory.tsx
+32
-2
UserProfileScreen.tsx
src/screens/UserProfileScreen.tsx
+5
-3
types.ts
src/utils/requests/types.ts
+8
-4
No files found.
src/contexts/UserAuthenticationContext.tsx
View file @
6c2102e9
...
@@ -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 re
s
ponse>
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
,
},
},
...
...
src/hooks/useTransactionsHistory.tsx
View file @
6c2102e9
...
@@ -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
,
...
...
src/screens/UserProfileScreen.tsx
View file @
6c2102e9
...
@@ -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
.
first
Name
}
{
userInformations
.
lastN
ame
}
{
userInformations
.
first
_name
}
{
userInformations
.
last_n
ame
}
</
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
.
url
E
chec
}
</
Text
>
<
Text
textAlign=
{
"center"
}
>
{
userInformations
.
marchand
.
url
_e
chec
}
</
Text
>
</
Box
>
</
Box
>
</
Box
>
</
Box
>
</
Box
>
</
Box
>
...
...
src/utils/requests/types.ts
View file @
6c2102e9
...
@@ -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
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment