be-components 1.4.9 → 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.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.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 +1 -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
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { TouchableOpacity, View, FlatList } from 'react-native';
|
|
3
|
+
import { view_styles } from '../../constants/styles';
|
|
4
|
+
import { Button, Icons, Switch, Text, TextInput } from '../../Components';
|
|
5
|
+
import Colors from '../../constants/colors';
|
|
6
|
+
import type { CompetitionResultTypeProps, CompetitionSeasonProps, CompetitionTypeProps } from '../../types';
|
|
7
|
+
import { ManageSeasonHelpers } from '../api';
|
|
8
|
+
import DropDown from '../../Components/Dropdown';
|
|
9
|
+
|
|
10
|
+
type SeasonSettingsFormProps = {
|
|
11
|
+
width:number,
|
|
12
|
+
competition_season:CompetitionSeasonProps,
|
|
13
|
+
competition_types:CompetitionTypeProps[],
|
|
14
|
+
competition_result_types:CompetitionResultTypeProps[],
|
|
15
|
+
onSeasonUpdate: (cs:CompetitionSeasonProps) => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const SeasonSettingsForm = ({ competition_season, width, competition_types, competition_result_types, onSeasonUpdate }:SeasonSettingsFormProps) => {
|
|
19
|
+
const [ expanded, setExpanded ] = useState(false);
|
|
20
|
+
const [ draft_season, setDraftSeason ] = useState<CompetitionSeasonProps>();
|
|
21
|
+
|
|
22
|
+
const competition_type = competition_types.find(ct => ct.competition_type_id == draft_season?.competition_type_id);
|
|
23
|
+
const competition_result_type = competition_result_types.find(crt => crt.competition_result_type_id == draft_season?.competition_result_type_id);
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setDraftSeason(competition_season)
|
|
27
|
+
},[competition_season])
|
|
28
|
+
|
|
29
|
+
if(!draft_season){ return <></> }
|
|
30
|
+
|
|
31
|
+
const renderCompetitionTypes = (data:{ item:CompetitionTypeProps, index:number }) => {
|
|
32
|
+
if(!draft_season) { return <></> }
|
|
33
|
+
const selected = data.item.competition_type_id == draft_season.competition_type_id ? true : false
|
|
34
|
+
return (
|
|
35
|
+
<TouchableOpacity style={{ minWidth:75, margin:1, borderRadius:8, padding:10, backgroundColor:selected?Colors.brand.midnight:undefined }} onPress={() => onSeasonUpdate({ ...draft_season, competition_type_id: data.item.competition_type_id })}>
|
|
36
|
+
<Text textAlign="center" color={selected?Colors.shades.white:Colors.brand.midnight} weight={selected?'bold':'regular'} size={14}>{data.item.type_label}</Text>
|
|
37
|
+
</TouchableOpacity>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const is_changed = ManageSeasonHelpers.isSettingsChanged(competition_season, draft_season);
|
|
42
|
+
const is_valid = ManageSeasonHelpers.isSettingsValid(draft_season);
|
|
43
|
+
return (
|
|
44
|
+
<View style={{ ...view_styles.section }}>
|
|
45
|
+
<TouchableOpacity style={{ ...view_styles.section_header }} onPress={() => setExpanded(!expanded)}>
|
|
46
|
+
<View style={{ flex:1 }}>
|
|
47
|
+
<Text theme='header'>Season Settings</Text>
|
|
48
|
+
<Text style={{ marginTop:3 }}>Update season settings</Text>
|
|
49
|
+
</View>
|
|
50
|
+
{is_changed ?
|
|
51
|
+
<Button
|
|
52
|
+
title='SAVE'
|
|
53
|
+
padding={10}
|
|
54
|
+
style={{ opacity: is_valid ? 1 : 0.5 }}
|
|
55
|
+
disabled={!is_valid}
|
|
56
|
+
title_color={Colors.shades.white}
|
|
57
|
+
backgroundColor={Colors.utility.success}
|
|
58
|
+
onPress={() => onSeasonUpdate(draft_season)}
|
|
59
|
+
/>
|
|
60
|
+
:
|
|
61
|
+
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.brand.midnight} size={8} />
|
|
62
|
+
}
|
|
63
|
+
</TouchableOpacity>
|
|
64
|
+
{expanded ?
|
|
65
|
+
<View style={{ ...view_styles.section_body }}>
|
|
66
|
+
<View style={{ ...view_styles.body_row, maxWidth:width, borderBottomWidth:1, marginTop:10, borderColor:Colors.shades.shade600 }}>
|
|
67
|
+
<View style={{ flex:1 }}>
|
|
68
|
+
<Text theme="header_2">Ticket Price</Text>
|
|
69
|
+
<Text style={{ marginTop:3 }}>How much does it cost to enter this season?</Text>
|
|
70
|
+
</View>
|
|
71
|
+
<TextInput
|
|
72
|
+
style={{ ...view_styles.input, width:75, textAlign:'center' }}
|
|
73
|
+
onChangeText={(text) => setDraftSeason({ ...draft_season, ticket_price: text })}
|
|
74
|
+
placeholder="0"
|
|
75
|
+
value={draft_season.ticket_price as string}
|
|
76
|
+
placeholderTextColor={Colors.brand.slate}
|
|
77
|
+
/>
|
|
78
|
+
</View>
|
|
79
|
+
<View style={{ ...view_styles.body_row, maxWidth:width, borderBottomWidth:1, marginTop:10, borderColor:Colors.shades.shade600 }}>
|
|
80
|
+
<View style={{ flex:1 }}>
|
|
81
|
+
<Text theme="header_2">Season Payout Allocation</Text>
|
|
82
|
+
<Text style={{ marginTop:3 }}>How much of the total pot should be allocated to the season winners? Remaining is paid out each competition.</Text>
|
|
83
|
+
</View>
|
|
84
|
+
<TextInput
|
|
85
|
+
style={{ ...view_styles.input, width:75, textAlign:'center' }}
|
|
86
|
+
onChangeText={(text) => setDraftSeason({ ...draft_season, payout_allocation: text })}
|
|
87
|
+
placeholder="0"
|
|
88
|
+
value={draft_season.payout_allocation as string}
|
|
89
|
+
placeholderTextColor={Colors.brand.slate}
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
<View nativeID="competition_type" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
93
|
+
<View style={{ flex:1 }}>
|
|
94
|
+
<Text theme="header_2">Competition Type</Text>
|
|
95
|
+
<Text style={{ marginTop:3 }} theme="body">{competition_type?competition_type.description:'Choose the type of competition this is.'}</Text>
|
|
96
|
+
</View>
|
|
97
|
+
<View style={{ margin:5, borderRadius:8, backgroundColor:Colors.shades.white }}>
|
|
98
|
+
<FlatList
|
|
99
|
+
data={competition_types}
|
|
100
|
+
renderItem={renderCompetitionTypes}
|
|
101
|
+
keyExtractor={(item) => item.competition_type_id.toString()}
|
|
102
|
+
horizontal
|
|
103
|
+
/>
|
|
104
|
+
</View>
|
|
105
|
+
</View>
|
|
106
|
+
{competition_type?.type == 'pick' ?
|
|
107
|
+
<View style={{ ...view_styles.body_row, maxWidth:width, marginTop:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
108
|
+
<View style={{ flex:1 }}>
|
|
109
|
+
<Text theme="header_2">Max Picks</Text>
|
|
110
|
+
<Text style={{ marginTop:3 }}>The total number of picks allowed by each participant.</Text>
|
|
111
|
+
</View>
|
|
112
|
+
<TextInput
|
|
113
|
+
style={{ ...view_styles.input, width:75, textAlign:'center' }}
|
|
114
|
+
onChangeText={(text) => setDraftSeason({ ...draft_season, max_picks: text })}
|
|
115
|
+
placeholder="0"
|
|
116
|
+
value={draft_season.max_picks as string}
|
|
117
|
+
placeholderTextColor={Colors.brand.slate}
|
|
118
|
+
/>
|
|
119
|
+
</View>
|
|
120
|
+
:<></>}
|
|
121
|
+
{competition_type?.type == 'wager' ?
|
|
122
|
+
<View style={{ ...view_styles.body_row, maxWidth:width, borderBottomWidth:1, marginTop:10, borderColor:Colors.shades.shade600 }}>
|
|
123
|
+
<View style={{ flex:1 }}>
|
|
124
|
+
<Text theme="header_2">Initial Balance</Text>
|
|
125
|
+
<Text style={{ marginTop:3 }}>Initial balance that each player will start with at the beginning of the competition.</Text>
|
|
126
|
+
</View>
|
|
127
|
+
<TextInput
|
|
128
|
+
style={{ ...view_styles.input, width:75, textAlign:'center' }}
|
|
129
|
+
onChangeText={(text) => setDraftSeason({ ...draft_season, initial_balance: text })}
|
|
130
|
+
placeholder="0"
|
|
131
|
+
value={draft_season.initial_balance as string}
|
|
132
|
+
placeholderTextColor={Colors.brand.slate}
|
|
133
|
+
/>
|
|
134
|
+
</View>
|
|
135
|
+
:<></>}
|
|
136
|
+
{competition_type?.type == 'wager' ?
|
|
137
|
+
<View style={{ ...view_styles.body_row, maxWidth:width, borderBottomWidth:1, marginTop:10, borderColor:Colors.shades.shade600 }}>
|
|
138
|
+
<View style={{ flex:1 }}>
|
|
139
|
+
<Text theme="header_2">Rollover Balance</Text>
|
|
140
|
+
<Text style={{ marginTop:3 }}>Should the wager balance for each player rollover from prior competitions?</Text>
|
|
141
|
+
</View>
|
|
142
|
+
<Switch
|
|
143
|
+
value={draft_season.balance_rollover}
|
|
144
|
+
switch_type="on_off"
|
|
145
|
+
onChange={(value) => onSeasonUpdate({ ...draft_season, balance_rollover: value })}
|
|
146
|
+
/>
|
|
147
|
+
</View>
|
|
148
|
+
:<></>}
|
|
149
|
+
<View nativeID="competition_payout" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width}}>
|
|
150
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
151
|
+
<Text theme="header_2">Competition Payout Type</Text>
|
|
152
|
+
<Text style={{ marginTop:3 }} theme="body">{competition_result_type?competition_result_type.description:'Choose the type of payout for this competition'}</Text>
|
|
153
|
+
</View>
|
|
154
|
+
<View style={{ justifyContent:'flex-end', margin:5, borderRadius:8, backgroundColor:Colors.shades.white }}>
|
|
155
|
+
<DropDown
|
|
156
|
+
dropdown_options={[
|
|
157
|
+
{value: 'competition_result_type_id', eligible_options: competition_result_types.filter(crt => crt.type != 'outpace').map(t => t.label)}
|
|
158
|
+
]}
|
|
159
|
+
selected_value={competition_result_type?.label ?? ''}
|
|
160
|
+
onOptionSelect={(type) => {
|
|
161
|
+
const new_result_type = competition_result_types.find(crt => crt.label == type);
|
|
162
|
+
if(!new_result_type){ return }
|
|
163
|
+
onSeasonUpdate({ ...draft_season, competition_result_type_id: new_result_type.competition_result_type_id })
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
</View>
|
|
167
|
+
</View>
|
|
168
|
+
<View nativeID="invite_only" style={{ ...view_styles.body_row, flexWrap:'wrap', marginTop:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
169
|
+
<View style={{ flex:1, margin:5, marginRight:15 }}>
|
|
170
|
+
<Text theme='header_2'>Allow Late Buy In</Text>
|
|
171
|
+
<Text style={{ marginTop:3 }} theme='body'>Determines if a player can join the season after it has started.</Text>
|
|
172
|
+
</View>
|
|
173
|
+
<Switch
|
|
174
|
+
value={draft_season.allow_late_buy_in}
|
|
175
|
+
switch_type="on_off"
|
|
176
|
+
onChange={(value) => onSeasonUpdate({ ...draft_season, allow_late_buy_in: value })}
|
|
177
|
+
/>
|
|
178
|
+
</View>
|
|
179
|
+
</View>
|
|
180
|
+
:<></>}
|
|
181
|
+
</View>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export default SeasonSettingsForm
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, ScrollView, ActivityIndicator } from 'react-native';
|
|
3
|
+
import SeasonInfoForm from './components/SeasonInfoForm';
|
|
4
|
+
import { ManageSeasonApi, ManageSeasonHelpers } from './api';
|
|
5
|
+
import type { CompetitionPayoutTypeProps, CompetitionProps, CompetitionResultTypeProps, CompetitionSeasonProps, CompetitionTypeProps, MyPlayerProps } from '../types';
|
|
6
|
+
import Colors from '../constants/colors';
|
|
7
|
+
import CompetitionsForm from './components/CompetitionsForm';
|
|
8
|
+
import SeasonSettingsForm from './components/SeasonSettingsForm';
|
|
9
|
+
import CreateCompetitionForm from '../CompetitionManager/components/CreateCompetitionForm';
|
|
10
|
+
import SeasonHeader from './components/SeasonHeader';
|
|
11
|
+
|
|
12
|
+
type SeasonManagerProps = {
|
|
13
|
+
competition_season_id:string,
|
|
14
|
+
player_id?:string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const SeasonManager = ({ competition_season_id }:SeasonManagerProps) => {
|
|
18
|
+
const [ show_create_competition, setShowCreateCompetition ] = useState(false);
|
|
19
|
+
const [ module_size, setModuleSize ] = useState({ width: 0, height: 0 });
|
|
20
|
+
const [ season_data, setData ] = useState<{
|
|
21
|
+
loading: boolean,
|
|
22
|
+
action_loading:boolean,
|
|
23
|
+
player?:MyPlayerProps,
|
|
24
|
+
competition_season?:CompetitionSeasonProps,
|
|
25
|
+
competition_types:CompetitionTypeProps[],
|
|
26
|
+
competition_result_types:CompetitionResultTypeProps[],
|
|
27
|
+
competition_payout_types:CompetitionPayoutTypeProps[],
|
|
28
|
+
competitions:CompetitionProps[]
|
|
29
|
+
}>({
|
|
30
|
+
loading:false,
|
|
31
|
+
action_loading: false,
|
|
32
|
+
competition_payout_types:[],
|
|
33
|
+
competition_result_types: [],
|
|
34
|
+
competition_types:[],
|
|
35
|
+
competitions: []
|
|
36
|
+
})
|
|
37
|
+
const { action_loading, player, competition_types, competition_result_types, competition_season, competitions } = season_data;
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
ManageSeasonApi.setEnvironment();
|
|
41
|
+
getDataFromServer(competition_season_id);
|
|
42
|
+
},[competition_season_id])
|
|
43
|
+
|
|
44
|
+
const getDataFromServer = async(id:string) => {
|
|
45
|
+
setData({ ...season_data, loading: true });
|
|
46
|
+
const cs = await ManageSeasonApi.getSeasonById(id);
|
|
47
|
+
const comps = await ManageSeasonApi.getCompetitionsBySeasonId(id);
|
|
48
|
+
const opts = await ManageSeasonApi.getCompetitionOptions();
|
|
49
|
+
const me = await ManageSeasonApi.getMyDetails();
|
|
50
|
+
setData({
|
|
51
|
+
...season_data,
|
|
52
|
+
competition_season: cs,
|
|
53
|
+
competitions: comps,
|
|
54
|
+
player:me,
|
|
55
|
+
competition_payout_types: opts.competition_payout_types,
|
|
56
|
+
competition_result_types: opts.competition_result_types,
|
|
57
|
+
competition_types: opts.competition_types
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if(!competition_season){
|
|
63
|
+
return (
|
|
64
|
+
<View style={{ flex:1 }}>
|
|
65
|
+
<ActivityIndicator size={'large'} color={Colors.brand.midnight} style={{ padding:20, alignSelf:'center' }} />
|
|
66
|
+
</View>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const errors = ManageSeasonHelpers.isSeasonValid(competition_season)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<View style={{ flex:1 }}>
|
|
75
|
+
<ScrollView style={{ flex:1 }} onLayout={(ev) => {
|
|
76
|
+
const { width, height } = ev.nativeEvent.layout;
|
|
77
|
+
setModuleSize({ width, height })
|
|
78
|
+
}}>
|
|
79
|
+
<SeasonHeader
|
|
80
|
+
competition_season={competition_season}
|
|
81
|
+
width={module_size.width}
|
|
82
|
+
action_loading={action_loading}
|
|
83
|
+
season_valid={errors.length > 0 ? false : true}
|
|
84
|
+
onActivate={async() => {
|
|
85
|
+
setData({ ...season_data, action_loading: true })
|
|
86
|
+
const new_cs = await ManageSeasonApi.activateSeason(competition_season.competition_season_id);
|
|
87
|
+
setData({
|
|
88
|
+
...season_data,
|
|
89
|
+
action_loading: false,
|
|
90
|
+
competition_season:new_cs
|
|
91
|
+
})
|
|
92
|
+
}}
|
|
93
|
+
onDelete={async() => {
|
|
94
|
+
setData({ ...season_data, action_loading: true })
|
|
95
|
+
const new_cs = await ManageSeasonApi.deleteSeason(competition_season.competition_season_id);
|
|
96
|
+
setData({
|
|
97
|
+
...season_data,
|
|
98
|
+
action_loading: false,
|
|
99
|
+
competition_season:new_cs
|
|
100
|
+
})
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
103
|
+
<SeasonInfoForm
|
|
104
|
+
width={module_size.width}
|
|
105
|
+
player={player}
|
|
106
|
+
competition_season={competition_season}
|
|
107
|
+
onSeasonUpdate={async(cs) => {
|
|
108
|
+
setData({ ...season_data, action_loading: true })
|
|
109
|
+
const new_s = await ManageSeasonApi.updateSeason(cs);
|
|
110
|
+
setData({ ...season_data, action_loading: false, competition_season: new_s })
|
|
111
|
+
}}
|
|
112
|
+
/>
|
|
113
|
+
<SeasonSettingsForm
|
|
114
|
+
width={module_size.width}
|
|
115
|
+
competition_season={competition_season}
|
|
116
|
+
competition_types={competition_types}
|
|
117
|
+
competition_result_types={competition_result_types}
|
|
118
|
+
onSeasonUpdate={async(cs) => {
|
|
119
|
+
setData({ ...season_data, action_loading: true })
|
|
120
|
+
const new_s = await ManageSeasonApi.updateSeason(cs);
|
|
121
|
+
setData({ ...season_data, action_loading: false, competition_season: new_s })
|
|
122
|
+
}}
|
|
123
|
+
/>
|
|
124
|
+
<CompetitionsForm
|
|
125
|
+
onAddCompetition={() => setShowCreateCompetition(true)}
|
|
126
|
+
competitions={competitions}
|
|
127
|
+
competition_season={competition_season}
|
|
128
|
+
competition_result_types={competition_result_types}
|
|
129
|
+
competition_types={competition_types}
|
|
130
|
+
/>
|
|
131
|
+
</ScrollView>
|
|
132
|
+
{show_create_competition ?
|
|
133
|
+
<View style={{ position:'absolute', top:0, left:0, right:0, bottom:0, backgroundColor:Colors.shades.black_faded, justifyContent:'flex-end' }}>
|
|
134
|
+
<CreateCompetitionForm
|
|
135
|
+
width={module_size.width}
|
|
136
|
+
competition_season={competition_season}
|
|
137
|
+
onClose={() => setShowCreateCompetition(false)}
|
|
138
|
+
onCreate={(competition) => {
|
|
139
|
+
setData({
|
|
140
|
+
...season_data,
|
|
141
|
+
competitions: competitions.concat(competition)
|
|
142
|
+
})
|
|
143
|
+
}}
|
|
144
|
+
/>
|
|
145
|
+
</View>
|
|
146
|
+
:<></>}
|
|
147
|
+
</View>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export default SeasonManager
|
|
@@ -6,9 +6,10 @@ import Colors from '../constants/colors';
|
|
|
6
6
|
type SwitchProps = {
|
|
7
7
|
value: boolean,
|
|
8
8
|
switch_type: 'binary' | 'on_off',
|
|
9
|
+
disabled?:boolean,
|
|
9
10
|
onChange:(value:boolean) => void
|
|
10
11
|
}
|
|
11
|
-
const Switch = ({ value, switch_type, onChange }:SwitchProps) => {
|
|
12
|
+
const Switch = ({ value, disabled, switch_type, onChange }:SwitchProps) => {
|
|
12
13
|
|
|
13
14
|
const handleChange = () => {
|
|
14
15
|
if(onChange){
|
|
@@ -19,7 +20,9 @@ const Switch = ({ value, switch_type, onChange }:SwitchProps) => {
|
|
|
19
20
|
return (
|
|
20
21
|
<View style={{ flexDirection:'row', alignItems:'flex-start' }}>
|
|
21
22
|
{switch_type == 'on_off' ?
|
|
22
|
-
<TouchableOpacity
|
|
23
|
+
<TouchableOpacity
|
|
24
|
+
disabled={disabled}
|
|
25
|
+
style={{flexDirection:'row', justifyContent:'space-between', alignItems:'center', backgroundColor:value?Colors.highlights.highlight400:Colors.brand.slate, padding:3, borderRadius:12, width:48,height:24}} onPress={() => handleChange()}>
|
|
23
26
|
{ value ?
|
|
24
27
|
<>
|
|
25
28
|
<View />
|
|
@@ -33,7 +36,9 @@ const Switch = ({ value, switch_type, onChange }:SwitchProps) => {
|
|
|
33
36
|
}
|
|
34
37
|
</TouchableOpacity>
|
|
35
38
|
:
|
|
36
|
-
<TouchableOpacity
|
|
39
|
+
<TouchableOpacity
|
|
40
|
+
disabled={disabled}
|
|
41
|
+
style={{flexDirection:'row', justifyContent:'space-between', alignItems:'center', backgroundColor:Colors.shades.white, padding:3, borderRadius:12, width:48,height:24}} onPress={() => handleChange()}>
|
|
37
42
|
{ value ?
|
|
38
43
|
<>
|
|
39
44
|
<View />
|
package/src/Engage/index.tsx
CHANGED
|
@@ -56,6 +56,7 @@ const EngageModule = ({ onSelectBracketCompetition, onSelectCompetition, onSelec
|
|
|
56
56
|
});
|
|
57
57
|
const { loading, competitions, competition_result_types, squares_competitions, brackets, leagues, bracket_competitions, events, competition_types, companies, players } = module_data;
|
|
58
58
|
|
|
59
|
+
|
|
59
60
|
useEffect(() => {
|
|
60
61
|
EngageApi.setEnvironment();
|
|
61
62
|
getDataFromServer()
|
package/src/index.tsx
CHANGED
|
@@ -22,7 +22,8 @@ import CompetitionManager from "./CompetitionManager";
|
|
|
22
22
|
import CreateCompetitionForm from "./CompetitionManager/components/CreateCompetitionForm";
|
|
23
23
|
import AdminCompetitionList from "./CompetitionManager/components/AdminCompetitionList";
|
|
24
24
|
import EngageModule from "./Engage";
|
|
25
|
-
|
|
25
|
+
import SeasonManager from "./CompetitionSeasonManager";
|
|
26
|
+
import SeasonModule from "./CompetitionSeason";
|
|
26
27
|
|
|
27
28
|
export {
|
|
28
29
|
Authenticator,
|
|
@@ -44,7 +45,9 @@ export {
|
|
|
44
45
|
PollCampaignApi,
|
|
45
46
|
PollApi,
|
|
46
47
|
CompetitionModule,
|
|
48
|
+
SeasonManager,
|
|
47
49
|
CreateCompetitionForm,
|
|
50
|
+
SeasonModule,
|
|
48
51
|
AdminCompetitionList,
|
|
49
52
|
AdServer,
|
|
50
53
|
AdProvider,
|
package/src/types.d.ts
CHANGED
|
@@ -1185,25 +1185,68 @@ export interface CompetitionResultProps {
|
|
|
1185
1185
|
export interface CompetitionSeasonProps {
|
|
1186
1186
|
competition_season_id:string;
|
|
1187
1187
|
season_name: string;
|
|
1188
|
-
season_description:string;
|
|
1188
|
+
season_description: string;
|
|
1189
1189
|
image?:{ url:string };
|
|
1190
|
+
ticket_price:number | string;
|
|
1191
|
+
ticket_revenue: number;
|
|
1190
1192
|
payout_amt: number;
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
+
promo_amt?:number | string;
|
|
1194
|
+
max_picks: number | string;
|
|
1195
|
+
initial_balance:number | string;
|
|
1196
|
+
invite_only:boolean,
|
|
1197
|
+
company_id?:string,
|
|
1198
|
+
balance_rollover:boolean;
|
|
1193
1199
|
admin_id:string;
|
|
1200
|
+
unallocated_funds:number;
|
|
1194
1201
|
template?:boolean;
|
|
1202
|
+
competition_result_type_id:string;
|
|
1203
|
+
competition_type_id:string;
|
|
1204
|
+
sponsor_id?:string;
|
|
1205
|
+
entered?:boolean;
|
|
1206
|
+
expected_competition_count:number | string;
|
|
1207
|
+
pacer_id?:string;
|
|
1195
1208
|
following_season_id?:string;
|
|
1196
|
-
payout_allocation:number;
|
|
1209
|
+
payout_allocation:number | string;
|
|
1197
1210
|
single_buy_in:boolean; //If true - then once you enter, you are automatically entered into all remaining competitions in season. If false - you need to re-enter each week
|
|
1198
1211
|
allow_late_buy_in:boolean; //If true - then you will allow users to buy in at later dates
|
|
1199
1212
|
scheduled_datetime:any;
|
|
1200
1213
|
league_id?:string,
|
|
1201
|
-
status: 'active' | 'inactive' | 'pending';
|
|
1214
|
+
status: 'active' | 'inactive' | 'closed'|'pending';
|
|
1202
1215
|
market_type: 'FOR_MONEY' | 'FREE';
|
|
1216
|
+
guaranteed_payout?:number,
|
|
1217
|
+
tickets_sold:number,
|
|
1218
|
+
tickets_available:number,
|
|
1203
1219
|
create_datetime:any;
|
|
1204
1220
|
last_update_datetime:any;
|
|
1205
1221
|
}
|
|
1206
1222
|
|
|
1223
|
+
|
|
1224
|
+
export interface CompetitionSeasonPlayerProps {
|
|
1225
|
+
competition_season_player_id:string,
|
|
1226
|
+
competition_season_id:string,
|
|
1227
|
+
player_id:string,
|
|
1228
|
+
status: 'active'|'inactive',
|
|
1229
|
+
wins: number,
|
|
1230
|
+
losses:number,
|
|
1231
|
+
draws: number,
|
|
1232
|
+
wager_based_balance:number,
|
|
1233
|
+
earnings:number,
|
|
1234
|
+
create_datetime:any,
|
|
1235
|
+
last_update_datetime: any
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
export interface CompetitionSeasonResultProps {
|
|
1239
|
+
competition_season_result_id:string,
|
|
1240
|
+
competition_season_id:string,
|
|
1241
|
+
place:number,
|
|
1242
|
+
status:string,
|
|
1243
|
+
winnings:number,
|
|
1244
|
+
player_id:string,
|
|
1245
|
+
processed:boolean,
|
|
1246
|
+
create_datetime:any,
|
|
1247
|
+
last_update_datetime:any
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1207
1250
|
export interface CompetitionTypeProps {
|
|
1208
1251
|
competition_type_id:string,
|
|
1209
1252
|
type: string,
|