ordering-ui-react-native 0.15.64 → 0.15.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { Pressable, View } from 'react-native';
|
|
2
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
3
3
|
import { useTheme } from 'styled-components/native'
|
|
4
4
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
5
|
+
import FastImage from 'react-native-fast-image'
|
|
5
6
|
import {
|
|
6
7
|
WalletList,
|
|
7
8
|
useLanguage,
|
|
8
9
|
useUtils,
|
|
9
|
-
useConfig
|
|
10
|
+
useConfig,
|
|
11
|
+
useSession
|
|
10
12
|
} from 'ordering-components/native'
|
|
11
13
|
|
|
12
14
|
import {
|
|
@@ -15,7 +17,10 @@ import {
|
|
|
15
17
|
TransactionsWrapper,
|
|
16
18
|
OTabs,
|
|
17
19
|
OTab,
|
|
18
|
-
SectionContent
|
|
20
|
+
SectionContent,
|
|
21
|
+
LoyaltyContent,
|
|
22
|
+
LoyaltyWrapp,
|
|
23
|
+
LoyaltyImg
|
|
19
24
|
} from './styles'
|
|
20
25
|
|
|
21
26
|
import NavBar from '../NavBar'
|
|
@@ -34,16 +39,32 @@ const WalletsUI = (props: any) => {
|
|
|
34
39
|
} = props
|
|
35
40
|
|
|
36
41
|
const [, t] = useLanguage()
|
|
42
|
+
const [{ user }] = useSession()
|
|
37
43
|
const theme = useTheme()
|
|
38
44
|
const [{ parsePrice }] = useUtils()
|
|
39
45
|
const [{ configs }] = useConfig()
|
|
40
46
|
|
|
47
|
+
const styles = StyleSheet.create({
|
|
48
|
+
logoStyle: {
|
|
49
|
+
width: 120,
|
|
50
|
+
height: 120,
|
|
51
|
+
borderRadius: 8,
|
|
52
|
+
borderWidth: 1,
|
|
53
|
+
borderColor: theme.colors.border,
|
|
54
|
+
flexDirection: 'column',
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
41
60
|
const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
|
|
42
61
|
|
|
43
62
|
const isWalletEnabled = configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
|
|
44
63
|
|
|
45
64
|
const currentWalletSelected = (walletList.wallets?.length > 0 && walletList.wallets?.find((w: any) => w.type === tabSelected)) ?? null
|
|
46
65
|
|
|
66
|
+
const loyaltyLevel = Object.keys(user?.loyalty_level).length > 0 && user?.loyalty_level
|
|
67
|
+
|
|
47
68
|
const walletName: any = {
|
|
48
69
|
cash: {
|
|
49
70
|
name: t('CASH_WALLET', 'Cash Wallet'),
|
|
@@ -106,6 +127,39 @@ const WalletsUI = (props: any) => {
|
|
|
106
127
|
</OTabs>
|
|
107
128
|
|
|
108
129
|
<SectionContent>
|
|
130
|
+
{!!loyaltyLevel && (
|
|
131
|
+
<LoyaltyContent>
|
|
132
|
+
<LoyaltyWrapp>
|
|
133
|
+
<OText size={20}>
|
|
134
|
+
{`${t('LOYALTY_LEVEL_TITLE', 'Your level is')}:`}
|
|
135
|
+
</OText>
|
|
136
|
+
{loyaltyLevel.image ? (
|
|
137
|
+
<FastImage
|
|
138
|
+
style={styles.logoStyle}
|
|
139
|
+
source={{
|
|
140
|
+
uri: loyaltyLevel.image,
|
|
141
|
+
priority: FastImage.priority.high,
|
|
142
|
+
cache:FastImage.cacheControl.web
|
|
143
|
+
}}
|
|
144
|
+
resizeMode={FastImage.resizeMode.contain}
|
|
145
|
+
/>
|
|
146
|
+
) : (
|
|
147
|
+
<LoyaltyImg
|
|
148
|
+
source={theme.images.dummies.loyaltyLevel}
|
|
149
|
+
resizeMode='contain'
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
152
|
+
<OText
|
|
153
|
+
size={22}
|
|
154
|
+
weight='bold'
|
|
155
|
+
style={{ textTransform: 'uppercase' }}
|
|
156
|
+
color={theme.colors.primary}
|
|
157
|
+
>
|
|
158
|
+
{loyaltyLevel.name}
|
|
159
|
+
</OText>
|
|
160
|
+
</LoyaltyWrapp>
|
|
161
|
+
</LoyaltyContent>
|
|
162
|
+
)}
|
|
109
163
|
<BalanceElement>
|
|
110
164
|
<OText size={20} style={{fontWeight: '600'}}>
|
|
111
165
|
{currentWalletSelected?.type === 'cash'
|
|
@@ -41,3 +41,24 @@ export const OTabs = styled.View`
|
|
|
41
41
|
export const OTab = styled.View`
|
|
42
42
|
padding-horizontal: 10px;
|
|
43
43
|
`;
|
|
44
|
+
|
|
45
|
+
export const LoyaltyContent = styled.View`
|
|
46
|
+
width: 100%;
|
|
47
|
+
margin-bottom: 20px;
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
export const LoyaltyWrapp = styled.View`
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
align-items: center;
|
|
54
|
+
`
|
|
55
|
+
|
|
56
|
+
export const LoyaltyImg = styled.ImageBackground`
|
|
57
|
+
position: relative;
|
|
58
|
+
height: 150px;
|
|
59
|
+
width: 100%;
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
align-items: center;
|
|
64
|
+
`
|