be-components 6.1.1 → 6.1.3
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/lib/commonjs/BetMatch/api/index.js +56 -1
- package/lib/commonjs/BetMatch/api/index.js.map +1 -1
- package/lib/commonjs/BetMatch/components/BetMatchCard.js +53 -17
- package/lib/commonjs/BetMatch/components/BetMatchCard.js.map +1 -1
- package/lib/commonjs/BetMatch/components/ManageFilter.js +1342 -0
- package/lib/commonjs/BetMatch/components/ManageFilter.js.map +1 -0
- package/lib/commonjs/BetMatch/index.js +84 -24
- package/lib/commonjs/BetMatch/index.js.map +1 -1
- package/lib/commonjs/Components/AthleteLozenge.js +81 -0
- package/lib/commonjs/Components/AthleteLozenge.js.map +1 -0
- package/lib/commonjs/Components/Jerseys.js +30 -11
- package/lib/commonjs/Components/Jerseys.js.map +1 -1
- package/lib/commonjs/Components/LeagueLozenge.js +59 -0
- package/lib/commonjs/Components/LeagueLozenge.js.map +1 -0
- package/lib/commonjs/Components/MarketLozenge.js +48 -0
- package/lib/commonjs/Components/MarketLozenge.js.map +1 -0
- package/lib/commonjs/Components/PlayerLozenge.js +61 -0
- package/lib/commonjs/Components/PlayerLozenge.js.map +1 -0
- package/lib/commonjs/Components/TeamLozenge.js +70 -0
- package/lib/commonjs/Components/TeamLozenge.js.map +1 -0
- package/lib/commonjs/Components/index.js +28 -0
- package/lib/commonjs/Components/index.js.map +1 -1
- package/lib/commonjs/Premium/api/index.js +50 -0
- package/lib/commonjs/Premium/api/index.js.map +1 -0
- package/lib/commonjs/Premium/components/ALaCartePremium.js +67 -42
- package/lib/commonjs/Premium/components/ALaCartePremium.js.map +1 -1
- package/lib/commonjs/ProfileManager/Components/VouchCard.js +3 -3
- package/lib/commonjs/ProfileManager/Components/VouchCard.js.map +1 -1
- package/lib/commonjs/ProfileManager/api/index.js +10 -1
- package/lib/commonjs/ProfileManager/api/index.js.map +1 -1
- package/lib/commonjs/ProfileManager/index.js +2 -2
- package/lib/commonjs/ProfileManager/index.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/BetMatch/api/index.js +55 -0
- package/lib/module/BetMatch/api/index.js.map +1 -1
- package/lib/module/BetMatch/components/BetMatchCard.js +54 -18
- package/lib/module/BetMatch/components/BetMatchCard.js.map +1 -1
- package/lib/module/BetMatch/components/ManageFilter.js +1333 -0
- package/lib/module/BetMatch/components/ManageFilter.js.map +1 -0
- package/lib/module/BetMatch/index.js +86 -26
- package/lib/module/BetMatch/index.js.map +1 -1
- package/lib/module/Components/AthleteLozenge.js +73 -0
- package/lib/module/Components/AthleteLozenge.js.map +1 -0
- package/lib/module/Components/Jerseys.js +30 -11
- package/lib/module/Components/Jerseys.js.map +1 -1
- package/lib/module/Components/LeagueLozenge.js +51 -0
- package/lib/module/Components/LeagueLozenge.js.map +1 -0
- package/lib/module/Components/MarketLozenge.js +40 -0
- package/lib/module/Components/MarketLozenge.js.map +1 -0
- package/lib/module/Components/PlayerLozenge.js +53 -0
- package/lib/module/Components/PlayerLozenge.js.map +1 -0
- package/lib/module/Components/TeamLozenge.js +62 -0
- package/lib/module/Components/TeamLozenge.js.map +1 -0
- package/lib/module/Components/index.js +5 -1
- package/lib/module/Components/index.js.map +1 -1
- package/lib/module/Premium/api/index.js +43 -0
- package/lib/module/Premium/api/index.js.map +1 -0
- package/lib/module/Premium/components/ALaCartePremium.js +67 -42
- package/lib/module/Premium/components/ALaCartePremium.js.map +1 -1
- package/lib/module/ProfileManager/Components/VouchCard.js +3 -3
- package/lib/module/ProfileManager/Components/VouchCard.js.map +1 -1
- package/lib/module/ProfileManager/api/index.js +10 -1
- package/lib/module/ProfileManager/api/index.js.map +1 -1
- package/lib/module/ProfileManager/index.js +2 -2
- package/lib/module/ProfileManager/index.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/BetMatch/api/index.d.ts +6 -0
- package/lib/typescript/lib/commonjs/BetMatch/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/BetMatch/components/BetMatchCard.d.ts +6 -3
- package/lib/typescript/lib/commonjs/BetMatch/components/BetMatchCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/BetMatch/components/ManageFilter.d.ts +10 -0
- package/lib/typescript/lib/commonjs/BetMatch/components/ManageFilter.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/BetMatch/index.d.ts +6 -1
- package/lib/typescript/lib/commonjs/BetMatch/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/AthleteLozenge.d.ts +11 -0
- package/lib/typescript/lib/commonjs/Components/AthleteLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/Jerseys.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/LeagueLozenge.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Components/LeagueLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/MarketLozenge.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Components/MarketLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/PlayerLozenge.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Components/PlayerLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/TeamLozenge.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Components/TeamLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/index.d.ts +4 -0
- package/lib/typescript/lib/commonjs/Premium/api/index.d.ts +18 -0
- package/lib/typescript/lib/commonjs/Premium/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Premium/components/ALaCartePremium.d.ts +4 -1
- package/lib/typescript/lib/commonjs/Premium/components/ALaCartePremium.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/ProfileManager/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/ProfileManager/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/BetMatch/api/index.d.ts +6 -0
- package/lib/typescript/lib/module/BetMatch/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/BetMatch/components/BetMatchCard.d.ts +6 -3
- package/lib/typescript/lib/module/BetMatch/components/BetMatchCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/BetMatch/components/ManageFilter.d.ts +10 -0
- package/lib/typescript/lib/module/BetMatch/components/ManageFilter.d.ts.map +1 -0
- package/lib/typescript/lib/module/BetMatch/index.d.ts +6 -1
- package/lib/typescript/lib/module/BetMatch/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/AthleteLozenge.d.ts +11 -0
- package/lib/typescript/lib/module/Components/AthleteLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/Jerseys.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/LeagueLozenge.d.ts +10 -0
- package/lib/typescript/lib/module/Components/LeagueLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/MarketLozenge.d.ts +10 -0
- package/lib/typescript/lib/module/Components/MarketLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/PlayerLozenge.d.ts +9 -0
- package/lib/typescript/lib/module/Components/PlayerLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/TeamLozenge.d.ts +10 -0
- package/lib/typescript/lib/module/Components/TeamLozenge.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/index.d.ts +5 -1
- package/lib/typescript/lib/module/Components/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Premium/api/index.d.ts +17 -0
- package/lib/typescript/lib/module/Premium/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/Premium/components/ALaCartePremium.d.ts +4 -1
- package/lib/typescript/lib/module/Premium/components/ALaCartePremium.d.ts.map +1 -1
- package/lib/typescript/lib/module/ProfileManager/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/ProfileManager/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/index.d.ts +2 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/BetMatch/api/index.d.ts +7 -1
- package/lib/typescript/src/BetMatch/api/index.d.ts.map +1 -1
- package/lib/typescript/src/BetMatch/components/BetMatchCard.d.ts +7 -5
- package/lib/typescript/src/BetMatch/components/BetMatchCard.d.ts.map +1 -1
- package/lib/typescript/src/BetMatch/components/ManageFilter.d.ts +12 -0
- package/lib/typescript/src/BetMatch/components/ManageFilter.d.ts.map +1 -0
- package/lib/typescript/src/BetMatch/index.d.ts +10 -3
- package/lib/typescript/src/BetMatch/index.d.ts.map +1 -1
- package/lib/typescript/src/Components/AthleteLozenge.d.ts +13 -0
- package/lib/typescript/src/Components/AthleteLozenge.d.ts.map +1 -0
- package/lib/typescript/src/Components/Jerseys.d.ts.map +1 -1
- package/lib/typescript/src/Components/LeagueLozenge.d.ts +13 -0
- package/lib/typescript/src/Components/LeagueLozenge.d.ts.map +1 -0
- package/lib/typescript/src/Components/MarketLozenge.d.ts +13 -0
- package/lib/typescript/src/Components/MarketLozenge.d.ts.map +1 -0
- package/lib/typescript/src/Components/PlayerLozenge.d.ts +11 -0
- package/lib/typescript/src/Components/PlayerLozenge.d.ts.map +1 -0
- package/lib/typescript/src/Components/TeamLozenge.d.ts +12 -0
- package/lib/typescript/src/Components/TeamLozenge.d.ts.map +1 -0
- package/lib/typescript/src/Components/index.d.ts +5 -1
- package/lib/typescript/src/Components/index.d.ts.map +1 -1
- package/lib/typescript/src/Premium/api/index.d.ts +12 -0
- package/lib/typescript/src/Premium/api/index.d.ts.map +1 -0
- package/lib/typescript/src/Premium/components/ALaCartePremium.d.ts +5 -1
- package/lib/typescript/src/Premium/components/ALaCartePremium.d.ts.map +1 -1
- package/lib/typescript/src/Premium/index.d.ts +4 -1
- package/lib/typescript/src/Premium/index.d.ts.map +1 -1
- package/lib/typescript/src/ProfileManager/api/index.d.ts +6 -2
- package/lib/typescript/src/ProfileManager/api/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/BetMatch/api/index.ts +44 -1
- package/src/BetMatch/components/BetMatchCard.tsx +50 -20
- package/src/BetMatch/components/ManageFilter.tsx +830 -0
- package/src/BetMatch/index.tsx +55 -28
- package/src/Components/AthleteLozenge.tsx +52 -0
- package/src/Components/Jerseys.tsx +19 -10
- package/src/Components/LeagueLozenge.tsx +36 -0
- package/src/Components/MarketLozenge.tsx +29 -0
- package/src/Components/PlayerLozenge.tsx +37 -0
- package/src/Components/TeamLozenge.tsx +44 -0
- package/src/Components/index.tsx +8 -0
- package/src/Premium/api/index.ts +32 -0
- package/src/Premium/components/ALaCartePremium.tsx +55 -31
- package/src/ProfileManager/Components/VouchCard.tsx +3 -3
- package/src/ProfileManager/api/index.ts +12 -3
- package/src/ProfileManager/index.tsx +2 -2
- package/src/index.tsx +3 -0
- package/src/types.d.ts +1 -1
package/src/BetMatch/index.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Text, View } from "../Components/Themed";
|
|
2
|
+
import { Button, Text, View } from "../Components/Themed";
|
|
3
3
|
import { MyOrdersHelpers } from '../MarketComponents/components/MyOrderList/api';
|
|
4
|
-
import type { AthleteProps, EventProps, LeagueProps, MarketProps, MatchProps, OrderProps, PlayerFilterProps, PublicPlayerProps, TeamProps, TournamentProps } from '../types';
|
|
4
|
+
import type { AthleteProps, EventProps, LeagueProps, MarketProps, MatchProps, MyPlayerProps, OrderProps, PlayerFilterProps, PlayerPremiumItem, PremiumItemProps, PublicPlayerProps, TeamProps, TournamentProps } from '../types';
|
|
5
5
|
import { BetMatchApi } from './api';
|
|
6
|
-
import { ActivityIndicator, FlatList,
|
|
6
|
+
import { ActivityIndicator, FlatList, StyleSheet, TouchableWithoutFeedback } from 'react-native';
|
|
7
7
|
import BetMatchCardSmall from './components/BetMatchCardSmall';
|
|
8
8
|
import { SocialOrderHelpers } from '../SocialComponents/api';
|
|
9
9
|
import moment from 'moment-mini';
|
|
@@ -15,20 +15,23 @@ type BetMatchProps = {
|
|
|
15
15
|
player_filter_id:string,
|
|
16
16
|
style?:any,
|
|
17
17
|
mode:'desktop'|'mobile',
|
|
18
|
-
|
|
18
|
+
me?:MyPlayerProps,
|
|
19
19
|
insets?:{ top:number, bottom:number, right?:number, left?:number }
|
|
20
20
|
show_grades?:boolean,
|
|
21
21
|
show_external_prices?:boolean,
|
|
22
22
|
onViewPremium?:() => void,
|
|
23
|
+
callback_order?: { result: 'success'|'cancel', order_id:string },
|
|
24
|
+
onPurchasePremium:(ppi:PlayerPremiumItem) => void,
|
|
25
|
+
player_premium_items?:PlayerPremiumItem[],
|
|
26
|
+
premium_items?:PremiumItemProps[],
|
|
23
27
|
onViewPlayer:(player:PublicPlayerProps) => void,
|
|
24
28
|
onSelectGrade:(order:OrderProps) => void,
|
|
25
29
|
onOrder:(order:OrderProps) => void
|
|
26
30
|
}
|
|
27
31
|
const sections = ['filter','orders', 'bet']
|
|
28
|
-
const BetMatch = ({ player_filter_id, mode, insets, onViewPlayer, onSelectGrade, onOrder, onViewPremium }:BetMatchProps) => {
|
|
32
|
+
const BetMatch = ({ me, player_filter_id, mode, insets, player_premium_items, premium_items, callback_order, onViewPlayer, onSelectGrade, onOrder, onPurchasePremium, onViewPremium }:BetMatchProps) => {
|
|
29
33
|
const Colors = useColors();
|
|
30
34
|
|
|
31
|
-
const [ module_size, setModuleSize ] = useState({ width:0, height:0 });
|
|
32
35
|
const [ viewing_order_index, setViewingOrderIndex ] = useState<number>(-1);
|
|
33
36
|
const [ static_data, setStaticData ] = useState<{
|
|
34
37
|
static_loading:boolean,
|
|
@@ -67,6 +70,18 @@ const BetMatch = ({ player_filter_id, mode, insets, onViewPlayer, onSelectGrade,
|
|
|
67
70
|
getStaticData();
|
|
68
71
|
},[player_filter_id]);
|
|
69
72
|
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if(!callback_order){ return }
|
|
75
|
+
//filter out the order!
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
if(callback_order.result == 'success'){
|
|
78
|
+
setFilterData({ ...filter_data, orders: orders.filter(o => o.order_id != callback_order.order_id), action_loading: false })
|
|
79
|
+
} else {
|
|
80
|
+
setFilterData({ ...filter_data, action_loading: false })
|
|
81
|
+
}
|
|
82
|
+
}, 500);
|
|
83
|
+
},[callback_order])
|
|
84
|
+
|
|
70
85
|
const runFilter = async(id:string) => {
|
|
71
86
|
setFilterData({ ...filter_data, loading: true });
|
|
72
87
|
const pf = await BetMatchApi.getPlayerFilterById(id);
|
|
@@ -146,7 +161,6 @@ const BetMatch = ({ player_filter_id, mode, insets, onViewPlayer, onSelectGrade,
|
|
|
146
161
|
contest_title={title}
|
|
147
162
|
time_detail={time}
|
|
148
163
|
league={league}
|
|
149
|
-
|
|
150
164
|
order={data.item}
|
|
151
165
|
onOrder={() => setViewingOrderIndex(data.index)}
|
|
152
166
|
/>
|
|
@@ -190,62 +204,75 @@ const BetMatch = ({ player_filter_id, mode, insets, onViewPlayer, onSelectGrade,
|
|
|
190
204
|
default: return <></>
|
|
191
205
|
}
|
|
192
206
|
}
|
|
193
|
-
|
|
194
207
|
const viewing_player = players.find(p => p.player_id == viewing_order?.player_id);
|
|
195
208
|
const { team, athlete, league, title, time } = SocialOrderHelpers.getContestDetails(viewing_order, events, tournaments, matches, athletes, teams, leagues)
|
|
196
209
|
return (
|
|
197
|
-
<View style={{ flex:1 }}
|
|
198
|
-
const { width, height } = ev.nativeEvent.layout;
|
|
199
|
-
setModuleSize({ width, height })
|
|
200
|
-
}}>
|
|
210
|
+
<View style={{ flex:1 }}>
|
|
201
211
|
<FlatList
|
|
202
212
|
data={sections}
|
|
203
213
|
key={'filter_sections'}
|
|
204
214
|
keyExtractor={item => item}
|
|
205
215
|
renderItem={renderSections}
|
|
206
216
|
/>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
animationType={mode=='desktop' ? 'fade' : 'slide'}
|
|
210
|
-
transparent
|
|
211
|
-
visible={viewing_order ? true : false}
|
|
212
|
-
>
|
|
217
|
+
{viewing_order ?
|
|
218
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0 }}>
|
|
213
219
|
<TouchableWithoutFeedback style={{ flex:1 }} onPress={() => setViewingOrderIndex(-1)}>
|
|
214
220
|
<View type="blur" style={mode=='desktop' ? styles.desktopContainer : { ...styles.viewContainer }}>
|
|
215
221
|
<TouchableWithoutFeedback>
|
|
216
|
-
<View transparent style={mode=='desktop' ?{ width:500,maxHeight:750, borderRadius:22 }:{ flex:1,
|
|
222
|
+
<View transparent style={mode=='desktop' ?{ width:500, maxHeight:750, borderRadius:22 }:{ flex:1, paddingTop:insets?.top ?? 0, paddingBottom:insets?.bottom ?? 0 }}>
|
|
217
223
|
{viewing_order ?
|
|
218
|
-
<View transparent style={{ padding:20 }}>
|
|
224
|
+
<View transparent style={{ padding:10, paddingRight:20, paddingLeft:20, flex:1 }}>
|
|
219
225
|
<BetMatchCard
|
|
220
226
|
player={viewing_player}
|
|
221
227
|
order={viewing_order}
|
|
222
228
|
team={team}
|
|
229
|
+
player_premium_items={player_premium_items}
|
|
230
|
+
premium_items={premium_items}
|
|
231
|
+
me={me}
|
|
223
232
|
athlete={athlete}
|
|
224
233
|
league={league}
|
|
225
234
|
action_loading={action_loading}
|
|
226
235
|
time_detail={time}
|
|
227
236
|
contest_title={title}
|
|
228
237
|
onViewPlayer={onViewPlayer}
|
|
238
|
+
onPurchasePremium={onPurchasePremium}
|
|
229
239
|
onViewPremium={onViewPremium}
|
|
230
240
|
onSelectGrade={onSelectGrade}
|
|
231
|
-
onOrder={(order) =>
|
|
241
|
+
onOrder={(order) => {
|
|
242
|
+
setFilterData({ ...filter_data, action_loading: true });
|
|
243
|
+
onOrder(order);
|
|
244
|
+
}}
|
|
232
245
|
onReject={(order) => handleReject(order)}
|
|
233
246
|
/>
|
|
234
247
|
</View>
|
|
235
248
|
:<></>}
|
|
236
|
-
<View style={{ padding:5, paddingBottom: (insets?.bottom ?? 0) + 5 }}>
|
|
237
|
-
<
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
249
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:5, paddingBottom: (insets?.bottom ?? 0) + 5, borderRadius:8 }}>
|
|
250
|
+
<Button
|
|
251
|
+
float
|
|
252
|
+
title='X'
|
|
253
|
+
title_color={Colors.text.error}
|
|
254
|
+
style={{ borderRadius:100, height:35, width:35, padding:0, justifyContent:'center', alignItems:'center' }}
|
|
255
|
+
onPress={() => {
|
|
256
|
+
if(action_loading){ setFilterData({ ...filter_data, action_loading: false }) }
|
|
257
|
+
setViewingOrderIndex(-1)
|
|
258
|
+
}}
|
|
242
259
|
/>
|
|
260
|
+
<View transparent style={{ flex:1 }}>
|
|
261
|
+
<Pagination
|
|
262
|
+
pages={orders.length}
|
|
263
|
+
onSelectPage={(page) => setViewingOrderIndex(page)}
|
|
264
|
+
onNext={() => setViewingOrderIndex(viewing_order_index + 1)}
|
|
265
|
+
onPrevious={() => setViewingOrderIndex(viewing_order_index - 1)}
|
|
266
|
+
offset={viewing_order_index}
|
|
267
|
+
/>
|
|
268
|
+
</View>
|
|
243
269
|
</View>
|
|
244
270
|
</View>
|
|
245
271
|
</TouchableWithoutFeedback>
|
|
246
272
|
</View>
|
|
247
273
|
</TouchableWithoutFeedback>
|
|
248
|
-
</
|
|
274
|
+
</View>
|
|
275
|
+
:<></>}
|
|
249
276
|
</View>
|
|
250
277
|
)
|
|
251
278
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { AthleteProps, LeagueProps } from '../types'
|
|
3
|
+
import { Button, Text, View } from './Themed'
|
|
4
|
+
import { useColors } from '../constants/useColors'
|
|
5
|
+
import { AthleteImage } from './Jerseys'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
type AthleteLozengeProps = {
|
|
9
|
+
leagues:LeagueProps[],
|
|
10
|
+
athlete: AthleteProps,
|
|
11
|
+
is_active?:boolean,
|
|
12
|
+
abbr_only?:boolean,
|
|
13
|
+
text_size?:number,
|
|
14
|
+
onSelect: (athlete:AthleteProps) => void
|
|
15
|
+
}
|
|
16
|
+
export const AthleteLozenge = ({ leagues, athlete, text_size, is_active, abbr_only, onSelect }:AthleteLozengeProps) => {
|
|
17
|
+
const Colors = useColors();
|
|
18
|
+
const league = leagues.find(l => l.league_id == athlete.league_id);
|
|
19
|
+
const handleSelect = () => {
|
|
20
|
+
if(!onSelect){ return }
|
|
21
|
+
onSelect(athlete)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Button float
|
|
26
|
+
style={{ flexGrow:1, flexDirection:'row', alignItems:'center', margin:4, borderWidth:1, borderRadius:100, padding:0, borderColor:is_active ? Colors.text.success : Colors.borders.light }} onPress={() => handleSelect()}>
|
|
27
|
+
{abbr_only ?
|
|
28
|
+
<View transparent style={{ padding:10 }}>
|
|
29
|
+
<Text size={text_size??16} theme='h2' color={is_active ? Colors.text.success : undefined}>{athlete.position}: {athlete.abbr_name}</Text>
|
|
30
|
+
</View>
|
|
31
|
+
:
|
|
32
|
+
<View transparent style={{ flexDirection:'row', padding:2 }}>
|
|
33
|
+
<AthleteImage
|
|
34
|
+
athlete={athlete}
|
|
35
|
+
league={league}
|
|
36
|
+
size={(text_size ?? 16) * 2}
|
|
37
|
+
number_size={8}
|
|
38
|
+
|
|
39
|
+
/>
|
|
40
|
+
<View transparent style={{marginLeft:10, marginRight:10}}>
|
|
41
|
+
<Text size={text_size??16} theme='h2' color={is_active ? Colors.text.success : undefined}>{athlete.abbr_name}</Text>
|
|
42
|
+
{athlete.team ?
|
|
43
|
+
<Text style={{ marginTop:3 }} size={10} color={is_active ? Colors.text.success : undefined}>{league?`${league.league_name}: `:''}{athlete.team.abbr}</Text>
|
|
44
|
+
:<></>}
|
|
45
|
+
</View>
|
|
46
|
+
</View>
|
|
47
|
+
}
|
|
48
|
+
</Button>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default AthleteLozenge
|
|
@@ -24,15 +24,15 @@ const AthleteImage = ({ athlete, size, number_size, league }:AthleteImageProps)
|
|
|
24
24
|
}
|
|
25
25
|
switch(league.league_name){
|
|
26
26
|
case 'UFC':
|
|
27
|
-
return <MMAJersey />
|
|
27
|
+
return <MMAJersey size={size} />
|
|
28
28
|
case 'BOXING':
|
|
29
|
-
return <MMAJersey />
|
|
29
|
+
return <MMAJersey size={size} />
|
|
30
30
|
case 'MLB':
|
|
31
|
-
return <MLBJersey jersey_fill={athlete.team?.primary_color ?? Colors.brand.midnight} stripe_fill={athlete.team?.secondary_color ?? Colors.brand.mint}/>
|
|
31
|
+
return <MLBJersey size={size} jersey_fill={athlete.team?.primary_color ?? Colors.brand.midnight} stripe_fill={athlete.team?.secondary_color ?? Colors.brand.mint}/>
|
|
32
32
|
case 'PGA':
|
|
33
33
|
return <PGAJersey size={size}/>
|
|
34
34
|
case 'NHL':
|
|
35
|
-
return <NHLJersey jersey_fill={athlete.team?.primary_color ?? Colors.brand.midnight} stripe_fill={athlete.team?.secondary_color ?? Colors.brand.mint}/>
|
|
35
|
+
return <NHLJersey size={size} jersey_fill={athlete.team?.primary_color ?? Colors.brand.midnight} stripe_fill={athlete.team?.secondary_color ?? Colors.brand.mint}/>
|
|
36
36
|
case 'NBA':
|
|
37
37
|
return <NBAJersey size={size} jersey_fill={athlete.team?.primary_color ?? Colors.brand.midnight} stripe_fill={athlete.team?.secondary_color ?? Colors.brand.mint} />
|
|
38
38
|
case 'HORSE':
|
|
@@ -151,9 +151,12 @@ const NBAJersey = ({ jersey_fill, stripe_fill, size }:{ size?:number, jersey_fil
|
|
|
151
151
|
)
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
const MMAJersey = () => {
|
|
154
|
+
const MMAJersey = ({size}:{size?:number}) => {
|
|
155
|
+
const ratio = 0.78
|
|
156
|
+
const height = size ?? 40
|
|
157
|
+
const width = height * ratio
|
|
155
158
|
return (
|
|
156
|
-
<Svg
|
|
159
|
+
<Svg width={`${width}px`} height={`${height}px`} viewBox="0 0 39 50">
|
|
157
160
|
<G id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
158
161
|
<G id="MMA_Glove" fillRule="nonzero">
|
|
159
162
|
<Polygon id="Path" fill="#002A51" points="14.5902716 37.2615039 21.5487452 37.2615039 31.5375218 37.2615039 34.0066576 37.7104377 35.2973423 39.3378227 35.7462761 41.8630752 35.7462761 45.5667789 35.2973423 47.3063973 34.2311245 48.8215488 32.323156 49.5510662 15.9931896 49.5510662 13.5240538 48.372615 12.2894859 46.0718294 12.0089023 42.3681257 12.7384197 39.2255892"></Polygon>
|
|
@@ -211,9 +214,12 @@ const Horse = ({ size }:{size?:number}) => {
|
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
|
|
214
|
-
const NHLJersey = ({ jersey_fill, stripe_fill }:{ jersey_fill:string, stripe_fill:string }) => {
|
|
217
|
+
const NHLJersey = ({ jersey_fill, stripe_fill, size }:{ jersey_fill:string, stripe_fill:string, size?:number }) => {
|
|
218
|
+
const ratio = 0.882
|
|
219
|
+
const height = size ?? 40
|
|
220
|
+
const width = height * ratio
|
|
215
221
|
return (
|
|
216
|
-
<Svg width=
|
|
222
|
+
<Svg width={`${width}px`} height={`${height}px`} viewBox="0 0 45 51">
|
|
217
223
|
<G id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
218
224
|
<G id="HockeyJerseyTemplate-1" transform="translate(1.000000, -0.000000)">
|
|
219
225
|
<Path d="M21.8934492,50.1075287 C29.7517492,50.1075287 33.7066492,46.6889287 33.7066492,46.6889287 C33.3190492,41.6757287 33.2352492,36.4133287 33.2352492,36.4133287 C33.8640492,39.2624287 36.6538492,46.4634287 36.6538492,46.4634287 C40.0629492,46.4927287 43.7955492,45.5499287 43.7955492,45.5499287 C43.7955492,44.3025287 41.4281492,20.0472287 39.4436492,12.6199287 C37.4590492,5.19268874 35.9657492,4.03390874 34.8069492,3.42485874 C33.6481492,2.81500874 26.2738492,0.185014644 26.2738492,0.185014644 L26.3577492,0.185014644 C26.3577492,0.185014644 21.4987492,1.60244874 17.4386492,0.185014644 L17.5225492,0.185014644 C17.5225492,0.185014644 10.1482492,2.81500874 8.9886592,3.42405874 C7.8290892,4.03311874 6.3365092,5.19268874 4.3519492,12.6191287 C2.3673892,20.0464287 0,44.3017287 0,45.5499287 C0,45.5499287 3.7334092,46.4927287 7.1417292,46.4634287 C7.1417292,46.4634287 9.9314992,39.2624287 10.5603492,36.4133287 C10.5603492,36.4133287 10.3538492,42.5631287 10.0889492,46.6889287 C10.0889492,46.6889287 14.0350492,50.1075287 21.8934492,50.1075287 Z" id="Path" fill={jersey_fill} fillRule="nonzero"></Path>
|
|
@@ -235,9 +241,12 @@ const NHLJersey = ({ jersey_fill, stripe_fill }:{ jersey_fill:string, stripe_fil
|
|
|
235
241
|
}
|
|
236
242
|
|
|
237
243
|
|
|
238
|
-
const MLBJersey = ({ jersey_fill, stripe_fill }:{ jersey_fill:string, stripe_fill:string }) => {
|
|
244
|
+
const MLBJersey = ({ jersey_fill, stripe_fill, size }:{ jersey_fill:string, stripe_fill:string, size?:number }) => {
|
|
245
|
+
const ratio = 0.857
|
|
246
|
+
const height = size ?? 40
|
|
247
|
+
const width = height * ratio
|
|
239
248
|
return (
|
|
240
|
-
<Svg width=
|
|
249
|
+
<Svg width={`${width}px`} height={`${height}px`} viewBox="0 0 42 49">
|
|
241
250
|
<G id="Page-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
242
251
|
<G id="Baseball" transform="translate(1.000000, 0.000000)">
|
|
243
252
|
<Path d="M3.44369,25.7043763 L0,17.6691763 L1.1479,17.2386763 L9.18316,14.2254763 L13.40966,13.1688763 L16.18536,12.3883763 C18.36636,14.2256763 21.23606,15.3735763 23.99096,12.3887763 L26.97556,13.0775763 L31.56706,14.2254763 L39.02846,17.2386763 L40.17636,17.6691763 L36.73266,25.7043763 L35.43216,25.5418763 L32.14106,25.1304763 L33.19456,41.9868763 L33.28896,43.4967763 C31.94976,43.8793763 29.15656,44.8742763 28.69736,45.7925763 C28.23816,46.7108763 23.91446,47.7056763 21.80996,48.0883763 L18.94026,48.0883763 C17.21846,48.0883763 12.62686,46.9404763 11.47896,45.7925763 C10.56066,44.8742763 8.41786,43.8793763 7.46136,43.4967763 L7.51506,41.7754763 L8.03526,25.1304763 L4.7442,25.5418763 L3.44369,25.7043763 Z" id="Path" fill={jersey_fill} fillRule="nonzero"></Path>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Image, type ViewStyle } from "react-native"
|
|
3
|
+
import type { LeagueProps } from '../types'
|
|
4
|
+
import { Button, Text } from './Themed'
|
|
5
|
+
import { useColors } from '../constants/useColors'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
type LeagueLozengeProps = {
|
|
9
|
+
league: LeagueProps,
|
|
10
|
+
is_active?:boolean,
|
|
11
|
+
text_size?:number,
|
|
12
|
+
style?:ViewStyle,
|
|
13
|
+
onSelect: (league:LeagueProps) => void
|
|
14
|
+
}
|
|
15
|
+
export const LeagueLozenge = ({ league, style, is_active, text_size, onSelect }:LeagueLozengeProps) => {
|
|
16
|
+
const Colors = useColors();
|
|
17
|
+
const handleSelect = () => {
|
|
18
|
+
if(!onSelect){ return }
|
|
19
|
+
onSelect(league)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Button float style={{ flexDirection:'row', alignItems:'center', margin:4, borderWidth:1, borderColor:is_active?Colors.text.success: Colors.borders.light, borderRadius:100, padding:10, paddingRight:text_size??20, paddingLeft:text_size??20, ...style }} onPress={() => handleSelect()}>
|
|
24
|
+
{league.league_image ?
|
|
25
|
+
<Image
|
|
26
|
+
source={{ uri: league.league_image }}
|
|
27
|
+
style={{ height:18, width:18, marginRight:5 }}
|
|
28
|
+
resizeMode='cover'
|
|
29
|
+
/>
|
|
30
|
+
:<></>}
|
|
31
|
+
<Text size={text_size??16} color={is_active ? Colors.text.success : undefined} theme='h2'>{league.league_name}</Text>
|
|
32
|
+
</Button>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default LeagueLozenge
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Button, Text } from './Themed'
|
|
3
|
+
import { useColors } from '../constants/useColors'
|
|
4
|
+
import type { MarketProps } from '../types'
|
|
5
|
+
import type { ViewStyle } from 'react-native'
|
|
6
|
+
|
|
7
|
+
type MarketLozengeProps = {
|
|
8
|
+
market: MarketProps,
|
|
9
|
+
text_size?:number,
|
|
10
|
+
is_active?:boolean,
|
|
11
|
+
style?:ViewStyle,
|
|
12
|
+
onSelect: (market:MarketProps) => void
|
|
13
|
+
}
|
|
14
|
+
export const MarketLozenge = ({ style, market, text_size, is_active, onSelect }:MarketLozengeProps) => {
|
|
15
|
+
const Colors = useColors();
|
|
16
|
+
const handleSelect = () => {
|
|
17
|
+
if(!onSelect){ return }
|
|
18
|
+
onSelect(market)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Button float style={{ flexDirection:'row', alignItems:'center', margin:4, borderWidth:1, borderColor:is_active?Colors.text.success: Colors.borders.light, borderRadius:100, padding:10, paddingRight:text_size??20, paddingLeft:text_size??20, ...style }} onPress={() => handleSelect()}>
|
|
23
|
+
|
|
24
|
+
<Text size={text_size??16} color={is_active ? Colors.text.success : undefined} theme='h2'>{market.stat_label?market.stat_label:market.type}</Text>
|
|
25
|
+
</Button>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default MarketLozenge
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Button, Text, View } from './Themed'
|
|
3
|
+
import { useColors } from '../constants/useColors'
|
|
4
|
+
import type { PublicPlayerProps } from '../types'
|
|
5
|
+
import { Image } from 'react-native'
|
|
6
|
+
|
|
7
|
+
type PlayerLozengeProps = {
|
|
8
|
+
player: PublicPlayerProps,
|
|
9
|
+
is_active?:boolean,
|
|
10
|
+
hide_name?:boolean,
|
|
11
|
+
onSelect: (player:PublicPlayerProps) => void
|
|
12
|
+
}
|
|
13
|
+
export const PlayerLozenge = ({ player, hide_name, is_active, onSelect }:PlayerLozengeProps) => {
|
|
14
|
+
const Colors = useColors();
|
|
15
|
+
|
|
16
|
+
const handleSelect = () => {
|
|
17
|
+
if(!onSelect){ return }
|
|
18
|
+
onSelect(player)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Button float style={{ flexGrow:!hide_name ?1 : undefined,flexDirection:'row', alignItems:'center', margin:4, borderColor:is_active?Colors.text.success:Colors.borders.light, borderWidth:1, padding:2, borderRadius:100 }} onPress={() => handleSelect()}>
|
|
23
|
+
<Image
|
|
24
|
+
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
25
|
+
style={{ height:36, width:36, borderRadius:100 }}
|
|
26
|
+
resizeMode='cover'
|
|
27
|
+
/>
|
|
28
|
+
{!hide_name ?
|
|
29
|
+
<View transparent style={{ flexGrow:1, padding:10 }}>
|
|
30
|
+
<Text theme='h2' color={is_active ? Colors.text.success: undefined}>@{player.username}</Text>
|
|
31
|
+
</View>
|
|
32
|
+
:<></>}
|
|
33
|
+
</Button>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default PlayerLozenge
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Button, Text, View } from './Themed'
|
|
3
|
+
import { useColors } from '../constants/useColors'
|
|
4
|
+
import type { LeagueProps, TeamProps } from '../types'
|
|
5
|
+
import { TeamImage } from './Jerseys'
|
|
6
|
+
|
|
7
|
+
type TeamLozengeProps = {
|
|
8
|
+
team: TeamProps,
|
|
9
|
+
leagues:LeagueProps[],
|
|
10
|
+
is_active?:boolean,
|
|
11
|
+
abbr_only?:boolean,
|
|
12
|
+
onSelect: (team:TeamProps) => void
|
|
13
|
+
}
|
|
14
|
+
export const TeamLozenge = ({ team, leagues, is_active, abbr_only, onSelect }:TeamLozengeProps) => {
|
|
15
|
+
const Colors = useColors();
|
|
16
|
+
|
|
17
|
+
const league = leagues.find(l => l.league_id == team.league_id);
|
|
18
|
+
|
|
19
|
+
const handleSelect = () => {
|
|
20
|
+
if(!onSelect){ return }
|
|
21
|
+
onSelect(team)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Button float style={{ flexGrow:1, flexDirection:'row', alignItems:'center', margin:4, borderColor:is_active?Colors.text.success:undefined, borderWidth:1, padding:0, borderRadius:100 }} onPress={() => handleSelect()}>
|
|
26
|
+
{abbr_only ?
|
|
27
|
+
<Text size={16} theme='h2' color={is_active ? Colors.text.success: undefined}>{league?.league_name}: {team.market_name} {team.name}</Text>
|
|
28
|
+
:
|
|
29
|
+
<View transparent style={{ flex:1, flexDirection:'row', alignItems:'center', padding:2 }}>
|
|
30
|
+
<TeamImage
|
|
31
|
+
league={league}
|
|
32
|
+
team={team}
|
|
33
|
+
size={16}
|
|
34
|
+
/>
|
|
35
|
+
<View transparent style={{ flex:1, marginLeft:10, padding:10 }}>
|
|
36
|
+
<Text theme='h1' color={is_active ? Colors.text.success: undefined}>{team.market_name} {team.name}</Text>
|
|
37
|
+
</View>
|
|
38
|
+
</View>
|
|
39
|
+
}
|
|
40
|
+
</Button>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default TeamLozenge
|
package/src/Components/index.tsx
CHANGED
|
@@ -11,6 +11,10 @@ import Toggle from './Toggle';
|
|
|
11
11
|
import ProgressBar from './ProgressBar';
|
|
12
12
|
import AutoScrollingFlatList from './AutoScrollFlatList';
|
|
13
13
|
import PremiumIcons from './PremiumIcons';
|
|
14
|
+
import LeagueLozenge from './LeagueLozenge';
|
|
15
|
+
import MarketLozenge from './MarketLozenge';
|
|
16
|
+
import AthleteLozenge from './AthleteLozenge';
|
|
17
|
+
import PlayerLozenge from './PlayerLozenge';
|
|
14
18
|
|
|
15
19
|
export {
|
|
16
20
|
Button,
|
|
@@ -18,11 +22,15 @@ export {
|
|
|
18
22
|
Spring,
|
|
19
23
|
AutoScrollingFlatList,
|
|
20
24
|
Switch,
|
|
25
|
+
MarketLozenge,
|
|
21
26
|
TextInput,
|
|
27
|
+
PlayerLozenge,
|
|
28
|
+
AthleteLozenge,
|
|
22
29
|
ProgressBar,
|
|
23
30
|
Checkbox,
|
|
24
31
|
Toggle,
|
|
25
32
|
Icons,
|
|
33
|
+
LeagueLozenge,
|
|
26
34
|
PremiumIcons,
|
|
27
35
|
ConfirmationModal,
|
|
28
36
|
LinearDiagnal
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { APIOverrides } from "../../ApiOverrides";
|
|
3
|
+
import type { PlayerPremiumItem, PremiumItemProps } from "../../types";
|
|
4
|
+
|
|
5
|
+
let AUTH_SVC_API = ''
|
|
6
|
+
|
|
7
|
+
export const PremiumApi = {
|
|
8
|
+
setEnvironment: () => {
|
|
9
|
+
const endpoints = APIOverrides.getEndpoints();
|
|
10
|
+
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
11
|
+
},
|
|
12
|
+
purchasePremiumItem: async(premium_item_id:string, type:'day'|'month'):Promise<PlayerPremiumItem | undefined> => {
|
|
13
|
+
try {
|
|
14
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/premium/item/purchase`, { premium_item_id, type })
|
|
15
|
+
return resp.data.player_premium_item
|
|
16
|
+
} catch (e) {
|
|
17
|
+
console.log(e)
|
|
18
|
+
return undefined
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const PremiumHelpers = {
|
|
24
|
+
getItemFromIdentifer : (identifier:string, premium_items?:PremiumItemProps[], player_premium_items?:PlayerPremiumItem[]):{ player_premium_item?:PlayerPremiumItem, premium_item?:PremiumItemProps } => {
|
|
25
|
+
if(!premium_items){ return {} }
|
|
26
|
+
let premium_item = premium_items.find(pi => pi.identifier == identifier);
|
|
27
|
+
if(!premium_item){ return {} }
|
|
28
|
+
if(!player_premium_items){ return { premium_item } }
|
|
29
|
+
let player_premium_item = player_premium_items.find(ppi => ppi.premium_item_id == premium_item.premium_item_id);
|
|
30
|
+
return { premium_item, player_premium_item }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -5,12 +5,17 @@ import type { MyPlayerProps, PlayerPremiumItem, PremiumItemProps } from '../../t
|
|
|
5
5
|
import { Icons, PremiumIcons } from '../../Components';
|
|
6
6
|
import { Button, Text, View } from '../../Components/Themed';
|
|
7
7
|
import { useColors } from '../../constants/useColors';
|
|
8
|
+
import type { ViewStyle } from 'react-native';
|
|
9
|
+
import { PremiumApi } from '../api';
|
|
8
10
|
|
|
9
11
|
type ALaCartePremiumProps = {
|
|
10
12
|
identifier: string,
|
|
13
|
+
style?:ViewStyle,
|
|
11
14
|
player?:MyPlayerProps,
|
|
12
15
|
premium_item:PremiumItemProps,
|
|
13
|
-
player_premium_item?:PlayerPremiumItem
|
|
16
|
+
player_premium_item?:PlayerPremiumItem,
|
|
17
|
+
onPurchaseItem:(player_premium_item:PlayerPremiumItem) => void,
|
|
18
|
+
onViewPremium:(premium_item_id?:string) => void
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export const getIconByFeature = (pi:PremiumItemProps, color:string) => {
|
|
@@ -35,7 +40,7 @@ export const getIconByFeature = (pi:PremiumItemProps, color:string) => {
|
|
|
35
40
|
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
const ALaCartePremium = ({ player, premium_item, player_premium_item }:ALaCartePremiumProps) => {
|
|
43
|
+
const ALaCartePremium = ({ style, player, premium_item, player_premium_item, onPurchaseItem, onViewPremium }:ALaCartePremiumProps) => {
|
|
39
44
|
const Colors = useColors();
|
|
40
45
|
const [ expanded, setExpanded ] = useState(false);
|
|
41
46
|
const [ purchase_loading, setPurchaseLoading ] = useState(false);
|
|
@@ -49,7 +54,13 @@ const ALaCartePremium = ({ player, premium_item, player_premium_item }:ALaCarteP
|
|
|
49
54
|
if(!premium_item){ return }
|
|
50
55
|
if(player_premium_item){ return }//Already have this one
|
|
51
56
|
setPurchaseLoading(true);
|
|
52
|
-
|
|
57
|
+
PremiumApi.setEnvironment();
|
|
58
|
+
let ppi = await PremiumApi.purchasePremiumItem(premium_item.premium_item_id, selected_price);
|
|
59
|
+
if(!ppi){
|
|
60
|
+
alert('Unable to complete purchase')
|
|
61
|
+
return setPurchaseLoading(false)
|
|
62
|
+
}
|
|
63
|
+
onPurchaseItem(ppi);
|
|
53
64
|
setPurchaseLoading(false)
|
|
54
65
|
}
|
|
55
66
|
|
|
@@ -60,55 +71,68 @@ const ALaCartePremium = ({ player, premium_item, player_premium_item }:ALaCarteP
|
|
|
60
71
|
|
|
61
72
|
if(player_premium_item){ return <></> } //We already have this!
|
|
62
73
|
return (
|
|
63
|
-
<View style={{
|
|
64
|
-
<Button transparent style={{ flexDirection:'row', alignItems:'center' }} onPress={() => setExpanded(!expanded)}>
|
|
65
|
-
<View style={{ padding:5 }}>
|
|
74
|
+
<View transparent style={{ ...style }}>
|
|
75
|
+
<Button float transparent style={{ padding:10, flexDirection:'row', alignItems:'center', borderBottomWidth:expanded?0:1, borderBottomRightRadius:expanded?0:8, borderBottomLeftRadius:expanded?0:8 }} onPress={() => setExpanded(!expanded)}>
|
|
76
|
+
<View transparent style={{ padding:5 }}>
|
|
66
77
|
{getIconByFeature(premium_item, Colors.text.gold)}
|
|
67
78
|
</View>
|
|
68
|
-
<View style={{ flex:1, marginLeft:10 }}>
|
|
79
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
69
80
|
<Text size={14} theme='h1'>Unlock Premium Item</Text>
|
|
70
81
|
<Text size={14} theme='description'>{premium_item.name}</Text>
|
|
71
82
|
</View>
|
|
72
|
-
<Icons.ChevronIcon direction={expanded?'up':'down'} color={Colors.text.h1} size={
|
|
83
|
+
<Icons.ChevronIcon direction={expanded?'up':'down'} color={Colors.text.h1} size={10} />
|
|
73
84
|
</Button>
|
|
74
85
|
{expanded ?
|
|
75
|
-
<View>
|
|
86
|
+
<View transparent style={{ borderWidth:1, borderRadius:8, borderTopRightRadius:0, borderTopLeftRadius:0, borderColor:Colors.borders.light }}>
|
|
76
87
|
<Text style={{ padding:10 }} theme='description'>{premium_item.description}</Text>
|
|
77
88
|
{selected_price ?
|
|
78
|
-
<View style={{ padding:10, borderRadius:4 }}>
|
|
89
|
+
<View transparent style={{ padding:10, borderRadius:4 }}>
|
|
79
90
|
<View style={{ flexDirection:'row', marginTop:5 }}>
|
|
80
|
-
<Button
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
<Button
|
|
92
|
+
style={{ flex:1, marginRight:2 }} onPress={() => {
|
|
93
|
+
setSelectedPrice(undefined)
|
|
94
|
+
setALaCarteDiscliamer(false);
|
|
95
|
+
}}
|
|
96
|
+
type='error'
|
|
97
|
+
title='CANCEL'
|
|
98
|
+
/>
|
|
99
|
+
<Button
|
|
100
|
+
type='success'
|
|
101
|
+
disabled={!a_la_carte_disclaimer || purchase_loading?true:false}
|
|
102
|
+
loading={purchase_loading}
|
|
103
|
+
title={`Confirm ${selected_price == 'day' ? premium_item.daily_price:premium_item.monthly_price}`}
|
|
104
|
+
style={{ flex:2, opacity:!a_la_carte_disclaimer||purchase_loading?0.5:1, marginLeft:2, marginRight:2 }}
|
|
105
|
+
onPress={() => handlePurchasePremiumItem()}>
|
|
88
106
|
</Button>
|
|
89
107
|
</View>
|
|
90
108
|
<Button style={{ flexDirection:'row', marginTop:10 }} onPress={() => setALaCarteDiscliamer(!a_la_carte_disclaimer)}>
|
|
91
|
-
<View style={{ marginRight:
|
|
109
|
+
<View style={{ marginRight:10, height:20, width:20, borderRadius:4, borderWidth:1, justifyContent:'center', alignItems:'center' }}>
|
|
92
110
|
{a_la_carte_disclaimer ?
|
|
93
|
-
<View style={{ height:
|
|
111
|
+
<View style={{ height:12, width:12, backgroundColor:Colors.text.h1 }} />
|
|
94
112
|
:<></>}
|
|
95
113
|
</View>
|
|
96
|
-
<Text size={14}>I understand this feature will be unlocked for the next {selected_price==='day'?'24 hours':'month'} and ${selected_price == 'day' ? premium_item.daily_price : premium_item.monthly_price} will be deducted from my wallet immediately.</Text>
|
|
114
|
+
<Text size={14} theme='description'>I understand this feature will be unlocked for the next {selected_price==='day'?'24 hours':'month'} and ${selected_price == 'day' ? premium_item.daily_price : premium_item.monthly_price} will be deducted from my wallet immediately.</Text>
|
|
97
115
|
</Button>
|
|
98
116
|
</View>
|
|
99
117
|
:
|
|
100
|
-
<View style={{ padding:10, borderRadius:4 }}>
|
|
118
|
+
<View transparent style={{ padding:10, borderRadius:4 }}>
|
|
101
119
|
<Text size={14} weight='bold' textAlign='left'>Unlock Options</Text>
|
|
102
|
-
<View style={{ flexDirection:'row', marginTop:5 }}>
|
|
103
|
-
<Button
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<Text size={12} textAlign='center' weight='semibold'>${premium_item.daily_price} - 24 Hours</Text>
|
|
108
|
-
</Button>
|
|
109
|
-
<Button style={{ flex:1, borderRadius:8, padding:10, marginLeft:2 }} onPress={() => setSelectedPrice('month')}>
|
|
110
|
-
<Text size={12} textAlign='center' weight='semibold'>${premium_item.monthly_price} - 1 Month</Text>
|
|
120
|
+
<View transparent style={{ flexDirection:'row', marginTop:5 }}>
|
|
121
|
+
<Button
|
|
122
|
+
float
|
|
123
|
+
style={{ flex:1, borderRadius:8, padding:10, marginRight:2 }} onPress={() => onViewPremium(premium_item.premium_item_id)}>
|
|
124
|
+
<Text size={12} textAlign='center' weight='semibold' color={Colors.text.action}>VIEW PREMIUM</Text>
|
|
111
125
|
</Button>
|
|
126
|
+
<Button
|
|
127
|
+
type='success'
|
|
128
|
+
title={`${premium_item.daily_price} - 24 Hours`}
|
|
129
|
+
style={{ flex:1, borderRadius:8, padding:10, marginLeft:2, marginRight:2, alignItems:'center' }} onPress={() => setSelectedPrice('day')}
|
|
130
|
+
/>
|
|
131
|
+
<Button
|
|
132
|
+
type='success'
|
|
133
|
+
title={`${premium_item.monthly_price} - 1 Month`}
|
|
134
|
+
style={{ flex:1, borderRadius:8, padding:10, marginLeft:2, justifyContent:'center' }} onPress={() => setSelectedPrice('month')}
|
|
135
|
+
/>
|
|
112
136
|
</View>
|
|
113
137
|
</View>
|
|
114
138
|
}
|