be-components 1.4.9 → 1.5.1
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/api/index.js +25 -0
- package/lib/commonjs/Engage/api/index.js.map +1 -1
- package/lib/commonjs/Engage/components/SeasonCard.js +78 -0
- package/lib/commonjs/Engage/components/SeasonCard.js.map +1 -0
- package/lib/commonjs/Engage/index.js +52 -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/api/index.js +25 -0
- package/lib/module/Engage/api/index.js.map +1 -1
- package/lib/module/Engage/components/SeasonCard.js +71 -0
- package/lib/module/Engage/components/SeasonCard.js.map +1 -0
- package/lib/module/Engage/index.js +52 -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/api/index.d.ts +6 -1
- package/lib/typescript/src/Engage/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Engage/components/SeasonCard.d.ts +10 -0
- package/lib/typescript/src/Engage/components/SeasonCard.d.ts.map +1 -0
- package/lib/typescript/src/Engage/index.d.ts +3 -2
- 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/api/index.ts +21 -2
- package/src/Engage/components/SeasonCard.tsx +42 -0
- package/src/Engage/index.tsx +44 -7
- 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
|
@@ -31,7 +31,7 @@ const CompetitionSeasonCard = ({ competition_season, competition_result_type, on
|
|
|
31
31
|
<View nativeID="comp_amounts" style={{ flexDirection:'row', padding:5 }}>
|
|
32
32
|
<View style={{ flex:1, flexDirection:'row' }}>
|
|
33
33
|
<View style={{ backgroundColor:comp_colors.backgroundColor, borderWidth:1, borderColor:comp_colors.borderColor, borderRadius:8, padding:5 }}>
|
|
34
|
-
<Text size={10} color={comp_colors.borderColor} weight='semibold'>{competition_season.payout_allocation*100}%</Text>
|
|
34
|
+
<Text size={10} color={comp_colors.borderColor} weight='semibold'>{parseFloat(competition_season.payout_allocation as string) * 100}%</Text>
|
|
35
35
|
</View>
|
|
36
36
|
{competition_result_type ?
|
|
37
37
|
<View style={{ marginLeft: 5, backgroundColor:comp_colors.backgroundColor, borderWidth:1, borderColor:comp_colors.borderColor, borderRadius:8, padding:5 }}>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, View } from 'react-native';
|
|
3
|
+
import type { CompetitionPlayerProps, CompetitionSeasonProps } from "../../types"
|
|
4
|
+
import { Button, Text } from '../../Components';
|
|
5
|
+
import Colors from '../../constants/colors';
|
|
6
|
+
import moment from 'moment-mini';
|
|
7
|
+
|
|
8
|
+
type SeasonCardProps = {
|
|
9
|
+
competition_season:CompetitionSeasonProps,
|
|
10
|
+
authenticated_competition_player?:CompetitionPlayerProps,
|
|
11
|
+
onViewSeason: (competition_season:CompetitionSeasonProps) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const SeasonCard = ({ competition_season, authenticated_competition_player, onViewSeason }:SeasonCardProps) => {
|
|
15
|
+
const can_join = moment().isBefore(moment(competition_season.scheduled_datetime)) ? true : false
|
|
16
|
+
return (
|
|
17
|
+
<View style={{ flexDirection:'row', alignItems:'center', padding:10, backgroundColor:Colors.brand.mint }}>
|
|
18
|
+
<Image
|
|
19
|
+
source={{ uri:competition_season.image?.url }}
|
|
20
|
+
style={{ height:50, width:50, borderRadius:4 }}
|
|
21
|
+
resizeMode='cover'
|
|
22
|
+
/>
|
|
23
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
24
|
+
<Text theme='header'>Season</Text>
|
|
25
|
+
<Text style={{ marginTop:3 }} theme='header_2'>{competition_season.season_name}</Text>
|
|
26
|
+
</View>
|
|
27
|
+
{!authenticated_competition_player && can_join ?
|
|
28
|
+
<Button
|
|
29
|
+
title='JOIN'
|
|
30
|
+
backgroundColor={Colors.utility.success}
|
|
31
|
+
title_color={Colors.shades.white}
|
|
32
|
+
onPress={() => onViewSeason(competition_season)}
|
|
33
|
+
/>
|
|
34
|
+
:
|
|
35
|
+
<Button
|
|
36
|
+
title='VIEW'
|
|
37
|
+
backgroundColor={Colors.brand.electric}
|
|
38
|
+
title_color={Colors.shades.white}
|
|
39
|
+
onPress={() => onViewSeason(competition_season)}
|
|
40
|
+
/>
|
|
41
|
+
}
|
|
42
|
+
</View>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default SeasonCard
|
|
@@ -14,6 +14,7 @@ import EnterCompetitionPrompt from './components/EnterCompetitionPrompt';
|
|
|
14
14
|
import moment from 'moment-mini';
|
|
15
15
|
import LeaderPicks from './components/LeaderPicks';
|
|
16
16
|
import NavOutPrompt from './components/NavOutPrompt';
|
|
17
|
+
import SeasonCard from './components/SeasonCard';
|
|
17
18
|
|
|
18
19
|
type CompetitionModuleProps = {
|
|
19
20
|
player_id?:string,
|
|
@@ -22,10 +23,11 @@ type CompetitionModuleProps = {
|
|
|
22
23
|
onEvent?:(event:BEEventProps) => void,
|
|
23
24
|
onManageCompetition:(competition_id:string) => void,
|
|
24
25
|
onRequestAuthentication:(auth_strategy_id?:string) => void,
|
|
25
|
-
onShareCompetition:(competition:CompetitionProps) => void
|
|
26
|
+
onShareCompetition:(competition:CompetitionProps) => void,
|
|
27
|
+
onViewCompetitionSeason:(cs:CompetitionSeasonProps) => void
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
const CompetitionModule = ({ competition_id, player_id, onManageCompetition, onRequestAuthentication, onShareCompetition, onClose }:CompetitionModuleProps) => {
|
|
30
|
+
const CompetitionModule = ({ competition_id, player_id, onManageCompetition, onRequestAuthentication, onShareCompetition, onClose, onViewCompetitionSeason }:CompetitionModuleProps) => {
|
|
29
31
|
const [ viewing_leader, setViewingLeader ] = useState<PublicPlayerProps|undefined>();
|
|
30
32
|
const [ show_full_leaderboard, setShowFullLeaderboard ] = useState(false);
|
|
31
33
|
const [ module_size, setModuleSize ] = useState({ width:0, height:0 });
|
|
@@ -111,6 +113,7 @@ const CompetitionModule = ({ competition_id, player_id, onManageCompetition, onR
|
|
|
111
113
|
leagues,
|
|
112
114
|
markets,
|
|
113
115
|
events,
|
|
116
|
+
competition_season,
|
|
114
117
|
athletes,
|
|
115
118
|
teams,
|
|
116
119
|
tournaments,
|
|
@@ -198,10 +201,14 @@ const CompetitionModule = ({ competition_id, player_id, onManageCompetition, onR
|
|
|
198
201
|
if(athlete_ids.length > 0){ athletes = await CompetitionMatchApi.getAthletesByIds(athlete_ids) }
|
|
199
202
|
if(team_ids.length > 0){ teams = await CompetitionMatchApi.getTeamsByIds(team_ids) }
|
|
200
203
|
const cps = await CompetitionPlayerApi.getCompetitionPlayersByCompetition(competition_id, 0, 'active')
|
|
201
|
-
const c = await CompetitionApi.getCompetitionById(competition_id)
|
|
204
|
+
const c = await CompetitionApi.getCompetitionById(competition_id);
|
|
205
|
+
let comp_season:CompetitionSeasonProps | undefined = undefined
|
|
206
|
+
if(c.competition_season_id){ comp_season = await CompetitionApi.getSeasonById(c.competition_season_id) }
|
|
207
|
+
|
|
202
208
|
setCompetitionData({
|
|
203
209
|
loaded:true,
|
|
204
210
|
competition: c,
|
|
211
|
+
competition_season: comp_season,
|
|
205
212
|
competition_matches: cms_response.competition_matches,
|
|
206
213
|
competition_match_markets: cms_response.competition_match_markets,
|
|
207
214
|
events,
|
|
@@ -341,7 +348,13 @@ const CompetitionModule = ({ competition_id, player_id, onManageCompetition, onR
|
|
|
341
348
|
<Icons.ShareIcon color={Colors.brand.midnight} size={14} />
|
|
342
349
|
</TouchableOpacity>
|
|
343
350
|
</View>
|
|
344
|
-
|
|
351
|
+
{competition_season ?
|
|
352
|
+
<SeasonCard
|
|
353
|
+
competition_season={competition_season}
|
|
354
|
+
authenticated_competition_player={authenticated_competition_player}
|
|
355
|
+
onViewSeason={(cs) => onViewCompetitionSeason(cs)}
|
|
356
|
+
/>
|
|
357
|
+
:
|
|
345
358
|
<View style={{ flexDirection:'row', padding:10, backgroundColor:Colors.shades.shade100 }}>
|
|
346
359
|
<View style={{ flex:1 }}>
|
|
347
360
|
<Text size={12} color={Colors.brand.midnight} weight='regular'>{competition.status == 'closed' ? 'COMPLETED' : in_progress ? 'IN PROGRESS' : 'JOIN UNTIL'}</Text>
|
|
@@ -351,30 +364,35 @@ const CompetitionModule = ({ competition_id, player_id, onManageCompetition, onR
|
|
|
351
364
|
<Text style={{ marginTop:5 }} size={12} color={Colors.brand.midnight} weight='bold'>{moment(competition.scheduled_datetime).format('MMM DD hh:mm a')}</Text>
|
|
352
365
|
}
|
|
353
366
|
</View>
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
367
|
+
{!authenticated_competition_player ?
|
|
368
|
+
<Button
|
|
369
|
+
style={{ flex:1, opacity: can_join ? 1: 0.5 }}
|
|
370
|
+
disabled={!can_join}
|
|
371
|
+
loading={loading}
|
|
372
|
+
title={`JOIN`}
|
|
373
|
+
title_color={Colors.shades.white}
|
|
374
|
+
backgroundColor={Colors.utility.success}
|
|
375
|
+
onPress={() => {
|
|
376
|
+
if(competition.competition_season_id){ return alert('Please select the season to join!') }
|
|
377
|
+
setShowEnterPrompt(true)
|
|
378
|
+
}}
|
|
379
|
+
/>
|
|
380
|
+
: competition.status != 'closed' ?
|
|
381
|
+
<Button
|
|
382
|
+
style={{ flex:1, opacity: can_leave ? 1: 0.5 }}
|
|
383
|
+
title='LEAVE'
|
|
384
|
+
loading={loading}
|
|
385
|
+
title_color={Colors.shades.white}
|
|
386
|
+
backgroundColor={Colors.utility.error}
|
|
387
|
+
onPress={() => {
|
|
388
|
+
if(competition.competition_season_id){ return alert('You can only leave via the season') }
|
|
389
|
+
if(!can_leave){ return alert('Please remove all picks and try again') }
|
|
390
|
+
handleLeaveCompetition()
|
|
391
|
+
}}
|
|
392
|
+
/>
|
|
393
|
+
:<></>}
|
|
377
394
|
</View>
|
|
395
|
+
}
|
|
378
396
|
</View>
|
|
379
397
|
<CompetitionInfoCard
|
|
380
398
|
competition={competition}
|
|
@@ -26,9 +26,7 @@ const ManageCompetitionApi = {
|
|
|
26
26
|
return resp.data.players
|
|
27
27
|
},
|
|
28
28
|
getMyAdminCompetition:async(offset:number, status?:'active'|'closed'):Promise<CompetitionProps[]> => {
|
|
29
|
-
console.log(status)
|
|
30
29
|
const resp = await axios.get(`${TP_SVC_API}/v2/competitions/admin?offset=${offset}&status=${status}`)
|
|
31
|
-
console.log(resp.data.competitions)
|
|
32
30
|
return resp.data.competitions
|
|
33
31
|
},
|
|
34
32
|
getLeagues: async():Promise<LeagueProps[]> => {
|
|
@@ -95,11 +93,10 @@ const ManageCompetitionApi = {
|
|
|
95
93
|
},
|
|
96
94
|
getTemplateCompetitions: async():Promise<CompetitionProps[]> => {
|
|
97
95
|
const resp = await axios.get(`${TP_SVC_API}/v2/competitions/templates`)
|
|
98
|
-
console.log(resp.data)
|
|
99
96
|
return resp.data.competitions
|
|
100
97
|
},
|
|
101
|
-
createCompetition: async(company_id?:string, sponsor_id?:string, competition_name?:string, template_competition_id?:string):Promise<CompetitionProps> => {
|
|
102
|
-
const resp = await axios.post(`${TP_SVC_API}/v2/competitions/competition/create`, { company_id, sponsor_id, competition_name, template_competition_id })
|
|
98
|
+
createCompetition: async(company_id?:string, sponsor_id?:string, competition_name?:string, template_competition_id?:string, competition_season_id?:string):Promise<CompetitionProps> => {
|
|
99
|
+
const resp = await axios.post(`${TP_SVC_API}/v2/competitions/competition/create`, { company_id, sponsor_id, competition_name, template_competition_id, competition_season_id })
|
|
103
100
|
return resp.data.competition
|
|
104
101
|
},
|
|
105
102
|
updateCompetition: async(competition:CompetitionProps):Promise<CompetitionProps> => {
|
|
@@ -105,6 +105,7 @@ const CompetitionInfoForm = ({ is_valid, player, competition, width, onCompetiti
|
|
|
105
105
|
<Text style={{ marginTop:3 }} theme='body'>Only access this competition using an invite code.</Text>
|
|
106
106
|
</View>
|
|
107
107
|
<Switch
|
|
108
|
+
disabled={competition.competition_season_id ? true : false}
|
|
108
109
|
value={competition.invite_only}
|
|
109
110
|
switch_type="on_off"
|
|
110
111
|
onChange={(value) => onCompetitionUpdate({ ...draft_competition, invite_only: value })}
|
|
@@ -117,6 +118,7 @@ const CompetitionInfoForm = ({ is_valid, player, competition, width, onCompetiti
|
|
|
117
118
|
<Text style={{ marginTop:3 }} theme='body'>This will allow for other users to copy this competition and create it for themselves.</Text>
|
|
118
119
|
</View>
|
|
119
120
|
<Switch
|
|
121
|
+
|
|
120
122
|
value={competition.template ? true : false}
|
|
121
123
|
switch_type="on_off"
|
|
122
124
|
onChange={(value) => onCompetitionUpdate({ ...draft_competition, template: value })}
|
|
@@ -131,67 +133,3 @@ const CompetitionInfoForm = ({ is_valid, player, competition, width, onCompetiti
|
|
|
131
133
|
|
|
132
134
|
export default CompetitionInfoForm
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
/*
|
|
136
|
-
{competition.prize_override || competition.prize_override == '' ?
|
|
137
|
-
<View nativeID="competition_info" style={{ margin:10, flex:4, flexGrow:4, minWidth:300, padding:10, borderRadius:4, marginRight:5, ...styles.float }}>
|
|
138
|
-
<View nativeID="header_row" style={{ flexDirection:'row', alignItems:'center', padding:5, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}>
|
|
139
|
-
<Text style={{ flex:1, marginRight:10 }} size={22} color={Colors.brand.slate} weight='bold'>Competition Prize Details</Text>
|
|
140
|
-
</View>
|
|
141
|
-
<View nativeID="competition_prize" style={{ flexDirection:'row', flexWrap:'wrap', alignItems:'center', padding:10 }}>
|
|
142
|
-
<View nativeID="prize_image">
|
|
143
|
-
<View style={{ flex:1, justifyContent:'center', alignItems:'center' }}>
|
|
144
|
-
{competition.prize_image?.url ?
|
|
145
|
-
<Image
|
|
146
|
-
source={{ uri : competition.prize_image.url }}
|
|
147
|
-
style={{ height: 100, width:100 }}
|
|
148
|
-
resizeMode="center"
|
|
149
|
-
/>
|
|
150
|
-
:
|
|
151
|
-
<Text>NO IMAGE!!</Text>
|
|
152
|
-
}
|
|
153
|
-
</View>
|
|
154
|
-
<ImageUploader
|
|
155
|
-
public_id={`comp_prize_${competition.competition_id}_image_${Math.random()}`}
|
|
156
|
-
label="Change Image"
|
|
157
|
-
onFinishUpload={(obj) => onCompetitionUpdate({ ...competition, prize_image: { ...obj, url: obj.secure_url } })}
|
|
158
|
-
/>
|
|
159
|
-
</View>
|
|
160
|
-
<View style={{ flex:1, minWidth:200 }}>
|
|
161
|
-
<View style={{ margin:5 }}>
|
|
162
|
-
<Text size={16} color={Colors.brand.midnight} weight='bold'>Prize Override</Text>
|
|
163
|
-
<Text size={14} color={Colors.brand.midnight} weight='regular'>Add details for the prize that will be delivered</Text>
|
|
164
|
-
</View>
|
|
165
|
-
<TextInput
|
|
166
|
-
style={{ minWidth:300, margin:5, padding:10, borderRadius:8,borderWidth:1, borderColor:Colors.shades.shade600 }}
|
|
167
|
-
onChangeText={(text) => onCompetitionUpdate({ ...competition, prize_override:text })}
|
|
168
|
-
value={competition.prize_override}
|
|
169
|
-
placeholder="Add a league name"
|
|
170
|
-
placeholderTextColor={Colors.brand.slate}
|
|
171
|
-
/>
|
|
172
|
-
</View>
|
|
173
|
-
</View>
|
|
174
|
-
</View>
|
|
175
|
-
:<></>}
|
|
176
|
-
*/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
/*
|
|
180
|
-
<View style={{ ...view_styles.body_row, flexWrap:'wrap' }}>
|
|
181
|
-
<View style={{ flex:1, margin:5, minWidth:250 }}>
|
|
182
|
-
<Text theme='header_2'>Authenticate Strategy</Text>
|
|
183
|
-
<Text style={{ marginTop:3 }} theme='body'>What data would you like to collect in order to participate in this competition?</Text>
|
|
184
|
-
</View>
|
|
185
|
-
<DropDown
|
|
186
|
-
dropdown_options={[
|
|
187
|
-
{value: 'Strategy', eligible_options: auth_strategies.map(as => as.name)}
|
|
188
|
-
]}
|
|
189
|
-
selected_value={selected_strategy}
|
|
190
|
-
onOptionSelect={(option) => {
|
|
191
|
-
let strategy = auth_strategies.find(as => as.name == option)
|
|
192
|
-
if(competition.status != 'pending'){ return alert('Auth strategy cannot be changed after competition is activated') }
|
|
193
|
-
onCompetitionUpdate({ ...competition, auth_strategy_id: strategy.auth_strategy_id })
|
|
194
|
-
}}
|
|
195
|
-
/>
|
|
196
|
-
</View>
|
|
197
|
-
*/
|
|
@@ -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
|