be-components 1.4.8 → 1.5.0
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/Competition/api/index.js +15 -0
- package/lib/commonjs/Competition/api/index.js.map +1 -1
- package/lib/commonjs/Competition/components/CompetitionSeasonCard.js +1 -1
- package/lib/commonjs/Competition/components/CompetitionSeasonCard.js.map +1 -1
- package/lib/commonjs/Competition/components/SeasonCard.js +61 -0
- package/lib/commonjs/Competition/components/SeasonCard.js.map +1 -0
- package/lib/commonjs/Competition/index.js +23 -3
- package/lib/commonjs/Competition/index.js.map +1 -1
- package/lib/commonjs/CompetitionManager/api/index.js +3 -5
- package/lib/commonjs/CompetitionManager/api/index.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js +1 -61
- package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js +6 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js +4 -0
- package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CreateCompetitionForm.js +37 -3
- package/lib/commonjs/CompetitionManager/components/CreateCompetitionForm.js.map +1 -1
- package/lib/commonjs/CompetitionSeason/api/index.js +134 -0
- package/lib/commonjs/CompetitionSeason/api/index.js.map +1 -0
- package/lib/commonjs/CompetitionSeason/components/CompetitionsSection.js +127 -0
- package/lib/commonjs/CompetitionSeason/components/CompetitionsSection.js.map +1 -0
- package/lib/commonjs/CompetitionSeason/components/EnterSeasonPrompt.js +253 -0
- package/lib/commonjs/CompetitionSeason/components/EnterSeasonPrompt.js.map +1 -0
- package/lib/commonjs/CompetitionSeason/components/SeasonHeader.js +126 -0
- package/lib/commonjs/CompetitionSeason/components/SeasonHeader.js.map +1 -0
- package/lib/commonjs/CompetitionSeason/components/SeasonLeaderboard.js +324 -0
- package/lib/commonjs/CompetitionSeason/components/SeasonLeaderboard.js.map +1 -0
- package/lib/commonjs/CompetitionSeason/components/SeasonSettingsSection.js +175 -0
- package/lib/commonjs/CompetitionSeason/components/SeasonSettingsSection.js.map +1 -0
- package/lib/commonjs/CompetitionSeason/index.js +278 -0
- package/lib/commonjs/CompetitionSeason/index.js.map +1 -0
- package/lib/commonjs/CompetitionSeasonManager/api/index.js +182 -0
- package/lib/commonjs/CompetitionSeasonManager/api/index.js.map +1 -0
- package/lib/commonjs/CompetitionSeasonManager/components/CompetitionSelector.js +2 -0
- package/lib/commonjs/CompetitionSeasonManager/components/CompetitionSelector.js.map +1 -0
- package/lib/commonjs/CompetitionSeasonManager/components/CompetitionsForm.js +153 -0
- package/lib/commonjs/CompetitionSeasonManager/components/CompetitionsForm.js.map +1 -0
- package/lib/commonjs/CompetitionSeasonManager/components/CreateSeasonForm.js +388 -0
- package/lib/commonjs/CompetitionSeasonManager/components/CreateSeasonForm.js.map +1 -0
- package/lib/commonjs/CompetitionSeasonManager/components/SeasonHeader.js +108 -0
- package/lib/commonjs/CompetitionSeasonManager/components/SeasonHeader.js.map +1 -0
- package/lib/commonjs/CompetitionSeasonManager/components/SeasonInfoForm.js +242 -0
- package/lib/commonjs/CompetitionSeasonManager/components/SeasonInfoForm.js.map +1 -0
- package/lib/commonjs/CompetitionSeasonManager/components/SeasonSettingsForm.js +352 -0
- package/lib/commonjs/CompetitionSeasonManager/components/SeasonSettingsForm.js.map +1 -0
- package/lib/commonjs/CompetitionSeasonManager/index.js +190 -0
- package/lib/commonjs/CompetitionSeasonManager/index.js.map +1 -0
- package/lib/commonjs/Components/Switch.js +3 -0
- package/lib/commonjs/Components/Switch.js.map +1 -1
- package/lib/commonjs/Engage/index.js +28 -1
- package/lib/commonjs/Engage/index.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Competition/api/index.js +15 -0
- package/lib/module/Competition/api/index.js.map +1 -1
- package/lib/module/Competition/components/CompetitionSeasonCard.js +1 -1
- package/lib/module/Competition/components/CompetitionSeasonCard.js.map +1 -1
- package/lib/module/Competition/components/SeasonCard.js +54 -0
- package/lib/module/Competition/components/SeasonCard.js.map +1 -0
- package/lib/module/Competition/index.js +23 -3
- package/lib/module/Competition/index.js.map +1 -1
- package/lib/module/CompetitionManager/api/index.js +3 -5
- package/lib/module/CompetitionManager/api/index.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionInfoForm.js +1 -63
- package/lib/module/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js +6 -1
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/ContestSettingsForm.js +4 -0
- package/lib/module/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/CreateCompetitionForm.js +37 -3
- package/lib/module/CompetitionManager/components/CreateCompetitionForm.js.map +1 -1
- package/lib/module/CompetitionSeason/api/index.js +128 -0
- package/lib/module/CompetitionSeason/api/index.js.map +1 -0
- package/lib/module/CompetitionSeason/components/CompetitionsSection.js +118 -0
- package/lib/module/CompetitionSeason/components/CompetitionsSection.js.map +1 -0
- package/lib/module/CompetitionSeason/components/EnterSeasonPrompt.js +244 -0
- package/lib/module/CompetitionSeason/components/EnterSeasonPrompt.js.map +1 -0
- package/lib/module/CompetitionSeason/components/SeasonHeader.js +119 -0
- package/lib/module/CompetitionSeason/components/SeasonHeader.js.map +1 -0
- package/lib/module/CompetitionSeason/components/SeasonLeaderboard.js +315 -0
- package/lib/module/CompetitionSeason/components/SeasonLeaderboard.js.map +1 -0
- package/lib/module/CompetitionSeason/components/SeasonSettingsSection.js +166 -0
- package/lib/module/CompetitionSeason/components/SeasonSettingsSection.js.map +1 -0
- package/lib/module/CompetitionSeason/index.js +269 -0
- package/lib/module/CompetitionSeason/index.js.map +1 -0
- package/lib/module/CompetitionSeasonManager/api/index.js +176 -0
- package/lib/module/CompetitionSeasonManager/api/index.js.map +1 -0
- package/lib/module/CompetitionSeasonManager/components/CompetitionSelector.js +2 -0
- package/lib/module/CompetitionSeasonManager/components/CompetitionSelector.js.map +1 -0
- package/lib/module/CompetitionSeasonManager/components/CompetitionsForm.js +144 -0
- package/lib/module/CompetitionSeasonManager/components/CompetitionsForm.js.map +1 -0
- package/lib/module/CompetitionSeasonManager/components/CreateSeasonForm.js +379 -0
- package/lib/module/CompetitionSeasonManager/components/CreateSeasonForm.js.map +1 -0
- package/lib/module/CompetitionSeasonManager/components/SeasonHeader.js +101 -0
- package/lib/module/CompetitionSeasonManager/components/SeasonHeader.js.map +1 -0
- package/lib/module/CompetitionSeasonManager/components/SeasonInfoForm.js +233 -0
- package/lib/module/CompetitionSeasonManager/components/SeasonInfoForm.js.map +1 -0
- package/lib/module/CompetitionSeasonManager/components/SeasonSettingsForm.js +343 -0
- package/lib/module/CompetitionSeasonManager/components/SeasonSettingsForm.js.map +1 -0
- package/lib/module/CompetitionSeasonManager/index.js +181 -0
- package/lib/module/CompetitionSeasonManager/index.js.map +1 -0
- package/lib/module/Components/Switch.js +3 -0
- package/lib/module/Components/Switch.js.map +1 -1
- package/lib/module/Engage/index.js +28 -1
- package/lib/module/Engage/index.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/Competition/api/index.d.ts +1 -0
- package/lib/typescript/src/Competition/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Competition/components/SeasonCard.d.ts +10 -0
- package/lib/typescript/src/Competition/components/SeasonCard.d.ts.map +1 -0
- package/lib/typescript/src/Competition/index.d.ts +3 -2
- package/lib/typescript/src/Competition/index.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/api/index.d.ts +1 -1
- package/lib/typescript/src/CompetitionManager/api/index.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CreateCompetitionForm.d.ts +3 -2
- package/lib/typescript/src/CompetitionManager/components/CreateCompetitionForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionSeason/api/index.d.ts +41 -0
- package/lib/typescript/src/CompetitionSeason/api/index.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeason/components/CompetitionsSection.d.ts +14 -0
- package/lib/typescript/src/CompetitionSeason/components/CompetitionsSection.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeason/components/EnterSeasonPrompt.d.ts +16 -0
- package/lib/typescript/src/CompetitionSeason/components/EnterSeasonPrompt.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeason/components/SeasonHeader.d.ts +15 -0
- package/lib/typescript/src/CompetitionSeason/components/SeasonHeader.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeason/components/SeasonLeaderboard.d.ts +18 -0
- package/lib/typescript/src/CompetitionSeason/components/SeasonLeaderboard.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeason/components/SeasonSettingsSection.d.ts +12 -0
- package/lib/typescript/src/CompetitionSeason/components/SeasonSettingsSection.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeason/index.d.ts +12 -0
- package/lib/typescript/src/CompetitionSeason/index.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/api/index.d.ts +31 -0
- package/lib/typescript/src/CompetitionSeasonManager/api/index.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/CompetitionSelector.d.ts +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/CompetitionSelector.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/CompetitionsForm.d.ts +12 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/CompetitionsForm.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/CreateSeasonForm.d.ts +11 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/CreateSeasonForm.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/SeasonHeader.d.ts +13 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/SeasonHeader.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/SeasonInfoForm.d.ts +11 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/SeasonInfoForm.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/SeasonSettingsForm.d.ts +12 -0
- package/lib/typescript/src/CompetitionSeasonManager/components/SeasonSettingsForm.d.ts.map +1 -0
- package/lib/typescript/src/CompetitionSeasonManager/index.d.ts +8 -0
- package/lib/typescript/src/CompetitionSeasonManager/index.d.ts.map +1 -0
- package/lib/typescript/src/Components/Switch.d.ts +2 -1
- package/lib/typescript/src/Components/Switch.d.ts.map +1 -1
- package/lib/typescript/src/Engage/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Competition/api/index.ts +15 -0
- package/src/Competition/components/CompetitionSeasonCard.tsx +1 -1
- package/src/Competition/components/SeasonCard.tsx +46 -0
- package/src/Competition/index.tsx +45 -27
- package/src/CompetitionManager/api/index.ts +2 -5
- package/src/CompetitionManager/components/CompetitionInfoForm.tsx +2 -64
- package/src/CompetitionManager/components/CompetitionSettingsForm.tsx +10 -3
- package/src/CompetitionManager/components/ContestSettingsForm.tsx +8 -2
- package/src/CompetitionManager/components/CreateCompetitionForm.tsx +20 -4
- package/src/CompetitionSeason/api/index.ts +111 -0
- package/src/CompetitionSeason/components/CompetitionsSection.tsx +99 -0
- package/src/CompetitionSeason/components/EnterSeasonPrompt.tsx +135 -0
- package/src/CompetitionSeason/components/SeasonHeader.tsx +81 -0
- package/src/CompetitionSeason/components/SeasonLeaderboard.tsx +205 -0
- package/src/CompetitionSeason/components/SeasonSettingsSection.tsx +92 -0
- package/src/CompetitionSeason/index.tsx +244 -0
- package/src/CompetitionSeasonManager/api/index.ts +127 -0
- package/src/CompetitionSeasonManager/components/CompetitionSelector.tsx +2 -0
- package/src/CompetitionSeasonManager/components/CompetitionsForm.tsx +113 -0
- package/src/CompetitionSeasonManager/components/CreateSeasonForm.tsx +238 -0
- package/src/CompetitionSeasonManager/components/SeasonHeader.tsx +75 -0
- package/src/CompetitionSeasonManager/components/SeasonInfoForm.tsx +124 -0
- package/src/CompetitionSeasonManager/components/SeasonSettingsForm.tsx +185 -0
- package/src/CompetitionSeasonManager/index.tsx +151 -0
- package/src/Components/Switch.tsx +8 -3
- package/src/Engage/index.tsx +20 -0
- package/src/index.tsx +4 -1
- package/src/types.d.ts +48 -5
- package/lib/commonjs/Competition/components/ManageSeasonForm.js +0 -605
- package/lib/commonjs/Competition/components/ManageSeasonForm.js.map +0 -1
- package/lib/commonjs/Competition/components/SeasonInfoModal.js +0 -400
- package/lib/commonjs/Competition/components/SeasonInfoModal.js.map +0 -1
- package/lib/module/Competition/components/ManageSeasonForm.js +0 -596
- package/lib/module/Competition/components/ManageSeasonForm.js.map +0 -1
- package/lib/module/Competition/components/SeasonInfoModal.js +0 -391
- package/lib/module/Competition/components/SeasonInfoModal.js.map +0 -1
- package/lib/typescript/src/Competition/components/ManageSeasonForm.d.ts +0 -10
- package/lib/typescript/src/Competition/components/ManageSeasonForm.d.ts.map +0 -1
- package/lib/typescript/src/Competition/components/SeasonInfoModal.d.ts +0 -14
- package/lib/typescript/src/Competition/components/SeasonInfoModal.d.ts.map +0 -1
- package/src/Competition/components/ManageSeasonForm.tsx +0 -271
- package/src/Competition/components/SeasonInfoModal.tsx +0 -212
|
@@ -55,7 +55,9 @@ const CompetitionSettingsForm = ({ is_valid, player, width, competition, competi
|
|
|
55
55
|
if(!draft_competition){ return <></> }
|
|
56
56
|
const selected = data.item == competition.market_type ? true : false
|
|
57
57
|
return (
|
|
58
|
-
<TouchableOpacity
|
|
58
|
+
<TouchableOpacity
|
|
59
|
+
disabled={competition.competition_season_id ? true : false}
|
|
60
|
+
style={{ minWidth:75, margin:1, borderRadius:8, padding:10, backgroundColor:selected?Colors.brand.midnight:undefined }} onPress={() => onCompetitionUpdate({ ...draft_competition, market_type: data.item })}>
|
|
59
61
|
<Text textAlign="center" color={selected?Colors.shades.white:Colors.brand.midnight} weight={selected?'bold':'regular'} size={14}>{data.item == 'FOR_MONEY'?'USD':'EDGE COINS'}</Text>
|
|
60
62
|
</TouchableOpacity>
|
|
61
63
|
)
|
|
@@ -115,6 +117,7 @@ const CompetitionSettingsForm = ({ is_valid, player, width, competition, competi
|
|
|
115
117
|
</View>
|
|
116
118
|
<View style={{ justifyContent:'flex-end', margin:5, borderRadius:8, backgroundColor:Colors.shades.white }}>
|
|
117
119
|
<DropDown
|
|
120
|
+
read_only={competition.competition_season_id ? true : false}
|
|
118
121
|
dropdown_options={[
|
|
119
122
|
{value: 'competition_result_type_id', eligible_options: competition_result_types.map(t => t.label)}
|
|
120
123
|
]}
|
|
@@ -128,7 +131,9 @@ const CompetitionSettingsForm = ({ is_valid, player, width, competition, competi
|
|
|
128
131
|
</View>
|
|
129
132
|
</View>
|
|
130
133
|
{competition_result_type?.type == 'outpace' ?
|
|
131
|
-
<TouchableOpacity
|
|
134
|
+
<TouchableOpacity
|
|
135
|
+
disabled={competition.competition_season_id ? true : false}
|
|
136
|
+
style={{ backgroundColor:Colors.shades.white, borderRadius:8, padding:10 }} onPress={() => onShowPacers()}>
|
|
132
137
|
{pacer ?
|
|
133
138
|
<View style={{ ...view_styles.body_row }}>
|
|
134
139
|
<Icons.PacerCarIcon size={24} color={Colors.brand.midnight} />
|
|
@@ -167,7 +172,8 @@ const CompetitionSettingsForm = ({ is_valid, player, width, competition, competi
|
|
|
167
172
|
<TextInput
|
|
168
173
|
style={{ ...view_styles.input, textAlign:'center', margin:5, width:100, backgroundColor:Colors.shades.white }}
|
|
169
174
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, buy_in: text })}
|
|
170
|
-
placeholder="
|
|
175
|
+
placeholder="0"
|
|
176
|
+
editable={competition.competition_season_id ? false : true}
|
|
171
177
|
value={draft_competition.buy_in as string}
|
|
172
178
|
placeholderTextColor={Colors.brand.slate}
|
|
173
179
|
/>
|
|
@@ -182,6 +188,7 @@ const CompetitionSettingsForm = ({ is_valid, player, width, competition, competi
|
|
|
182
188
|
style={{ ...view_styles.input, textAlign:'center', width:100, backgroundColor:Colors.shades.white }}
|
|
183
189
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, available_tickets: text })}
|
|
184
190
|
placeholder="100"
|
|
191
|
+
editable={competition.competition_season_id ? false : true}
|
|
185
192
|
value={draft_competition.available_tickets as string}
|
|
186
193
|
placeholderTextColor={Colors.brand.slate}
|
|
187
194
|
/>
|
|
@@ -38,7 +38,9 @@ const ContestSettingsForm = ({ is_valid, width, competition, competition_matches
|
|
|
38
38
|
if(!draft_competition) { return <></> }
|
|
39
39
|
const selected = data.item.competition_type_id == competition.competition_type_id ? true : false
|
|
40
40
|
return (
|
|
41
|
-
<TouchableOpacity
|
|
41
|
+
<TouchableOpacity
|
|
42
|
+
disabled={competition.competition_season_id ? true : false}
|
|
43
|
+
style={{ minWidth:75, margin:1, borderRadius:8, padding:10, backgroundColor:selected?Colors.brand.midnight:undefined }} onPress={() => onCompetitionUpdate({ ...draft_competition, competition_type_id: data.item.competition_type_id })}>
|
|
42
44
|
<Text textAlign="center" color={selected?Colors.shades.white:Colors.brand.midnight} weight={selected?'bold':'regular'} size={14}>{data.item.type_label}</Text>
|
|
43
45
|
</TouchableOpacity>
|
|
44
46
|
)
|
|
@@ -48,7 +50,9 @@ const ContestSettingsForm = ({ is_valid, width, competition, competition_matches
|
|
|
48
50
|
if(!draft_competition) { return <></> }
|
|
49
51
|
const selected = data.item == competition?.length_type ? true : false
|
|
50
52
|
return (
|
|
51
|
-
<TouchableOpacity
|
|
53
|
+
<TouchableOpacity
|
|
54
|
+
disabled={competition.competition_season_id ? true : false}
|
|
55
|
+
style={{ minWidth:75, margin:1, borderRadius:8, padding:10, backgroundColor:selected?Colors.brand.midnight:undefined }} onPress={() => onCompetitionUpdate({ ...draft_competition, length_type: data.item })}>
|
|
52
56
|
<Text textAlign="center" color={selected?Colors.shades.white:Colors.brand.midnight} weight={selected?'bold':'regular'} size={14}>{data.item.toUpperCase()}</Text>
|
|
53
57
|
</TouchableOpacity>
|
|
54
58
|
)
|
|
@@ -135,6 +139,7 @@ const ContestSettingsForm = ({ is_valid, width, competition, competition_matches
|
|
|
135
139
|
<Text style={{ marginTop:3 }}>The total number of picks allowed by each participant.</Text>
|
|
136
140
|
</View>
|
|
137
141
|
<TextInput
|
|
142
|
+
editable={competition.competition_season_id ? false : true}
|
|
138
143
|
style={{ ...view_styles.input, width:75, textAlign:'center' }}
|
|
139
144
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, max_pick_count: text })}
|
|
140
145
|
placeholder="0"
|
|
@@ -150,6 +155,7 @@ const ContestSettingsForm = ({ is_valid, width, competition, competition_matches
|
|
|
150
155
|
<Text style={{ marginTop:3 }}>Initial balance that each player will start with at the beginning of the competition.</Text>
|
|
151
156
|
</View>
|
|
152
157
|
<TextInput
|
|
158
|
+
editable={competition.competition_season_id ? false : true}
|
|
153
159
|
style={{ ...view_styles.input, width:75, textAlign:'center' }}
|
|
154
160
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, initial_balance: text })}
|
|
155
161
|
placeholder="0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompanyProps, CompetitionProps } from "../../types"
|
|
1
|
+
import type { CompanyProps, CompetitionProps, CompetitionSeasonProps } from "../../types"
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { View, TouchableOpacity, Image, FlatList, ScrollView } from 'react-native';
|
|
4
4
|
import { view_styles } from "../../constants/styles";
|
|
@@ -8,12 +8,13 @@ import Colors from "../../constants/colors";
|
|
|
8
8
|
|
|
9
9
|
type CreateCompetitionFormProps = {
|
|
10
10
|
width:number,
|
|
11
|
+
competition_season?:CompetitionSeasonProps,
|
|
11
12
|
max_height?:number,
|
|
12
13
|
onCreate: (competition:CompetitionProps) => void,
|
|
13
14
|
onClose: () => void
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
const CreateCompetitionForm = ({ width, max_height, onCreate, onClose }:CreateCompetitionFormProps) => {
|
|
17
|
+
const CreateCompetitionForm = ({ competition_season, width, max_height, onCreate, onClose }:CreateCompetitionFormProps) => {
|
|
17
18
|
const [ action_loading, setActionLoading ] = useState(false);
|
|
18
19
|
const [ draft_competition, setDraftCompetition ] = useState(ManageCompetitionHelpers.getEmptyCompetition())
|
|
19
20
|
const [ form_data ,setFormData ] = useState<{
|
|
@@ -48,7 +49,9 @@ const CreateCompetitionForm = ({ width, max_height, onCreate, onClose }:CreateCo
|
|
|
48
49
|
|
|
49
50
|
const handleCreate = async(comp:CompetitionProps) => {
|
|
50
51
|
setActionLoading(true);
|
|
51
|
-
|
|
52
|
+
let company_id = comp.company_id
|
|
53
|
+
if(competition_season){ company_id = competition_season.company_id }
|
|
54
|
+
const created_competition = await ManageCompetitionApi.createCompetition(company_id, selected_company?.legacy_id, comp.competition_name, comp.template_competition_id, competition_season?.competition_season_id);
|
|
52
55
|
onCreate(created_competition)
|
|
53
56
|
setActionLoading(false)
|
|
54
57
|
}
|
|
@@ -100,6 +103,19 @@ const CreateCompetitionForm = ({ width, max_height, onCreate, onClose }:CreateCo
|
|
|
100
103
|
<Text style={{ marginTop:3 }} theme="body">Give the competition a name!</Text>
|
|
101
104
|
</View>
|
|
102
105
|
</View>
|
|
106
|
+
{competition_season ?
|
|
107
|
+
<View style={{ backgroundColor:Colors.incentive.gold_faded, flexDirection:'row', padding:10, alignItems:'center' }}>
|
|
108
|
+
<Image
|
|
109
|
+
source={{ uri: competition_season.image?.url }}
|
|
110
|
+
style={{ height:30, width:30, borderRadius:4 }}
|
|
111
|
+
resizeMode="cover"
|
|
112
|
+
/>
|
|
113
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
114
|
+
<Text theme="header_2">Season:</Text>
|
|
115
|
+
<Text style={{ marginTop:3 }} theme="header">{competition_season.season_name}</Text>
|
|
116
|
+
</View>
|
|
117
|
+
</View>
|
|
118
|
+
:<></>}
|
|
103
119
|
<ScrollView style={{ ...view_styles.section_body, maxWidth:width, backgroundColor:Colors.shades.shade100 }}>
|
|
104
120
|
<View style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth: width }}>
|
|
105
121
|
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
@@ -114,7 +130,7 @@ const CreateCompetitionForm = ({ width, max_height, onCreate, onClose }:CreateCo
|
|
|
114
130
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, competition_name:text })}
|
|
115
131
|
/>
|
|
116
132
|
</View>
|
|
117
|
-
{companies.length > 0 ?
|
|
133
|
+
{!competition_season && companies.length > 0 ?
|
|
118
134
|
<View style={{ padding:10 }}>
|
|
119
135
|
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
120
136
|
<Text theme="header">Company</Text>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { APIOverrides } from "../../ApiOverrides";
|
|
3
|
+
import type { CompanyProps, CompetitionPayoutTypeProps, CompetitionProps, CompetitionResultTypeProps, CompetitionSeasonPlayerProps, CompetitionSeasonProps, CompetitionSeasonResultProps, CompetitionTypeProps, MyPlayerProps, PlayerBalanceProps, PublicPlayerProps } from "../../types";
|
|
4
|
+
import moment from "moment-mini";
|
|
5
|
+
|
|
6
|
+
let AUTH_SVC_API = ''
|
|
7
|
+
let TP_SVC_API = ''
|
|
8
|
+
//let EVENT_SVC_API = ''
|
|
9
|
+
//let MK_SVC_API = ''
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export { SeasonApi, SeasonHelpers }
|
|
13
|
+
|
|
14
|
+
const SeasonApi = {
|
|
15
|
+
setEnvironment: () => {
|
|
16
|
+
const endpoints = APIOverrides.getEndpoints();
|
|
17
|
+
TP_SVC_API = endpoints['TP_SVC_API'] as string;
|
|
18
|
+
//EVENT_SVC_API = endpoints['EVENT_SVC_API'] as string;
|
|
19
|
+
//MK_SVC_API = endpoints['MK_SVC_API'] as string;
|
|
20
|
+
AUTH_SVC_API = endpoints['AUTH_SVC_API'] as string;
|
|
21
|
+
},
|
|
22
|
+
getPlayersByPlayerIds : async(player_ids:string[]):Promise<PublicPlayerProps[]> => {
|
|
23
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/players/bulk/get`, { player_ids })
|
|
24
|
+
return resp.data.players
|
|
25
|
+
},
|
|
26
|
+
getCompaniesByIds: async(company_ids:string[]):Promise<CompanyProps[]> => {
|
|
27
|
+
try {
|
|
28
|
+
if(company_ids.length == 0){ return [] }
|
|
29
|
+
const resp = await axios.post(`${AUTH_SVC_API}/v1/companies/bulk/get`, { company_ids })
|
|
30
|
+
return resp.data.companies
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return []
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
getMyDetails: async():Promise<MyPlayerProps> => {
|
|
36
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/me`)
|
|
37
|
+
return resp.data.player
|
|
38
|
+
},
|
|
39
|
+
getMyBalance: async():Promise<PlayerBalanceProps> => {
|
|
40
|
+
const resp = await axios.get(`${AUTH_SVC_API}/v1/players/player/balance/me`)
|
|
41
|
+
return resp.data.player_balance
|
|
42
|
+
},
|
|
43
|
+
getSeasonById: async(competition_season_id:string):Promise<CompetitionSeasonProps> => {
|
|
44
|
+
const resp = await axios.get(`${TP_SVC_API}/v2/competitions/seasons/season/${competition_season_id}`);
|
|
45
|
+
return resp.data.competition_season
|
|
46
|
+
},
|
|
47
|
+
getCompetitionsBySeasonId: async(competition_season_id:string):Promise<CompetitionProps[]> => {
|
|
48
|
+
const resp = await axios.get(`${TP_SVC_API}/v2/competitions/season/${competition_season_id}`);
|
|
49
|
+
return resp.data.competitions
|
|
50
|
+
},
|
|
51
|
+
getCompetitionOptions: async():Promise<{competition_types:CompetitionTypeProps[], competition_result_types:CompetitionResultTypeProps[], competition_payout_types:CompetitionPayoutTypeProps[]}> => {
|
|
52
|
+
const resp = await axios.get(`${TP_SVC_API}/v1/competitions/options`)
|
|
53
|
+
return resp.data
|
|
54
|
+
},
|
|
55
|
+
getSeasonPlayersBySeasonId: async(competition_season_id:string, offset:number):Promise<{ competition_season_players: CompetitionSeasonPlayerProps[], competition_season_results:CompetitionSeasonResultProps[]}> => {
|
|
56
|
+
const resp = await axios.get(`${TP_SVC_API}/v2/competitions/seasons/players/${competition_season_id}?offset=${offset}`);
|
|
57
|
+
return resp.data
|
|
58
|
+
},
|
|
59
|
+
joinSeason: async(competition_season_id:string):Promise<{ competition_season:CompetitionSeasonProps, competition_season_player:CompetitionSeasonPlayerProps, competition_season_result:CompetitionSeasonResultProps, competitions:CompetitionProps[] }> => {
|
|
60
|
+
const resp = await axios.post(`${TP_SVC_API}/v2/competitions/season/join`, { competition_season_id });
|
|
61
|
+
return resp.data
|
|
62
|
+
},
|
|
63
|
+
leaveSeason: async(competition_season_player_id:string):Promise<{ competition_season:CompetitionSeasonProps, competition_season_player:CompetitionSeasonPlayerProps, competition_season_result:CompetitionSeasonResultProps, competitions:CompetitionProps[] }> => {
|
|
64
|
+
const resp = await axios.post(`${TP_SVC_API}/v2/competitions/season/leave`, { competition_season_player_id });
|
|
65
|
+
return resp.data
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const SeasonHelpers = {
|
|
70
|
+
canJoin: (competition_season:CompetitionSeasonProps, competitions:CompetitionProps[]):boolean => {
|
|
71
|
+
if(competitions.length == 0){ console.log('non') }
|
|
72
|
+
if(competition_season.status != 'active'){ return false }
|
|
73
|
+
let started = moment().isAfter(moment(competition_season.scheduled_datetime)) ? true : false
|
|
74
|
+
if(started && !competition_season.allow_late_buy_in){ return false }
|
|
75
|
+
return true
|
|
76
|
+
},
|
|
77
|
+
getPayoutAmounts: (competition_season:CompetitionSeasonProps) => {
|
|
78
|
+
let total_payout = competition_season.ticket_revenue
|
|
79
|
+
if(competition_season.promo_amt){ total_payout = total_payout + parseFloat(competition_season.promo_amt as string) }
|
|
80
|
+
if(competition_season.guaranteed_payout && competition_season.guaranteed_payout > total_payout){ total_payout = competition_season.guaranteed_payout }
|
|
81
|
+
|
|
82
|
+
let season_payout = parseFloat(competition_season.payout_allocation as string) * total_payout
|
|
83
|
+
let competition_payout = total_payout - season_payout
|
|
84
|
+
return { season_payout, competition_payout }
|
|
85
|
+
},
|
|
86
|
+
formatPlace :(place:number) => {
|
|
87
|
+
switch(place){
|
|
88
|
+
case 1:
|
|
89
|
+
return '1st'
|
|
90
|
+
case 2:
|
|
91
|
+
return '2nd'
|
|
92
|
+
case 3:
|
|
93
|
+
return '3rd'
|
|
94
|
+
case 4:
|
|
95
|
+
return '4th'
|
|
96
|
+
case 5:
|
|
97
|
+
return '5th'
|
|
98
|
+
case 6:
|
|
99
|
+
return '6th'
|
|
100
|
+
case 7:
|
|
101
|
+
return '7th'
|
|
102
|
+
case 8:
|
|
103
|
+
return '8th'
|
|
104
|
+
case 9:
|
|
105
|
+
return '9th'
|
|
106
|
+
default:
|
|
107
|
+
return `${place}`
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { FlatList, TouchableOpacity, View } from 'react-native';
|
|
3
|
+
import type { CompanyProps, CompetitionProps, CompetitionResultTypeProps, CompetitionTypeProps, PublicPlayerProps } from "../../types"
|
|
4
|
+
import { view_styles } from '../../constants/styles';
|
|
5
|
+
import moment from 'moment-mini';
|
|
6
|
+
import CompetitionCard from '../../Engage/components/CompetitionCard';
|
|
7
|
+
import { Button, Icons, Text } from '../../Components';
|
|
8
|
+
import Colors from '../../constants/colors';
|
|
9
|
+
|
|
10
|
+
type CompetitionsSectionProps = {
|
|
11
|
+
width:number,
|
|
12
|
+
competitions:CompetitionProps[],
|
|
13
|
+
competition_result_type:CompetitionResultTypeProps,
|
|
14
|
+
competition_type:CompetitionTypeProps,
|
|
15
|
+
admin?:PublicPlayerProps,
|
|
16
|
+
company?:CompanyProps,
|
|
17
|
+
onCompetitionSelect:(c:CompetitionProps) => void
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CompetitionsSection = ({ competitions, width, admin, company, competition_result_type, competition_type, onCompetitionSelect }:CompetitionsSectionProps) => {
|
|
21
|
+
const [ expanded, setExpanded ] = useState(true);
|
|
22
|
+
const [ active_tab, setActiveTab ] = useState('active');
|
|
23
|
+
|
|
24
|
+
let filtered_competitions = [ ...competitions ]
|
|
25
|
+
if(active_tab == 'active'){ filtered_competitions = filtered_competitions.filter(c => c.status != 'closed') }
|
|
26
|
+
if(active_tab == 'closed'){ filtered_competitions = filtered_competitions.filter(c => c.status == 'closed') }
|
|
27
|
+
|
|
28
|
+
const renderCompetitions = (data: { item:CompetitionProps, index:number }) => {
|
|
29
|
+
return (
|
|
30
|
+
<View>
|
|
31
|
+
<CompetitionCard
|
|
32
|
+
competition={data.item}
|
|
33
|
+
competition_result_type={competition_result_type}
|
|
34
|
+
competition_type={competition_type}
|
|
35
|
+
company={company}
|
|
36
|
+
admin={admin}
|
|
37
|
+
onCompetitionSelect={(c) => onCompetitionSelect(c)}
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<View style={{ ...view_styles.section, maxWidth: width }}>
|
|
45
|
+
<TouchableOpacity style={{ ...view_styles.section_header }} onPress={() => setExpanded(!expanded)}>
|
|
46
|
+
<Icons.ListIcon size={12} color={Colors.brand.midnight} />
|
|
47
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
48
|
+
<Text theme='header'>Included Competitions</Text>
|
|
49
|
+
<Text style={{ marginTop:3 }}>View the list of competitions that are included in this season.</Text>
|
|
50
|
+
</View>
|
|
51
|
+
<Icons.ChevronIcon direction={expanded?'up':'down'} color={Colors.brand.midnight} size={8} />
|
|
52
|
+
</TouchableOpacity>
|
|
53
|
+
{expanded ?
|
|
54
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
55
|
+
<View style={{ ...view_styles.body_row, margin:10, backgroundColor:Colors.shades.white, borderRadius:22, borderWidth:4, borderColor:Colors.shades.shade100}}>
|
|
56
|
+
<Button
|
|
57
|
+
title='ACTIVE'
|
|
58
|
+
title_color={active_tab == 'active' ? Colors.shades.white : Colors.brand.midnight}
|
|
59
|
+
title_weight={active_tab == 'active' ? 'bold' : 'regular'}
|
|
60
|
+
padding={15}
|
|
61
|
+
title_size={12}
|
|
62
|
+
style={{flex:1}}
|
|
63
|
+
borderRadiusOverride={{
|
|
64
|
+
borderTopLeftRadius: 22,
|
|
65
|
+
borderBottomLeftRadius:22,
|
|
66
|
+
borderTopRightRadius:0,
|
|
67
|
+
borderBottomRightRadius:0
|
|
68
|
+
}}
|
|
69
|
+
backgroundColor={active_tab == 'active' ? Colors.brand.midnight : Colors.shades.white}
|
|
70
|
+
onPress={() => setActiveTab('active')}
|
|
71
|
+
/>
|
|
72
|
+
<Button
|
|
73
|
+
title='CLOSED'
|
|
74
|
+
style={{flex:1}}
|
|
75
|
+
title_size={12}
|
|
76
|
+
title_color={active_tab == 'closed' ? Colors.shades.white : Colors.brand.midnight}
|
|
77
|
+
title_weight={active_tab == 'closed' ? 'bold' : 'regular'}
|
|
78
|
+
padding={15}
|
|
79
|
+
borderRadiusOverride={{
|
|
80
|
+
borderTopLeftRadius: 0,
|
|
81
|
+
borderBottomLeftRadius:0,
|
|
82
|
+
borderTopRightRadius:22,
|
|
83
|
+
borderBottomRightRadius:22
|
|
84
|
+
}}
|
|
85
|
+
backgroundColor={active_tab == 'closed' ? Colors.brand.midnight : Colors.shades.white}
|
|
86
|
+
onPress={() => setActiveTab('closed')}
|
|
87
|
+
/>
|
|
88
|
+
</View>
|
|
89
|
+
<FlatList
|
|
90
|
+
data={filtered_competitions.sort((a,b) => moment(b.scheduled_datetime).unix() - moment(a.scheduled_datetime).unix())}
|
|
91
|
+
renderItem={renderCompetitions}
|
|
92
|
+
/>
|
|
93
|
+
</View>
|
|
94
|
+
:<></>}
|
|
95
|
+
</View>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default CompetitionsSection
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { TouchableOpacity, View } from "react-native"
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useState } from "react"
|
|
4
|
+
import type { CompetitionResultTypeProps, CompetitionSeasonProps, CompetitionTypeProps, MyPlayerProps, PlayerBalanceProps } from "../../types"
|
|
5
|
+
import Colors from "../../constants/colors"
|
|
6
|
+
import { Button, Icons, Text } from "../../Components"
|
|
7
|
+
import { view_styles } from "../../constants/styles"
|
|
8
|
+
import moment from "moment-mini"
|
|
9
|
+
import { SeasonHelpers } from "../api"
|
|
10
|
+
|
|
11
|
+
type EnterSeasonPromptProps = {
|
|
12
|
+
player?:MyPlayerProps,
|
|
13
|
+
player_balance?:PlayerBalanceProps,
|
|
14
|
+
competition_season:CompetitionSeasonProps,
|
|
15
|
+
competition_type:CompetitionTypeProps,
|
|
16
|
+
competition_result_type:CompetitionResultTypeProps,
|
|
17
|
+
width:number,
|
|
18
|
+
onVerify: () => void
|
|
19
|
+
onCancel:() => void,
|
|
20
|
+
onEnter: (promo_balance?:boolean) => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const EnterSeasonPrompt = ({ player, player_balance, competition_season, competition_type, competition_result_type, width, onCancel, onEnter, onVerify }:EnterSeasonPromptProps) => {
|
|
24
|
+
const [ use_promo_balance, setUsePromoBalance ] = useState(false)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if(!player){ return }
|
|
29
|
+
},[])
|
|
30
|
+
|
|
31
|
+
const requires_verification = player && parseInt(competition_season?.ticket_price as string ?? 0) > 0 && competition_season?.market_type == 'FOR_MONEY' && player?.vouched_status != 'verified' ? true : false
|
|
32
|
+
const cl = competition_season.market_type == 'FOR_MONEY'?'$':'E'
|
|
33
|
+
|
|
34
|
+
const { season_payout, competition_payout } = SeasonHelpers.getPayoutAmounts(competition_season)
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<View style={{ width, backgroundColor:Colors.shades.white, borderTopRightRadius:22, borderTopLeftRadius:22, paddingTop:22 }}>
|
|
38
|
+
<View nativeID="competition_info">
|
|
39
|
+
<Text size={16} color={Colors.brand.midnight} weight='bold' textAlign="center">Season Details</Text>
|
|
40
|
+
{competition_type ?
|
|
41
|
+
<View style={{ flexDirection:'row', justifyContent:'center', margin:10 }}>
|
|
42
|
+
<View style={{ padding:10, marginRight:4, backgroundColor: Colors.brand.midnight }}>
|
|
43
|
+
<Text size={12} color={Colors.shades.white} weight='semibold'>{competition_type.type_label}</Text>
|
|
44
|
+
</View>
|
|
45
|
+
<View style={{ flexDirection:'row', alignItems:'center', padding:10, marginLeft:4, backgroundColor: Colors.shades.white, borderRadius:4, ...view_styles.float }}>
|
|
46
|
+
<Text style={{ marginRight:5 }} size={12} color={Colors.brand.midnight} weight='semibold'>{competition_season.invite_only?'Private':'Public'}</Text>
|
|
47
|
+
{competition_season.invite_only ?
|
|
48
|
+
<Icons.EyeOffIcon color={Colors.brand.midnight} size={14}/>
|
|
49
|
+
:
|
|
50
|
+
<Icons.EyeOnIcon color={Colors.brand.midnight} size={14}/>
|
|
51
|
+
}
|
|
52
|
+
</View>
|
|
53
|
+
</View>
|
|
54
|
+
:<></>}
|
|
55
|
+
<Text size={14} color={Colors.brand.midnight} weight='bold' textAlign="center">{competition_season.season_name}</Text>
|
|
56
|
+
</View>
|
|
57
|
+
<View>
|
|
58
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign="center">{moment(competition_season.scheduled_datetime).format('MMM DD - hh:mm a')}</Text>
|
|
59
|
+
{competition_season.season_description ?
|
|
60
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign="center">{competition_season.season_description}</Text>
|
|
61
|
+
:<></>}
|
|
62
|
+
{competition_result_type ?
|
|
63
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign="center">{competition_result_type.label}</Text>
|
|
64
|
+
:<></>}
|
|
65
|
+
{competition_type?.type == 'pick' ?
|
|
66
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign="center">Picks: {competition_season.max_picks}</Text>
|
|
67
|
+
:<></>}
|
|
68
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign="center">Potential Season Winnings: {cl}{season_payout.toFixed(2)}</Text>
|
|
69
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign="center">Potential Competition Winnings: {cl}{competition_payout.toFixed(2)}</Text>
|
|
70
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign="center">Ticket Price: {cl}{(competition_season.ticket_price as number).toFixed(2)}</Text>
|
|
71
|
+
<Text style={{ marginTop:5 }} size={14} color={Colors.brand.midnight} weight='regular' textAlign="center">Entries: {competition_season.tickets_sold}/{competition_season.tickets_available}</Text>
|
|
72
|
+
</View>
|
|
73
|
+
<View nativeID="pick_actions" style={{ flexDirection:'row', padding:10 }}>
|
|
74
|
+
<Button
|
|
75
|
+
style={{ flex:1, marginRight:3 }}
|
|
76
|
+
borderRadius={4}
|
|
77
|
+
borderWidth={1}
|
|
78
|
+
borderColor={Colors.brand.electric}
|
|
79
|
+
padding={10}
|
|
80
|
+
title="Cancel"
|
|
81
|
+
title_color={Colors.brand.electric}
|
|
82
|
+
onPress={() => onCancel()}
|
|
83
|
+
/>
|
|
84
|
+
{requires_verification ?
|
|
85
|
+
<Button
|
|
86
|
+
borderRadius={4}
|
|
87
|
+
style={{ flex:2, marginLeft:2 }}
|
|
88
|
+
backgroundColor={Colors.utility.warning}
|
|
89
|
+
padding={10}
|
|
90
|
+
title={`Verify My Account`}
|
|
91
|
+
title_color={Colors.shades.white}
|
|
92
|
+
onPress={() => onVerify()}
|
|
93
|
+
/>
|
|
94
|
+
:
|
|
95
|
+
<Button
|
|
96
|
+
borderRadius={4}
|
|
97
|
+
style={{ flex:2, marginLeft:2 }}
|
|
98
|
+
backgroundColor={Colors.utility.success}
|
|
99
|
+
padding={10}
|
|
100
|
+
title={`Enter Season${competition_season.ticket_price == 0 ? ``:` ${cl}${competition_season.ticket_price}`}`}
|
|
101
|
+
title_color={Colors.shades.white}
|
|
102
|
+
onPress={() => {
|
|
103
|
+
if(player_balance && competition_season.market_type == 'FOR_MONEY' && player_balance.balance < parseFloat(competition_season.ticket_price as string)){ return alert('Not enough balance to enter. Please make a deposit before continuing') }
|
|
104
|
+
|
|
105
|
+
onEnter(use_promo_balance)
|
|
106
|
+
}}
|
|
107
|
+
/>
|
|
108
|
+
}
|
|
109
|
+
</View>
|
|
110
|
+
{player_balance && player_balance.promo_balance > 0 ?
|
|
111
|
+
<TouchableOpacity style={{ backgroundColor:Colors.incentive.gold, padding:10, flexDirection:'row', alignItems:'center' }} onPress={() => {
|
|
112
|
+
if(use_promo_balance){
|
|
113
|
+
//Remove promo balance and open_amt
|
|
114
|
+
setUsePromoBalance(false);
|
|
115
|
+
} else {
|
|
116
|
+
setUsePromoBalance(true);
|
|
117
|
+
}
|
|
118
|
+
}}>
|
|
119
|
+
<View style={{ marginRight:10, height:30, width:30, borderWidth:1, borderColor:Colors.brand.midnight, justifyContent:'center', alignItems:'center' }}>
|
|
120
|
+
{use_promo_balance ?
|
|
121
|
+
<View style={{ height:20, width:20, backgroundColor:Colors.brand.midnight }} />
|
|
122
|
+
:<></>}
|
|
123
|
+
</View>
|
|
124
|
+
<View>
|
|
125
|
+
<Text size={14} weight='bold' color={Colors.shades.white}>${player_balance?.promo_balance} Promotion Available</Text>
|
|
126
|
+
<Text style={{ marginTop:2}} size={12} color={Colors.shades.white} weight='regular'>Press / Click here to use promo balance</Text>
|
|
127
|
+
</View>
|
|
128
|
+
|
|
129
|
+
</TouchableOpacity>
|
|
130
|
+
:<></>}
|
|
131
|
+
</View>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export default EnterSeasonPrompt
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, TouchableOpacity ,Image } from 'react-native'
|
|
3
|
+
import Colors from '../../constants/colors';
|
|
4
|
+
import type { CompetitionProps, CompetitionSeasonPlayerProps, CompetitionSeasonProps, MyPlayerProps } from '../../types';
|
|
5
|
+
import { Button, Icons, Text } from '../../Components';
|
|
6
|
+
import { SeasonHelpers } from '../api';
|
|
7
|
+
import moment from 'moment-mini';
|
|
8
|
+
|
|
9
|
+
type SeasonHeaderProps = {
|
|
10
|
+
competition_season:CompetitionSeasonProps,
|
|
11
|
+
competitions:CompetitionProps[],
|
|
12
|
+
player?:MyPlayerProps,
|
|
13
|
+
action_loading:boolean,
|
|
14
|
+
authenticated_season_player?:CompetitionSeasonPlayerProps,
|
|
15
|
+
onShareSeason:(cs:CompetitionSeasonProps) => void,
|
|
16
|
+
onJoin:(competition_season:CompetitionSeasonProps) => void,
|
|
17
|
+
onLeave:(competition_season_player_id:string) => void
|
|
18
|
+
|
|
19
|
+
}
|
|
20
|
+
const SeasonHeader = ({ action_loading, authenticated_season_player, competition_season, competitions, onShareSeason, onJoin, onLeave }:SeasonHeaderProps) => {
|
|
21
|
+
|
|
22
|
+
const can_join = SeasonHelpers.canJoin(competition_season, competitions);
|
|
23
|
+
const can_leave = true;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View style={{ backgroundColor:Colors.shades.white }}>
|
|
27
|
+
<View nativeID="competition_header" style={{ flexDirection:'row', alignItems:'center', padding:20, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
28
|
+
<View>
|
|
29
|
+
<Image
|
|
30
|
+
source={{ uri: competition_season.image?.url ?? 'https://res.cloudinary.com/hoabts6mc/image/upload/v1649737862/be_logo_jte2ux.webp' }}
|
|
31
|
+
style={{ height:50, width:50, borderRadius:4 }}
|
|
32
|
+
resizeMode="cover"
|
|
33
|
+
/>
|
|
34
|
+
</View>
|
|
35
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
36
|
+
<Text theme='header'>{competition_season.season_name}</Text>
|
|
37
|
+
<Text style={{ marginTop:4 }} theme='header_2>'>{competition_season.season_description}</Text>
|
|
38
|
+
</View>
|
|
39
|
+
<TouchableOpacity style={{ paddingLeft:10 }} onPress={() => onShareSeason(competition_season)}>
|
|
40
|
+
<Icons.ShareIcon color={Colors.brand.midnight} size={14} />
|
|
41
|
+
</TouchableOpacity>
|
|
42
|
+
</View>
|
|
43
|
+
|
|
44
|
+
<View style={{ flexDirection:'row', padding:10, backgroundColor:Colors.shades.shade100 }}>
|
|
45
|
+
<View style={{ flex:1 }}>
|
|
46
|
+
<Text size={12} color={Colors.brand.midnight} weight='regular'>{competition_season.status == 'closed' ? 'COMPLETED' : competition_season.status == 'pending' ? 'UNDER CONSTRUCTION': can_join ? 'JOIN' : 'IN PROGRESS'}</Text>
|
|
47
|
+
{competition_season.status == 'pending' ?
|
|
48
|
+
<Text style={{ marginTop:5 }} size={12} color={Colors.brand.midnight} weight='bold'>The admin is still working on this season</Text>
|
|
49
|
+
: can_join ?
|
|
50
|
+
<Text style={{ marginTop:5 }} size={12} color={Colors.brand.midnight} weight='bold'>{competition_season.allow_late_buy_in ? 'anytime during the season' : `until ${moment(competition_season.scheduled_datetime).format('MMM DD hh:mm a')}`}</Text>
|
|
51
|
+
:
|
|
52
|
+
<Text style={{ marginTop:5 }} size={12} color={Colors.brand.midnight} weight='bold'>{moment(competition_season.scheduled_datetime).format('MMM DD hh:mm a')}</Text>
|
|
53
|
+
}
|
|
54
|
+
</View>
|
|
55
|
+
{!authenticated_season_player ?
|
|
56
|
+
<Button
|
|
57
|
+
title='JOIN'
|
|
58
|
+
disabled={action_loading}
|
|
59
|
+
style={{ opacity: action_loading ? 0.5 : 1 }}
|
|
60
|
+
loading={action_loading}
|
|
61
|
+
title_color={Colors.shades.white}
|
|
62
|
+
backgroundColor={Colors.utility.success}
|
|
63
|
+
onPress={() => onJoin(competition_season)}
|
|
64
|
+
/>
|
|
65
|
+
:
|
|
66
|
+
<Button
|
|
67
|
+
title='LEAVE'
|
|
68
|
+
backgroundColor={Colors.utility.error}
|
|
69
|
+
loading={action_loading}
|
|
70
|
+
title_color={Colors.shades.white}
|
|
71
|
+
style={{ opacity: can_leave && !action_loading ? 1: 0.5 }}
|
|
72
|
+
disabled={!can_leave || action_loading}
|
|
73
|
+
onPress={() => onLeave(authenticated_season_player.competition_season_player_id)}
|
|
74
|
+
/>
|
|
75
|
+
}
|
|
76
|
+
</View>
|
|
77
|
+
</View>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default SeasonHeader
|