Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
anawork-mobile-v2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
dungtnguyen
anawork-mobile-v2
Commits
18e7bc83
Commit
18e7bc83
authored
Oct 03, 2024
by
quynhquang400@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix load logo
parent
e1d5fde1
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
11255 additions
and
7944 deletions
+11255
-7944
App.tsx
App.tsx
+1
-1
babel.config.js
babel.config.js
+1
-0
package.json
package.json
+1
-0
authAPI.js
src/api/authAPI.js
+6
-5
homeAPI.js
src/api/homeAPI.js
+5
-6
selectors.js
src/app/selectors.js
+1
-0
icon_avatar_default.png
src/assets/icon/icon_avatar_default.png
+0
-0
icon_outline_send.png
src/assets/icon/icon_outline_send.png
+0
-0
HeaderComponent.js
src/components/header/HeaderComponent.js
+12
-33
index.js
src/config/index.js
+7
-1
axios.js
src/network/axios.js
+2
-3
authSlice.js
src/screens/authentication/authSlice.js
+36
-2
LoginContainer.js
src/screens/authentication/login/LoginContainer.js
+39
-44
LoginScreen.js
src/screens/authentication/login/LoginScreen.js
+2
-17
SlashContainer.js
src/screens/authentication/splash/SlashContainer.js
+5
-3
HomeContainer.js
src/screens/home/HomeContainer.js
+5
-7
homePropsProvider.js
src/screens/home/homePropsProvider.js
+10
-2
homeSlice.js
src/screens/home/homeSlice.js
+1
-6
index.js
src/screens/home/index.js
+3
-5
BirthdayModals.js
src/screens/home/modals/BirthdayModals.js
+331
-143
HomeMainView.js
src/screens/home/template/HomeMainView.js
+5
-3
CalendarBirthday.js
src/screens/home/template/subViews/CalendarBirthday.js
+1
-6
index.js
src/utils/index.js
+1
-1
images.js
src/values/images.js
+6
-1
yarn.lock
yarn.lock
+10774
-7655
No files found.
App.tsx
View file @
18e7bc83
...
...
@@ -15,7 +15,7 @@ import {Colors} from 'react-native/Libraries/NewAppScreen';
import
{
Provider
}
from
'react-redux'
;
import
NoConnection
from
'./src/components/noconnection/NoConnection'
;
import
Main
from
'./src/Main'
;
import
{
store
}
from
'./src/store
/store'
;
import
store
from
'./src/app
/store'
;
function
App
():
React
.
JSX
.
Element
{
const
isDarkMode
=
useColorScheme
()
===
'dark'
;
...
...
babel.config.js
View file @
18e7bc83
module
.
exports
=
{
presets
:
[
'module:@react-native/babel-preset'
],
plugins
:
[
'react-native-reanimated/plugin'
],
};
package.json
View file @
18e7bc83
...
...
@@ -22,6 +22,7 @@
"
@react-navigation/native-stack
"
:
"
^6.11.0
"
,
"
@reduxjs/toolkit
"
:
"
^2.2.7
"
,
"
apisauce
"
:
"
^3.0.1
"
,
"
axios
"
:
"
^1.7.7
"
,
"
formik
"
:
"
^2.4.6
"
,
"
i18next
"
:
"
^23.15.1
"
,
"
md5
"
:
"
^2.3.0
"
,
...
...
src/api/authAPI.js
View file @
18e7bc83
/* eslint-disable prettier/prettier */
import
axiosClient
from
'../network/axios'
;
const
authAPI
=
{
...
...
@@ -10,13 +9,15 @@ const authAPI = {
requestChangePassword
:
payload
=>
axiosClient
.
post
(
'reset-password'
,
payload
),
requestAuthenticate
:
({
username
,
password
})
=>
{
return
axiosClient
.
post
(
requestAuthenticate
:
({
username
,
password
})
=>
axiosClient
.
post
(
`authenticate/authenticate?username=
${
username
}
&password=
${
password
}
`
,
);
},
),
requestLogout
:
({
token
})
=>
axiosClient
.
post
(
'authenticate/logout'
,
{
token
}),
requestGetMyInfo
:
()
=>
axiosClient
.
get
(
'authenticate/getMyInfo'
),
requestGetCompanyLogo
:
()
=>
axiosClient
.
get
(
'companyInfo'
),
};
export
default
authAPI
;
src/api/homeAPI.js
View file @
18e7bc83
/* eslint-disable prettier/prettier */
import
ApiClient
from
'../network/axios'
;
import
axiosClient
from
'../network/axios'
;
const
homeAPI
=
{
requestGetQuotation
:
()
=>
{
return
Api
Client
.
get
(
`getAllQuote`
);
return
axios
Client
.
get
(
`getAllQuote`
);
},
requestGetRandomQuotation
:
()
=>
{
return
Api
Client
.
get
(
`getRandomQuotation`
);
return
axios
Client
.
get
(
`getRandomQuotation`
);
},
requestGetUsersDirectManagers
:
()
=>
{
return
Api
Client
.
get
(
`myDirectManagers`
);
return
axios
Client
.
get
(
`myDirectManagers`
);
},
requestGetBirthdayUser
:
({
month
,
year
})
=>
ApiClient
.
get
(
`users/statistics/birthday?year=
${
year
}
'
&month=
${
month
}
`
),
axiosClient
.
get
(
`users/statistics/birthday?year=
${
year
}
&month=
${
month
}
`
),
};
export
default
homeAPI
;
src/app/selectors.js
View file @
18e7bc83
...
...
@@ -2,3 +2,4 @@
export
const
authSelector
=
state
=>
state
.
auth
;
export
const
homeSelector
=
state
=>
state
.
home
;
export
const
onLeaveSelector
=
state
=>
state
.
onLeave
;
export
const
loaderSelector
=
state
=>
state
.
loader
.
isLoading
;
src/assets/icon/icon_avatar_default.png
0 → 100644
View file @
18e7bc83
5.5 KB
src/assets/icon/icon_outline_send.png
0 → 100644
View file @
18e7bc83
1.86 KB
src/components/header/HeaderComponent.js
View file @
18e7bc83
/* eslint-disable prettier/prettier */
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
React
,
{
memo
,
useEffect
,
useState
}
from
'react'
;
import
{
Image
,
ImageBackground
,
...
...
@@ -9,12 +9,14 @@ import {
import
{
useDispatch
}
from
'react-redux'
;
import
RootNavigation
from
'../../navigation/RootNavigation'
;
import
api
from
'../../network/axios'
;
import
{
getCompanyInfo
}
from
'../../store/actions/UserAction'
;
import
{
APP_NAVIGATE_SCREEN
}
from
'../../utils/constant'
;
import
{
IMAGES
}
from
'../../values/images'
;
import
styles
from
'./style'
;
import
config
from
'../../config'
;
import
Utils
from
'../../utils'
;
import
{
getCompanyInfo
}
from
'../../screens/authentication/authSlice'
;
const
HeaderComponent
=
props
=>
{
const
HeaderComponent
=
React
.
memo
(()
=>
{
const
dispatch
=
useDispatch
();
const
[
logo
,
setLogo
]
=
useState
();
...
...
@@ -22,13 +24,13 @@ const HeaderComponent = props => {
const
navigateHome
=
()
=>
{
RootNavigation
.
navigate
(
APP_NAVIGATE_SCREEN
.
HOME
);
};
const
getCompanyLogo
=
async
()
=>
{
const
res
=
await
dispatch
(
getCompanyInfo
());
if
(
res
.
success
)
{
const
domain
=
api
.
getBaseURL
();
const
arr
=
domain
.
split
(
'/'
,
3
);
setLogo
(
`https://
${
arr
[
arr
.
length
-
1
]}${
res
.
data
.
logo
}
`
);
const
{
success
}
=
Utils
.
getValues
(
res
,
'payload'
,
false
);
if
(
success
)
{
const
{
data
}
=
Utils
.
getValues
(
res
,
'payload'
,
false
);
setLogo
(
config
.
imageEndPoint
+
data
.
logo
);
}
};
useEffect
(()
=>
{
...
...
@@ -37,37 +39,14 @@ const HeaderComponent = props => {
return
(
<
SafeAreaView
>
<
ImageBackground
style
=
{
styles
.
container
}
source
=
{
IMAGES
.
BgHeader
}
>
{
/* <TouchableOpacity
style={{ marginLeft: 10, flex: 1 }}
onPress={props.navigation && props.navigation.openDrawer}>
<Image source={IMAGES.IcMenu} style={styles.iconMenu} />
</TouchableOpacity> */
}
<
TouchableOpacity
onPress
=
{
navigateHome
}
style
=
{{
flex
:
1
,
alignItems
:
'center'
}}
>
<
Image
source
=
{{
uri
:
logo
}}
style
=
{
styles
.
iconLogo
}
/
>
<
/TouchableOpacity
>
{
/* <View
style={{
flexDirection: 'row',
alignItems: 'center',
flex: 1,
justifyContent: 'flex-end',
}}>
<TouchableOpacity>
<Image source={IMAGES.IcNotification} style={styles.iconBell} />
</TouchableOpacity>
<TouchableOpacity onPress={navigateProfile}>
<Image
source={{ uri: 'https://meu.anawork.com' + userDetails.avatar }}
style={styles.ImgAvatar}
/>
</TouchableOpacity>
</View> */
}
<
/ImageBackground
>
<
/SafeAreaView
>
);
};
}
)
;
export
default
HeaderComponent
;
export
default
memo
(
HeaderComponent
)
;
src/config/index.js
View file @
18e7bc83
const
storageKey
=
{
AUTH
:
'auth'
,
LANGUAGE
:
'language'
,
};
export
default
{
apiEndpoint
:
'https://gateway.dev.meu-solutions.com/staginganawork/api/'
,
//apiEndpoint: 'https://gateway.dev.meu-solutions.com/techport/api/',
imageEndPoint
:
'https://
techmart.meu-solutions.com
'
,
imageEndPoint
:
'https://
gateway.dev.meu-solutions.com/staginganawork
'
,
siteURL
:
'https://saigon-business.erp.meu-solutions.com'
,
ONE_SIGNAL_KEY
:
'6f4f8bd1-9b43-4067-8175-c0052140e891'
,
axiosTimeout
:
10000
,
storageKey
,
};
src/network/axios.js
View file @
18e7bc83
...
...
@@ -13,15 +13,14 @@ const axiosClient = axios.create({
axiosClient
.
interceptors
.
request
.
use
(
async
configAxios
=>
{
const
auth
=
await
Utils
.
getData
(
config
.
storageKey
.
AUTH
);
if
(
auth
.
token
)
{
configAxios
.
headers
.
Authorization
=
`Bearer
${
auth
.
token
}
`
;
if
(
auth
)
{
configAxios
.
headers
.
Authorization
=
`Bearer
${
auth
}
`
;
}
return
configAxios
;
});
axiosClient
.
interceptors
.
response
.
use
(
response
=>
{
console
.
log
(
'response'
,
response
);
if
(
response
?.
data
)
{
return
response
.
data
;
}
...
...
src/screens/authentication/authSlice.js
View file @
18e7bc83
...
...
@@ -5,6 +5,7 @@ import serviceRequest from '../../app/serviceRequest';
import
Utils
from
'../../utils'
;
import
authAPI
from
'../../api/authAPI'
;
import
config
from
'../../config'
;
const
initialState
=
{
banners
:
[],
...
...
@@ -25,7 +26,32 @@ export const authenticate = createAsyncThunk(
});
},
);
export
const
getMyInfo
=
createAsyncThunk
(
'auth/getMyInfo'
,
async
(
data
,
thunkAPI
)
=>
{
return
serviceRequest
({
dispatch
:
thunkAPI
.
dispatch
,
serviceMethod
:
authAPI
.
requestGetMyInfo
,
payload
:
data
,
options
:
{
skipLoader
:
false
,
},
});
},
);
export
const
getCompanyInfo
=
createAsyncThunk
(
'auth/requestGetCompanyLogo'
,
async
(
data
,
thunkAPI
)
=>
{
return
serviceRequest
({
dispatch
:
thunkAPI
.
dispatch
,
serviceMethod
:
authAPI
.
requestGetCompanyLogo
,
payload
:
data
,
options
:
{
skipLoader
:
false
,
},
});
},
);
const
authSlice
=
createSlice
({
name
:
'auth'
,
initialState
:
initialState
,
...
...
@@ -33,8 +59,16 @@ const authSlice = createSlice({
extraReducers
:
builder
=>
{
builder
.
addCase
(
authenticate
.
fulfilled
,
(
state
,
action
)
=>
{
const
{
success
}
=
Utils
.
getValues
(
action
,
'payload'
,
false
);
console
.
log
(
'authenticate'
,
action
);
if
(
success
)
{
const
{
token
}
=
Utils
.
getValues
(
action
,
'payload'
,
false
);
Utils
.
storeData
(
config
.
storageKey
.
AUTH
,
token
);
}
});
builder
.
addCase
(
getMyInfo
.
fulfilled
,
(
state
,
action
)
=>
{
const
{
success
}
=
Utils
.
getValues
(
action
,
'payload'
,
false
);
if
(
success
)
{
const
{
user
}
=
Utils
.
getValues
(
action
,
'payload'
,
false
);
state
.
userInfo
=
user
;
}
});
},
...
...
src/screens/authentication/login/LoginContainer.js
View file @
18e7bc83
...
...
@@ -5,27 +5,24 @@ import LoginScreen from './LoginScreen';
import
{
useTranslation
}
from
'react-i18next'
;
import
OneSignal
from
'react-native-onesignal'
;
import
{
useDispatch
}
from
'react-redux'
;
import
{
useDispatch
,
useSelector
}
from
'react-redux'
;
import
{
loaderSelector
}
from
'../../../app/selectors'
;
import
{
getMyInfo
}
from
'../../../store/actions/CommonAction'
;
import
Utils
from
'../../../utils'
;
import
{
APP_NAVIGATE_SCREEN
}
from
'../../../utils/constant'
;
import
{
ToastMessage
}
from
'../../../utils/MessageUtil'
;
import
{
authenticate
}
from
'../authSlice'
;
const
LoginContainer
=
props
=>
{
// console.log("props: ", props)
const
dispatch
=
useDispatch
();
const
isLoading
=
useSelector
(
loaderSelector
);
const
{
t
,
i18n
}
=
useTranslation
();
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
showPass
,
setShowPass
]
=
useState
(
true
);
const
[
userAccount
,
setUserAccount
]
=
useState
({
username
:
''
,
password
:
''
,
});
const
[
showAlert
,
setShowAlert
]
=
useState
({
isError
:
false
,
title
:
''
,
message
:
''
,
});
const
navigateToServer
=
()
=>
{
RootNavigation
.
navigate
(
APP_NAVIGATE_SCREEN
.
SERVER
);
};
...
...
@@ -45,55 +42,55 @@ const LoginContainer = props => {
const
handleSetAccount
=
()
=>
{
if
(
userAccount
.
username
.
length
<
=
0
||
userAccount
.
username
.
password
<
=
0
userAccount
.
username
.
length
==
=
0
||
userAccount
.
password
.
length
==
=
0
)
{
setLoading
(
false
);
showAlertError
(
'Hệ thống'
,
'Xin vui lòng nhập đầy đủ thông tin !!!'
);
return
false
;
ToastMessage
({
title
:
'Hệ thống'
,
message
:
'Xin vui lòng nhập đầy đủ thông tin !!!'
,
type
:
'error'
,
});
return
true
;
}
return
tru
e
;
return
fals
e
;
};
const
handleLogin
=
async
()
=>
{
try
{
// setLoading(true)
;
if
(
!
handleSetAccount
)
return
;
if
(
handleSetAccount
())
return
;
dispatch
(
authenticate
({
username
:
'trangbui%40meu-solutions.com'
,
password
:
'trang12345'
,
username
:
userAccount
.
username
,
password
:
userAccount
.
password
,
}),
).
then
(
response
=>
{
// AsyncStorageService.putToken(res.token);
// sendExternalId();
// RootNavigation.navigate(APP_NAVIGATE_SCREEN.MAIN);
// setLoading(false);
const
{
success
}
=
Utils
.
getValues
(
response
,
'payload'
,
false
);
if
(
success
)
{
ToastMessage
({
title
:
'Hệ thống'
,
message
:
'Đăng nhập thành công'
,
type
:
'success'
,
});
RootNavigation
.
navigate
(
APP_NAVIGATE_SCREEN
.
MAIN
);
}
else
{
ToastMessage
({
title
:
'Hệ thống'
,
message
:
'Tài khoản và mật khẩu không đúng'
,
type
:
'error'
,
});
}
});
}
catch
(
e
)
{
console
.
log
(
'error login: '
,
e
);
showAlertError
(
'Hệ thống'
,
e
.
toString
());
// setLoading(false);
// alertMessage(e.toString())
ToastMessage
({
title
:
'Hệ thống'
,
message
:
e
.
toString
(),
type
:
'error'
,
});
}
};
const
hideAlert
=
()
=>
{
setShowAlert
({
isError
:
false
,
title
:
''
,
message
:
''
,
});
setLoading
(
false
);
};
const
showAlertError
=
(
title
,
message
)
=>
{
setShowAlert
({
isError
:
true
,
title
:
title
,
message
:
message
,
});
setLoading
(
true
);
};
const
sendExternalId
=
async
()
=>
{
const
res
=
await
dispatch
(
getMyInfo
());
OneSignal
.
setExternalUserId
(
res
.
user
.
id
,
results
=>
{
...
...
@@ -103,15 +100,13 @@ const LoginContainer = props => {
});
};
const
loginProps
=
{
loading
,
showAlert
,
isLoading
,
showPass
,
handleLogin
,
setShowPass
,
userAccount
,
handleUserName
,
handlePassword
,
hideAlert
,
navigateToServer
,
};
return
<
LoginScreen
{...
loginProps
}
/>
;
...
...
src/screens/authentication/login/LoginScreen.js
View file @
18e7bc83
...
...
@@ -2,7 +2,6 @@
import
React
from
'react'
;
import
{
useTranslation
}
from
'react-i18next'
;
import
{
Image
,
SafeAreaView
,
View
}
from
'react-native'
;
import
Alert
from
'react-native-awesome-alerts'
;
import
AppText
from
'../../../components/AppText'
;
import
ButtonComponent
from
'../../../components/ButtonComponent'
;
import
LoadingProgress
from
'../../../components/LoadingProgress'
;
...
...
@@ -14,7 +13,7 @@ import {BgIntroduce, IMAGES} from '../../../values/images';
import
styles
from
'./styles'
;
const
LoginScreen
=
({
l
oading
,
isL
oading
,
showPass
,
navigateToServer
,
handleLogin
,
...
...
@@ -22,8 +21,6 @@ const LoginScreen = ({
userAccount
,
handleUserName
,
handlePassword
,
showAlert
,
hideAlert
,
})
=>
{
const
{
t
,
i18n
}
=
useTranslation
();
return
(
...
...
@@ -89,20 +86,8 @@ const LoginScreen = ({
<
AppText
style
=
{{
marginLeft
:
20
}}
>
2022
@
MeU
Solutions
,
Inc
<
/AppText
>
<
Image
source
=
{
BgIntroduce
.
BgFtStep1
}
style
=
{
styles
.
bgFullWidth
}
/
>
<
/View
>
{
l
oading
&&
<
LoadingProgress
/>
}
{
isL
oading
&&
<
LoadingProgress
/>
}
<
/View
>
<
Alert
show
=
{
showAlert
.
isError
}
showProgress
=
{
false
}
title
=
{
showAlert
.
title
}
message
=
{
showAlert
.
message
}
closeOnTouchOutside
=
{
true
}
closeOnHardwareBackPress
=
{
false
}
showConfirmButton
=
{
true
}
confirmText
=
"Đóng"
confirmButtonColor
=
"#DD6B55"
onConfirmPressed
=
{
hideAlert
}
/
>
<
/SafeAreaView
>
);
};
...
...
src/screens/authentication/splash/SlashContainer.js
View file @
18e7bc83
...
...
@@ -6,18 +6,20 @@ import RootNavigation from '../../../navigation/RootNavigation';
import
AsyncStorage
from
'@react-native-async-storage/async-storage'
;
import
{
useTranslation
}
from
'react-i18next'
;
import
{
useDispatch
}
from
'react-redux'
;
import
{
getMyInfo
}
from
'../../../store/actions/CommonAction'
;
import
AsyncStorageKeys
from
'../../../utils/AsyncStorageKeys'
;
import
{
APP_NAVIGATE_SCREEN
}
from
'../../../utils/constant'
;
import
SplashScreen
from
'./SplashScreen'
;
import
Utils
from
'../../../utils'
;
import
config
from
'../../../config'
;
import
{
getMyInfo
}
from
'../authSlice'
;
import
{
resetCache
}
from
'../../../../metro.config'
;
const
SplashContainer
=
()
=>
{
const
dispatch
=
useDispatch
();
const
{
t
,
i18n
}
=
useTranslation
();
const
checkAccount
=
async
()
=>
{
const
token
=
await
AsyncStorage
.
getItem
(
AsyncStorageKeys
.
userToken
);
const
token
=
await
Utils
.
getData
(
config
.
storageKey
.
AUTH
);
const
language
=
await
AsyncStorage
.
getItem
(
AsyncStorageKeys
.
Language
);
i18n
.
changeLanguage
(
language
);
//console.log(i18n.language)
if
(
token
)
{
RootNavigation
.
replace
(
APP_NAVIGATE_SCREEN
.
MAIN
);
dispatch
(
getMyInfo
());
...
...
src/screens/home/HomeContainer.js
View file @
18e7bc83
...
...
@@ -33,8 +33,7 @@ import styles from './style';
import
HomeMainView
from
'./template/HomeMainView'
;
const
HomeContainer
=
props
=>
{
const
{
userDetails
,
quotationList
,
birthdayListInMonth
,
randomQuotation
}
=
props
;
const
{
userInfo
,
quotationList
,
birthdayListInMonth
,
randomQuotation
}
=
props
;
const
dispatch
=
useDispatch
();
const
[
arrPersonnel
,
setArrPersonnel
]
=
useState
([]);
...
...
@@ -125,14 +124,13 @@ const HomeContainer = props => {
},
[
birthdayListInMonth
],
);
const
handleCloseDesBirthday
=
useCallback
(()
=>
{
const
handleCloseDesBirthday
=
()
=>
setModalVisible
({
isVisible
:
false
,
birthdayArr
:
null
,
day
:
''
,
managerOpenWish
:
[],
});
},
[]);
const
OpenURLButton
=
async
()
=>
{
const
supported
=
await
Linking
.
canOpenURL
(
supportedURL
);
...
...
@@ -183,7 +181,7 @@ const HomeContainer = props => {
const
res
=
await
dispatch
(
sendNotification
(
approver
.
id
,
user
Details
.
id
,
user
Info
.
id
,
imgArr
,
'Lời chúc sinh nhật'
,
wishTxt
,
...
...
@@ -253,7 +251,7 @@ const HomeContainer = props => {
}
}
}
//console.log({ ...lstBdUser })
const
convertArr
=
Object
.
assign
({},
...
lstBdUser
);
setArrBdCurrentMonth
(
convertArr
);
}
...
...
@@ -438,7 +436,7 @@ const HomeContainer = props => {
//props
const
homeProps
=
{
user
Details
,
user
Info
,
quotationList
,
birthdayOfUser
,
dataBirthday
,
...
...
src/screens/home/homePropsProvider.js
View file @
18e7bc83
/* eslint-disable prettier/prettier */
export
default
function
homePropsProvider
(
props
)
{
const
{
user
Details
,
user
Info
,
quotationList
,
birthdayOfUser
,
dataBirthday
,
...
...
@@ -35,7 +35,7 @@ export default function homePropsProvider(props) {
randomQuotation
,
}
=
props
;
return
{
user
Details
,
user
Info
,
openView
,
openModalHappyBirthday
,
closeModalHappyBirthday
,
...
...
@@ -51,6 +51,14 @@ export default function homePropsProvider(props) {
handleOpenDesBirthday
,
onCalendarChangeMonth
,
},
birthdayModalProps
:
{
modalVisible
,
handleCloseDesBirthday
,
openModalWishBirthday
,
addMoreImgFromGallery
,
closeModalWishBirthday
,
closeModalHappyBirthday
,
},
randomQuotation
,
};
}
src/screens/home/homeSlice.js
View file @
18e7bc83
...
...
@@ -89,13 +89,8 @@ const homeSlice = createSlice({
});
builder
.
addCase
(
getBirthDayUser
.
fulfilled
,
(
state
,
action
)
=>
{
const
{
success
}
=
Utils
.
getValues
(
action
,
'payload'
,
false
);
console
.
log
(
'getBirthDayUser'
,
action
);
if
(
success
)
{
state
.
birthdayListInMonth
=
Utils
.
getValues
(
action
,
'payload.data.collection'
,
[],
);
state
.
birthdayListInMonth
=
Utils
.
getValues
(
action
,
'payload.data'
,
[]);
}
});
},
...
...
src/screens/home/index.js
View file @
18e7bc83
/* eslint-disable prettier/prettier */
import
React
from
'react'
;
import
{
useSelector
}
from
'react-redux'
;
...
...
@@ -7,14 +6,13 @@ import {authSelector, homeSelector} from '../../app/selectors';
export
default
function
HomeScreen
()
{
const
homeSelect
=
useSelector
(
homeSelector
);
const
userDetails
=
useSelector
(
authSelector
);
const
authSelect
=
useSelector
(
authSelector
);
const
{
isLogin
,
userLoginInfo
}
=
userDetails
;
const
{
userInfo
}
=
authSelect
;
const
{
quotationList
,
birthdayListInMonth
,
randomQuotation
}
=
homeSelect
;
const
homeScreenProps
=
{
isLogin
,
userLoginInfo
,
userInfo
,
quotationList
,
birthdayListInMonth
,
randomQuotation
,
...
...
src/screens/home/modals/BirthdayModals.js
View file @
18e7bc83
/* eslint-disable prettier/prettier */
import
React
from
'react'
;
import
React
,
{
memo
,
useCallback
,
useMemo
,
useRef
}
from
'react'
;
import
{
Image
,
Modal
,
...
...
@@ -13,156 +12,345 @@ import ButtonComponent from '../../../components/ButtonComponent';
import
{
IMAGES
,
IconProfile
}
from
'../../../values/images'
;
import
styles
from
'../style'
;
import
AppText
from
'../../../components/AppText'
;
const
BirthdayModal
=
({
modalVisible
})
=>
{
return
(
<
Modal
animationType
=
"slide"
transparent
=
{
true
}
visible
=
{
true
}
>
<
View
style
=
{{
flex
:
1
,
justifyContent
:
'flex-end'
}}
//activeOpacity={0}
//onPress={handleCloseDesBirthday}
>
<
View
style
=
{
styles
.
contentContainer
}
>
<
ScrollView
>
<
ButtonComponent
iconSource
=
{
IconProfile
.
IcCloseBlack
}
styleIcon
=
{{
width
:
20
,
height
:
20
}}
style
=
{{
alignSelf
:
'flex-end'
,
marginRight
:
10
,
marginTop
:
10
,
}}
onPress
=
{
handleCloseDesBirthday
}
/
>
<
AppText
style
=
{{
color
:
'black'
,
fontWeight
:
'bold'
,
fontSize
:
14
}}
>
{
`Ngày
${
modalVisible
?.
day
?.
day
}
th
á
ng
$
{
modalVisible
?.
day
?.
month
}
n
ă
m
$
{
modalVisible
?.
day
?.
year
}
🎉
`}
</AppText>
{modalVisible?.birthdayArr?.map((item, index) => (
<View
key={index}
style={[
styles.viewHappyBirthday,
modalVisible?.managerOpenWish[index].enable
? styles.openViewHappyBirthday
: styles.closeViewHappyBirthday,
]}>
<View
import
config
from
'../../../config'
;
import
BottomSheet
from
'@gorhom/bottom-sheet'
;
import
{
GestureHandlerRootView
}
from
'react-native-gesture-handler'
;
const
BirthdayModal
=
React
.
memo
(
({
modalVisible
,
handleCloseDesBirthday
,
openModalWishBirthday
,
addMoreImgFromGallery
,
closeModalWishBirthday
,
closeModalHappyBirthday
,
})
=>
{
const
bottomSheetRef
=
useRef
(
null
);
const
snapPoints
=
useMemo
(()
=>
[
'25%'
,
'50%'
,
'90%'
],
[]);
return
(
// <Modal
// animationType="slide"
// transparent={true}
// visible={modalVisible.isVisible}>
// <View
// style={{flex: 1, justifyContent: 'flex-end'}}
// //activeOpacity={0}
// //onPress={handleCloseDesBirthday}
// >
// <View style={styles.contentContainer}>
// <ScrollView>
// <ButtonComponent
// iconSource={IconProfile.IcCloseBlack}
// styleIcon={{width: 20, height: 20}}
// style={{
// alignSelf: 'flex-end',
// marginRight: 10,
// marginTop: 10,
// }}
// onPress={handleCloseDesBirthday}
// />
// <AppText
// style={{color: 'black', fontWeight: 'bold', fontSize: 14}}>
// {`Ngày ${modalVisible?.day?.day} tháng ${modalVisible?.day?.month} năm ${modalVisible?.day?.year} 🎉`}
// </AppText>
// {modalVisible?.birthdayArr?.map((item, index) => (
// <View
// key={index}
// style={[
// styles.viewHappyBirthday,
// modalVisible?.managerOpenWish[index].enable
// ? styles.openViewHappyBirthday
// : styles.closeViewHappyBirthday,
// ]}>
// <View
// style={{
// flexDirection: 'row',
// justifyContent: 'space-between',
// }}>
// <View style={{flexDirection: 'row'}}>
// <Image
// source={
// item.avatar
// ? {
// uri: config.imageEndPoint + item.avatar,
// }
// : IMAGES.IcAvatarDefault
// }
// style={{width: 40, height: 40}}
// />
// <View style={{paddingLeft: 10}}>
// <AppText
// style={
// styles.txtTitle
// }>{`${item.first_name} ${item.middle_name} ${item.last_name}`}</AppText>
// <AppText>{item.position}</AppText>
// </View>
// </View>
// {!modalVisible?.managerOpenWish[index].enable && (
// <View
// style={{
// justifyContent: 'center',
// alignItems: 'center',
// }}>
// <TouchableOpacity
// onPress={() => openModalWishBirthday(index)}
// style={styles.btnOpenHappyBirthday}>
// <Image
// source={IMAGES.IcOutlineSend}
// style={{width: 10, height: 10}}
// />
// </TouchableOpacity>
// </View>
// )}
// </View>
// {modalVisible?.managerOpenWish[index].enable && (
// <View>
// <View style={{marginTop: 10}}>
// <TextInput
// multiline
// numberOfLines={3}
// placeholder={'Vui lòng nhập lời chúc tại đây'}
// style={{borderWidth: 0.2}}
// />
// {/** suggest wish */}
// <View>
// <ButtonComponent
// style={styles.btnSuggest}
// text={'Chúc bà sinh nhật dui dẻ nha 🌺'}
// textStyle={{color: 'white'}}
// />
// <ButtonComponent
// style={styles.btnSuggest}
// text={'Tuổi mới sinh đẹp nhaaaa 🌺💃'}
// textStyle={{color: 'white'}}
// />
// </View>
// <View style={{flexDirection: 'row'}}>
// {item?.imgArr &&
// item?.imgArr.map((el, position) => {
// return (
// <View key={position} style={{marginRight: 10}}>
// <FastImage
// source={{
// uri: el.uri,
// }}
// style={{
// width: 60,
// height: 60,
// marginTop: 10,
// }}
// />
// </View>
// );
// })}
// {!item.imgArr && (
// <View style={styles.viewAddMoreImg}>
// <ButtonComponent
// iconSource={IMAGES.IcAddMoreImg}
// styleIcon={{height: 25, width: 25}}
// onPress={() => addMoreImgFromGallery(index)}
// />
// </View>
// )}
// </View>
// </View>
// <View
// style={{
// flexDirection: 'row',
// justifyContent: 'space-between',
// marginTop: 10,
// }}>
// <TouchableOpacity
// onPress={() => closeModalWishBirthday(index)}
// style={{alignSelf: 'flex-end'}}>
// <AppText style={{color: 'blue', fontWeight: '600'}}>
// {' '}
// Hủy{' '}
// </AppText>
// </TouchableOpacity>
// <TouchableOpacity
// onPress={() => closeModalHappyBirthday(index)}
// style={{alignSelf: 'flex-end'}}>
// <AppText style={{color: 'blue', fontWeight: '600'}}>
// Gửi
// </AppText>
// </TouchableOpacity>
// </View>
// </View>
// )}
// </View>
// ))}
// </ScrollView>
// </View>
// </View>
// </Modal>
<
GestureHandlerRootView
>
<
BottomSheet
ref
=
{
bottomSheetRef
}
index
=
{
1
}
snapPoints
=
{
snapPoints
}
animateOnMount
=
{
true
}
enableDynamicSizing
=
{
false
}
>
<
View
style
=
{{
flex
:
1
,
justifyContent
:
'flex-end'
}}
//activeOpacity={0}
//onPress={handleCloseDesBirthday}
>
<
View
style
=
{
styles
.
contentContainer
}
>
<
ScrollView
>
<
ButtonComponent
iconSource
=
{
IconProfile
.
IcCloseBlack
}
styleIcon
=
{{
width
:
20
,
height
:
20
}}
style
=
{{
flexDirection: 'row
',
justifyContent: 'space-between'
,
}}>
<View style={{flexDirection: 'row'}}>
<Image
source={{
uri: 'https://meu.anawork.com' + item.avatar,
}}
style={{width: 40, height: 40}
}
/
>
<View style={{paddingLeft: 10}}>
<AppText
style={
styles.txtTitle
}>{`
$
{
item
.
first_name
}
$
{
item
.
middle_name
}
$
{
item
.
last_name
}
`}</AppText>
<AppText>{item.position}</AppText>
</View>
</View>
{!modalVisible?.managerOpenWish[index].enable && (
alignSelf
:
'flex-end
'
,
marginRight
:
10
,
marginTop
:
10
,
}}
onPress
=
{
handleCloseDesBirthday
}
/
>
<
AppText
style
=
{{
color
:
'black'
,
fontWeight
:
'bold'
,
fontSize
:
14
}}
>
{
`Ngày
${
modalVisible
?.
day
?.
day
}
th
á
ng
$
{
modalVisible
?.
day
?.
month
}
n
ă
m
$
{
modalVisible
?.
day
?.
year
}
🎉
`
}
</AppText
>
{modalVisible?.birthdayArr?.map((item, index) => (
<View
key={index}
style={[
styles.viewHappyBirthday,
modalVisible?.managerOpenWish[index].enable
? styles.openViewHappyBirthday
: styles.closeViewHappyBirthday,
]}>
<View
style={{
justifyContent: 'center
',
alignItems: 'center
',
flexDirection: 'row
',
justifyContent: 'space-between
',
}}>
<TouchableOpacity
onPress={() => openModalWishBirthday(index)}
style={styles.btnOpenHappyBirthday}>
<AppText style={{color: 'blue', fontWeight: '500'}}>
Gửi lời chúc
</AppText>
</TouchableOpacity>
</View>
)}
</View>
{modalVisible?.managerOpenWish[index].enable && (
<View>
<View style={{marginTop: 10}}>
<TextInput
multiline
numberOfLines={3}
placeholder={'Vui lòng nhập lời chúc tại đây'}
style={{borderWidth: 0.2}}
/>
{/** suggest wish */}
<View>
<ButtonComponent
style={styles.btnSuggest}
text={'Chúc bà sinh nhật dui dẻ nha 🌺'}
textStyle={{color: 'white'}}
/>
<ButtonComponent
style={styles.btnSuggest}
text={'Tuổi mới sinh đẹp nhaaaa 🌺💃'}
textStyle={{color: 'white'}}
<View style={{flexDirection: 'row'}}>
<Image
source={
item.avatar
? {
uri: config.imageEndPoint + item.avatar,
}
: IMAGES.IcAvatarDefault
}
style={{width: 40, height: 40}}
/>
<View style={{paddingLeft: 10}}>
<AppText
style={
styles.txtTitle
}>{`
$
{
item
.
first_name
}
$
{
item
.
middle_name
}
$
{
item
.
last_name
}
`}</AppText>
<AppText>{item.position}</AppText>
</View>
</View>
<View style={{flexDirection: 'row'}}>
{item?.imgArr &&
item?.imgArr.map((el, position) => {
return (
<View key={position} style={{marginRight: 10}}>
<FastImage
source={{
uri: el.uri,
}}
style={{
width: 60,
height: 60,
marginTop: 10,
}}
/>
</View>
);
})}
{!item.imgArr && (
<View style={styles.viewAddMoreImg}>
{!modalVisible?.managerOpenWish[index].enable && (
<View
style={{
justifyContent: 'center',
alignItems: 'center',
}}>
<TouchableOpacity
onPress={() => openModalWishBirthday(index)}
style={styles.btnOpenHappyBirthday}>
<Image
source={IMAGES.IcOutlineSend}
style={{width: 10, height: 10}}
/>
</TouchableOpacity>
</View>
)}
</View>
{modalVisible?.managerOpenWish[index].enable && (
<View>
<View style={{marginTop: 10}}>
<TextInput
multiline
numberOfLines={3}
placeholder={'Vui lòng nhập lời chúc tại đây'}
style={{borderWidth: 0.2}}
/>
{/** suggest wish */}
<View>
<ButtonComponent
style={styles.btnSuggest}
text={'Chúc bà sinh nhật dui dẻ nha 🌺'}
textStyle={{color: 'white'}}
/>
<ButtonComponent
iconSource={IMAGES.IcAddMoreImg
}
styleIcon={{height: 25, width: 25}
}
onPress={() => addMoreImgFromGallery(index)
}
style={styles.btnSuggest
}
text={'Tuổi mới sinh đẹp nhaaaa 🌺💃'
}
textStyle={{color: 'white'}
}
/>
</View>
)}
<View style={{flexDirection: 'row'}}>
{item?.imgArr &&
item?.imgArr.map((el, position) => {
return (
<View
key={position}
style={{marginRight: 10}}>
<FastImage
source={{
uri: el.uri,
}}
style={{
width: 60,
height: 60,
marginTop: 10,
}}
/>
</View>
);
})}
{!item.imgArr && (
<View style={styles.viewAddMoreImg}>
<ButtonComponent
iconSource={IMAGES.IcAddMoreImg}
styleIcon={{height: 25, width: 25}}
onPress={() => addMoreImgFromGallery(index)}
/>
</View>
)}
</View>
</View>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
marginTop: 10,
}}>
<TouchableOpacity
onPress={() => closeModalWishBirthday(index)}
style={{alignSelf: 'flex-end'}}>
<AppText style={{color: 'blue', fontWeight: '600'}}>
{' '}
Hủy{' '}
</AppText>
</TouchableOpacity>
<TouchableOpacity
onPress={() => closeModalHappyBirthday(index)}
style={{alignSelf: 'flex-end'}}>
<AppText style={{color: 'blue', fontWeight: '600'}}>
Gửi
</AppText>
</TouchableOpacity>
</View>
</View>
</View>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
marginTop: 10,
}}>
<TouchableOpacity
onPress={() => closeModalWishBirthday(index)}
style={{alignSelf: 'flex-end'}}>
<AppText style={{color: 'blue', fontWeight: '600'}}>
{' '}
Hủy{' '}
</AppText>
</TouchableOpacity>
<TouchableOpacity
onPress={() => closeModalHappyBirthday(index)}
style={{alignSelf: 'flex-end'}}>
<AppText style={{color: 'blue', fontWeight: '600'}}>
Gửi
</AppText>
</TouchableOpacity>
</View>
)}
</View>
)}
</View>
))}
</ScrollView>
</View>
</View>
</Modal>
);
};
))}
</ScrollView>
</View>
</View>
</BottomSheet>
</GestureHandlerRootView>
);
},
function areEqual(prevProps, nextProps) {
return prevProps.modalVisible === nextProps.modalVisible;
},
);
export default
BirthdayModal
;
export default
memo(BirthdayModal)
;
src/screens/home/template/HomeMainView.js
View file @
18e7bc83
/* eslint-disable prettier/prettier */
import
React
from
'react'
;
import
{
SafeAreaView
,
ScrollView
,
View
}
from
'react-native'
;
import
ButtonComponent
from
'../../../components/ButtonComponent'
;
...
...
@@ -8,8 +7,9 @@ import styles from '../style';
import
WishListComponent
from
'../components/WishListComponent'
;
import
CalendarBirthday
from
'./subViews/CalendarBirthday'
;
import
Quotation
from
'./subViews/QuotationList'
;
import
BirthdayModal
from
'../modals/BirthdayModals'
;
const
HomeMainView
=
({
user
Details
,
user
Info
,
openView
,
openModalHappyBirthday
,
closeModalHappyBirthday
,
...
...
@@ -21,6 +21,7 @@ const HomeMainView = ({
openSettingView
,
calendarBirthdayProps
,
randomQuotation
,
birthdayModalProps
,
})
=>
{
return
(
<
SafeAreaView
style
=
{
styles
.
container
}
>
...
...
@@ -66,7 +67,7 @@ const HomeMainView = ({
{
/*wish */
}
{
wishList
.
length
>
0
&&
(
<
WishListComponent
userDetails
=
{
user
Details
}
userDetails
=
{
user
Info
}
openView
=
{
openView
}
openModalHappyBirthday
=
{
openModalHappyBirthday
}
closeModalHappyBirthday
=
{
closeModalHappyBirthday
}
...
...
@@ -75,6 +76,7 @@ const HomeMainView = ({
)}
<
/ScrollView
>
)}
<
BirthdayModal
{...
birthdayModalProps
}
/
>
{
openProfileComponent
&&
openProfileComponent
}
<
/SafeAreaView
>
);
...
...
src/screens/home/template/subViews/CalendarBirthday.js
View file @
18e7bc83
/* eslint-disable prettier/prettier */
import
moment
from
'moment'
;
import
React
,
{
memo
}
from
'react'
;
import
{
Image
,
TouchableOpacity
,
View
}
from
'react-native'
;
...
...
@@ -16,7 +15,6 @@ const CalendarBirthday = React.memo(
handleOpenDesBirthday
,
onCalendarChangeMonth
,
})
=>
{
console
.
log
(
'CalendarBirthday'
);
const
today
=
moment
(
moment
()).
format
(
'YYYY-MM-DD'
);
// Today
return
(
<
View
style
=
{
styles
.
viewContent
}
>
...
...
@@ -115,10 +113,7 @@ const CalendarBirthday = React.memo(
);
},
function
(
prevProps
,
nextProps
)
{
return
(
prevProps
.
birthdayOfUser
===
nextProps
.
birthdayOfUser
||
prevProps
.
bdUserCurrentMonth
===
nextProps
.
bdUserCurrentMonth
);
return
prevProps
.
bdUserCurrentMonth
===
nextProps
.
bdUserCurrentMonth
;
},
);
...
...
src/utils/index.js
View file @
18e7bc83
...
...
@@ -14,7 +14,7 @@ const storeData = async (storageKey, value) => {
const
getData
=
async
storageKey
=>
{
try
{
const
jsonValue
=
await
AsyncStorage
.
getItem
(
storageKey
);
return
jsonValue
!=
null
?
JSON
.
parse
(
jsonValue
)
:
{}
;
return
jsonValue
!=
null
?
JSON
.
parse
(
jsonValue
)
:
null
;
}
catch
(
e
)
{
// error reading value
}
...
...
src/values/images.js
View file @
18e7bc83
...
...
@@ -169,6 +169,9 @@ import IconMailGrey from '../assets/icon/icon_mail_grey.png';
import
IconAddStory
from
'../assets/icon/icon_add_story.png'
;
import
IcCloseGrey
from
'../assets/icon/icon_close_grey.png'
;
import
IcOutlineSend
from
'../assets/icon/icon_outline_send.png'
;
import
IcAvatarDefault
from
'../assets/icon/icon_avatar_default.png'
;
export
const
IMAGES
=
{
IcHome
,
IcHomeFocus
,
...
...
@@ -262,7 +265,9 @@ export const IMAGES = {
IcPhoneGrey
,
IconMailGrey
,
IcCloseGrey
,
IcMore
IcMore
,
IcOutlineSend
,
IcAvatarDefault
,
};
export
const
BgIntroduce
=
{
BgStep1
,
...
...
yarn.lock
View file @
18e7bc83
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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