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
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, ScrollView, TouchableOpacity, Image, FlatList } from "react-native";
|
|
3
|
+
import { view_styles } from '../../constants/styles';
|
|
4
|
+
import { Button, Icons, Text, TextInput } from '../../Components';
|
|
5
|
+
import type { CompanyProps, CompetitionSeasonProps } from '../../types';
|
|
6
|
+
import { ManageSeasonApi, ManageSeasonHelpers } from '../api';
|
|
7
|
+
import Colors from '../../constants/colors';
|
|
8
|
+
|
|
9
|
+
type CreateSeasonFormProps = {
|
|
10
|
+
width:number,
|
|
11
|
+
max_height?:number,
|
|
12
|
+
onCreateSeason:(cs:CompetitionSeasonProps) => void,
|
|
13
|
+
onClose:() => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const CreateSeasonForm = ({ width, max_height, onCreateSeason, onClose }:CreateSeasonFormProps) => {
|
|
17
|
+
const [ action_loading, setActionLoading ] = useState(false);
|
|
18
|
+
const [ draft_season, setDraftSeason ] = useState<CompetitionSeasonProps>(ManageSeasonHelpers.getPendingSeason());
|
|
19
|
+
const [ show_companies, setShowCompanies ] = useState(false);
|
|
20
|
+
const [ show_templates, setShowTemplates ] = useState(false);
|
|
21
|
+
|
|
22
|
+
const [ form_data, setFormData ] = useState<{
|
|
23
|
+
templates:CompetitionSeasonProps[],
|
|
24
|
+
companies:CompanyProps[]
|
|
25
|
+
}>({
|
|
26
|
+
templates: [],
|
|
27
|
+
companies: []
|
|
28
|
+
});
|
|
29
|
+
const { templates, companies } = form_data;
|
|
30
|
+
|
|
31
|
+
const selected_company = companies.find(c => c.company_id == draft_season.company_id);
|
|
32
|
+
const selected_template = templates.find(cs => cs.competition_season_id == draft_season.following_season_id)
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
ManageSeasonApi.setEnvironment();
|
|
36
|
+
getFormData()
|
|
37
|
+
},[])
|
|
38
|
+
|
|
39
|
+
const getFormData = async() => {
|
|
40
|
+
const temps = await ManageSeasonApi.getSeasonTemplates();
|
|
41
|
+
const company_resp = await ManageSeasonApi.getMyCompanies();
|
|
42
|
+
setFormData({
|
|
43
|
+
...form_data,
|
|
44
|
+
companies: company_resp.companies,
|
|
45
|
+
templates:temps
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const handleCreate = async(season:CompetitionSeasonProps) => {
|
|
50
|
+
setActionLoading(true);
|
|
51
|
+
const new_season = await ManageSeasonApi.createSeason(season);
|
|
52
|
+
console.log(new_season)
|
|
53
|
+
onCreateSeason(new_season);
|
|
54
|
+
setActionLoading(false);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const renderCompanies = (data: { item:CompanyProps, index:number }) => {
|
|
58
|
+
return (
|
|
59
|
+
<TouchableOpacity style={{ ...view_styles.body_row, padding:10 }} onPress={() => {
|
|
60
|
+
setDraftSeason({ ...draft_season, company_id: data.item.company_id })
|
|
61
|
+
setShowCompanies(false)
|
|
62
|
+
}}>
|
|
63
|
+
<Image
|
|
64
|
+
source={{ uri: data.item.company_image?.url }}
|
|
65
|
+
style={{ height:50, width:50, borderRadius:4 }}
|
|
66
|
+
resizeMode="cover"
|
|
67
|
+
/>
|
|
68
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
69
|
+
<Text theme="header_2">{data.item.company_name}</Text>
|
|
70
|
+
<Text style={{ marginTop:3 }} theme="body">{data.item.company_description}</Text>
|
|
71
|
+
</View>
|
|
72
|
+
</TouchableOpacity>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
const renderTemplates = (data: { item:CompetitionSeasonProps, index:number }) => {
|
|
78
|
+
return (
|
|
79
|
+
<TouchableOpacity style={{ ...view_styles.body_row, padding:10 }} onPress={() => {
|
|
80
|
+
setDraftSeason({ ...draft_season, following_season_id: data.item.competition_season_id })
|
|
81
|
+
setShowTemplates(false)
|
|
82
|
+
}}>
|
|
83
|
+
<Image
|
|
84
|
+
source={{ uri: data.item.image?.url }}
|
|
85
|
+
style={{ height:50, width:50, borderRadius:4 }}
|
|
86
|
+
resizeMode="cover"
|
|
87
|
+
/>
|
|
88
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
89
|
+
<Text theme="header_2">{data.item.season_name}</Text>
|
|
90
|
+
<Text style={{ marginTop:3 }} theme="body">{data.item.season_description}</Text>
|
|
91
|
+
</View>
|
|
92
|
+
</TouchableOpacity>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
if(!draft_season){ return <></> }
|
|
99
|
+
|
|
100
|
+
const errors = ManageSeasonHelpers.isSeasonValid(draft_season);
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<View style={{ ...view_styles.section, width, maxHeight:max_height ?? 700, }}>
|
|
104
|
+
<View style={{ ...view_styles.section_header }}>
|
|
105
|
+
<View style={{ flex:1 }}>
|
|
106
|
+
<Text theme='header'>Create New Season</Text>
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
<ScrollView style={{ ...view_styles.section_body, flex:1 }}>
|
|
110
|
+
<View style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width }}>
|
|
111
|
+
<View style={{ margin:5 }}>
|
|
112
|
+
<Text theme='header_2'>Season Name</Text>
|
|
113
|
+
<Text style={{ marginTop:3 }} theme='body'>Give your season a memorable name.</Text>
|
|
114
|
+
</View>
|
|
115
|
+
<TextInput
|
|
116
|
+
style={{ ...view_styles.input, flex:1, margin:5 }}
|
|
117
|
+
value={draft_season?.season_name}
|
|
118
|
+
placeholder='Season Name'
|
|
119
|
+
placeholderTextColor={Colors.brand.slate}
|
|
120
|
+
onChangeText={(text) => setDraftSeason({ ...draft_season, season_name: text })}
|
|
121
|
+
/>
|
|
122
|
+
</View>
|
|
123
|
+
{companies.length > 0 ?
|
|
124
|
+
<View style={{ padding:10 }}>
|
|
125
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
126
|
+
<Text theme="header">Company</Text>
|
|
127
|
+
<Text style={{ marginTop:3 }} theme="body">Is this competition associated with one of your companies / brands?</Text>
|
|
128
|
+
</View>
|
|
129
|
+
<View style={{ padding:10, borderRadius:4, borderWidth:1, borderColor:Colors.shades.shade600, backgroundColor:Colors.shades.white }}>
|
|
130
|
+
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center' }} onPress={() => setShowCompanies(!show_companies)}>
|
|
131
|
+
{selected_company ?
|
|
132
|
+
<View style={{ flex:1, flexDirection:'row' }}>
|
|
133
|
+
<Image
|
|
134
|
+
source={{ uri: selected_company.company_image?.url }}
|
|
135
|
+
style={{ height:50, width:50, borderRadius:4 }}
|
|
136
|
+
resizeMode="cover"
|
|
137
|
+
/>
|
|
138
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
139
|
+
<Text theme="header_2">{selected_company.company_name}</Text>
|
|
140
|
+
<Text style={{ marginTop:3 }} theme="body">{selected_company.company_description}</Text>
|
|
141
|
+
</View>
|
|
142
|
+
</View>
|
|
143
|
+
:
|
|
144
|
+
<View style={{ flex:1 }}>
|
|
145
|
+
<Text theme="header_2">View Companies</Text>
|
|
146
|
+
</View>
|
|
147
|
+
}
|
|
148
|
+
<Icons.ChevronIcon direction={show_companies ? 'up' : 'down'} size={8} color={Colors.brand.midnight}/>
|
|
149
|
+
</TouchableOpacity>
|
|
150
|
+
{show_companies ?
|
|
151
|
+
<View>
|
|
152
|
+
<TouchableOpacity style={{ padding:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }} onPress={() => {
|
|
153
|
+
setDraftSeason({ ...draft_season, company_id:undefined })
|
|
154
|
+
setShowCompanies(false);
|
|
155
|
+
}}>
|
|
156
|
+
<Text theme="header_2">NO COMPANY</Text>
|
|
157
|
+
</TouchableOpacity>
|
|
158
|
+
<FlatList
|
|
159
|
+
data={companies}
|
|
160
|
+
renderItem={renderCompanies}
|
|
161
|
+
keyExtractor={(item) => item.company_id.toString()}
|
|
162
|
+
/>
|
|
163
|
+
</View>
|
|
164
|
+
:<></>}
|
|
165
|
+
</View>
|
|
166
|
+
</View>
|
|
167
|
+
:<></>}
|
|
168
|
+
{templates.length > 0 ?
|
|
169
|
+
<View style={{ padding:10 }}>
|
|
170
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
171
|
+
<Text theme="header">Create From Template</Text>
|
|
172
|
+
<Text style={{ marginTop:3 }} theme="body">Optionally you can select a template to auto create this competition from</Text>
|
|
173
|
+
</View>
|
|
174
|
+
<View style={{ padding:10, borderRadius:4, borderWidth:1, borderColor:Colors.shades.shade600, backgroundColor:Colors.shades.white }}>
|
|
175
|
+
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center' }} onPress={() => setShowTemplates(!show_templates)}>
|
|
176
|
+
{selected_template ?
|
|
177
|
+
<View style={{ flex:1, flexDirection:'row' }}>
|
|
178
|
+
<Image
|
|
179
|
+
source={{ uri: selected_template.image?.url }}
|
|
180
|
+
style={{ height:50, width:50, borderRadius:4 }}
|
|
181
|
+
resizeMode="cover"
|
|
182
|
+
/>
|
|
183
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
184
|
+
<Text theme="header_2">{selected_template.season_name}</Text>
|
|
185
|
+
<Text style={{ marginTop:3 }} theme="body">{selected_template.season_description}</Text>
|
|
186
|
+
</View>
|
|
187
|
+
</View>
|
|
188
|
+
:
|
|
189
|
+
<View style={{ flex:1 }}>
|
|
190
|
+
<Text theme="header_2">View Templates</Text>
|
|
191
|
+
</View>
|
|
192
|
+
}
|
|
193
|
+
<Icons.ChevronIcon direction={show_templates ? 'up' : 'down'} size={8} color={Colors.brand.midnight}/>
|
|
194
|
+
</TouchableOpacity>
|
|
195
|
+
{show_templates ?
|
|
196
|
+
<View>
|
|
197
|
+
<TouchableOpacity style={{ padding:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }} onPress={() => {
|
|
198
|
+
setDraftSeason({ ...draft_season, following_season_id:undefined })
|
|
199
|
+
setShowTemplates(false);
|
|
200
|
+
}}>
|
|
201
|
+
<Text theme="header_2">NO TEMPLATE</Text>
|
|
202
|
+
</TouchableOpacity>
|
|
203
|
+
<FlatList
|
|
204
|
+
data={templates}
|
|
205
|
+
renderItem={renderTemplates}
|
|
206
|
+
keyExtractor={(item) => item.competition_season_id.toString()}
|
|
207
|
+
/>
|
|
208
|
+
</View>
|
|
209
|
+
:<></>}
|
|
210
|
+
</View>
|
|
211
|
+
</View>
|
|
212
|
+
:<></>}
|
|
213
|
+
</ScrollView>
|
|
214
|
+
<View style={{ ...view_styles.section_footer }}>
|
|
215
|
+
<Button
|
|
216
|
+
title="CLOSE"
|
|
217
|
+
title_color={Colors.shades.white}
|
|
218
|
+
style={{ flex:1, marginRight:8 }}
|
|
219
|
+
padding={15}
|
|
220
|
+
backgroundColor={Colors.utility.error}
|
|
221
|
+
onPress={() => onClose()}
|
|
222
|
+
/>
|
|
223
|
+
<Button
|
|
224
|
+
title="CREATE SEASON"
|
|
225
|
+
title_color={Colors.shades.white}
|
|
226
|
+
loading={action_loading}
|
|
227
|
+
backgroundColor={Colors.utility.success}
|
|
228
|
+
padding={15}
|
|
229
|
+
style={{ flex:2, opacity: !action_loading && errors.length == 0 ? 1 : 0.5 }}
|
|
230
|
+
disabled={errors.length > 0 || action_loading ? true : false}
|
|
231
|
+
onPress={() => handleCreate(draft_season)}
|
|
232
|
+
/>
|
|
233
|
+
</View>
|
|
234
|
+
</View>
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export default CreateSeasonForm
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Image } from 'react-native';
|
|
3
|
+
import type { CompetitionSeasonProps } from '../../types';
|
|
4
|
+
import { Button, Text } from '../../Components';
|
|
5
|
+
import Colors from '../../constants/colors';
|
|
6
|
+
import { view_styles } from '../../constants/styles';
|
|
7
|
+
|
|
8
|
+
type CompetitionHeaderProps = {
|
|
9
|
+
width:number,
|
|
10
|
+
action_loading:boolean,
|
|
11
|
+
competition_season:CompetitionSeasonProps,
|
|
12
|
+
season_valid:boolean,
|
|
13
|
+
onDelete:() => void,
|
|
14
|
+
onActivate: () => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const SeasonHeader = ({ width, action_loading, competition_season, season_valid, onDelete, onActivate }:CompetitionHeaderProps) => {
|
|
18
|
+
|
|
19
|
+
const handleActivate = () => {
|
|
20
|
+
if(!season_valid){
|
|
21
|
+
return alert(`Please complete all the required sections before activating`)
|
|
22
|
+
}
|
|
23
|
+
onActivate()
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<View style={{ backgroundColor:Colors.shades.white, flexGrow:1, minWidth:330, maxWidth:width }}>
|
|
28
|
+
<View nativeID="competition_header" style={{ flexDirection:'row', alignItems:'center', padding:20, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
29
|
+
<View>
|
|
30
|
+
<Image
|
|
31
|
+
source={{ uri: competition_season.image?.url ?? 'https://res.cloudinary.com/hoabts6mc/image/upload/v1649737862/be_logo_jte2ux.webp' }}
|
|
32
|
+
style={{ height:50, width:50, borderRadius:4 }}
|
|
33
|
+
resizeMode="cover"
|
|
34
|
+
/>
|
|
35
|
+
</View>
|
|
36
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
37
|
+
<Text theme='header'>{competition_season.season_name}</Text>
|
|
38
|
+
<Text style={{ marginTop:4 }} theme='header_2>'>{competition_season.season_description}</Text>
|
|
39
|
+
</View>
|
|
40
|
+
{competition_season.status == 'pending'?
|
|
41
|
+
<Button
|
|
42
|
+
title={'ACTIVATE'}
|
|
43
|
+
style={{ opacity:season_valid ? 1: 0.5 }}
|
|
44
|
+
loading={action_loading}
|
|
45
|
+
title_color={Colors.shades.white}
|
|
46
|
+
backgroundColor={Colors.utility.success}
|
|
47
|
+
onPress={() => handleActivate()}
|
|
48
|
+
/>
|
|
49
|
+
:<></>}
|
|
50
|
+
</View>
|
|
51
|
+
{competition_season.status == 'pending' ?
|
|
52
|
+
<View style={{ ...view_styles.section_header, backgroundColor:Colors.shades.shade100 }}>
|
|
53
|
+
<View style={{ flex:1 }}>
|
|
54
|
+
<Text theme='header'>SEASON IS PENDING</Text>
|
|
55
|
+
<Text style={{ marginTop:3 }} theme='body'>Complete each section and press 'ACTIVATE'.</Text>
|
|
56
|
+
</View>
|
|
57
|
+
<Button
|
|
58
|
+
title='DELETE'
|
|
59
|
+
style={{ opacity:!action_loading? 1: 0.5 }}
|
|
60
|
+
loading={action_loading}
|
|
61
|
+
title_color={Colors.shades.white}
|
|
62
|
+
backgroundColor={Colors.utility.error}
|
|
63
|
+
onPress={async() => {
|
|
64
|
+
const confirmed = await confirm(`Are you sure you would like to delete this competition? This cannot be undone.`)
|
|
65
|
+
if(!confirmed){ return }
|
|
66
|
+
onDelete();
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
</View>
|
|
70
|
+
:<></>}
|
|
71
|
+
</View>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default SeasonHeader
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { TouchableOpacity, View, Image } 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 ImageUploader from '../../Components/ImageUploader';
|
|
7
|
+
import type { CompetitionSeasonProps, MyPlayerProps } from '../../types';
|
|
8
|
+
import { ManageSeasonHelpers } from '../api';
|
|
9
|
+
|
|
10
|
+
type SeasonInfoFormProps = {
|
|
11
|
+
width:number,
|
|
12
|
+
player?:MyPlayerProps,
|
|
13
|
+
competition_season:CompetitionSeasonProps,
|
|
14
|
+
onSeasonUpdate: (cs:CompetitionSeasonProps) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const SeasonInfoForm = ({ competition_season, player, width, onSeasonUpdate }:SeasonInfoFormProps) => {
|
|
18
|
+
const [ expanded, setExpanded ] = useState(false);
|
|
19
|
+
const [ draft_season, setDraftSeason ] = useState<CompetitionSeasonProps>();
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setDraftSeason(competition_season)
|
|
23
|
+
},[competition_season])
|
|
24
|
+
|
|
25
|
+
if(!draft_season){ return <></> }
|
|
26
|
+
|
|
27
|
+
const is_changed = ManageSeasonHelpers.isInfoChanged(competition_season, draft_season);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<View style={{ ...view_styles.section }}>
|
|
31
|
+
<TouchableOpacity style={{ ...view_styles.section_header }} onPress={() => setExpanded(!expanded)}>
|
|
32
|
+
<View style={{ flex:1 }}>
|
|
33
|
+
<Text theme='header'>Season Info</Text>
|
|
34
|
+
<Text style={{ marginTop:3 }}>Update high level information for this competition season</Text>
|
|
35
|
+
</View>
|
|
36
|
+
{is_changed ?
|
|
37
|
+
<Button
|
|
38
|
+
title='SAVE'
|
|
39
|
+
padding={10}
|
|
40
|
+
title_color={Colors.shades.white}
|
|
41
|
+
backgroundColor={Colors.utility.success}
|
|
42
|
+
onPress={() => onSeasonUpdate(draft_season)}
|
|
43
|
+
/>
|
|
44
|
+
:
|
|
45
|
+
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.brand.midnight} size={8} />
|
|
46
|
+
}
|
|
47
|
+
</TouchableOpacity>
|
|
48
|
+
{expanded ?
|
|
49
|
+
<View style={{ ...view_styles.section_body }}>
|
|
50
|
+
<View nativeID="competition_image" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
51
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
52
|
+
<Text theme='header_2'>Competition Image</Text>
|
|
53
|
+
<Text style={{ marginTop:3 }} theme='body'>Give this competition an image so it is recognizable to those trying to join.</Text>
|
|
54
|
+
</View>
|
|
55
|
+
<ImageUploader
|
|
56
|
+
public_id={`season_image_${draft_season.competition_season_id}_${Math.random()}`}
|
|
57
|
+
onFinishUpload={obj => onSeasonUpdate({ ...draft_season, image: { ...obj, url:obj.secure_url } })}
|
|
58
|
+
>
|
|
59
|
+
<Image
|
|
60
|
+
source={{ uri: draft_season.image?.url }}
|
|
61
|
+
style={{ height: 50, width:50, borderRadius:4 }}
|
|
62
|
+
resizeMode='cover'
|
|
63
|
+
/>
|
|
64
|
+
<Text size={12} color={Colors.brand.electric} textAlign='center'>CHANGE</Text>
|
|
65
|
+
</ImageUploader>
|
|
66
|
+
</View>
|
|
67
|
+
<View nativeID="competition_name" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
68
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
69
|
+
<Text theme='header_2'>Competition Name</Text>
|
|
70
|
+
<Text style={{ marginTop:3 }} theme='body'>Give the competition a memorable name that aligns with the type and payout.</Text>
|
|
71
|
+
</View>
|
|
72
|
+
<TextInput
|
|
73
|
+
style={{ ...view_styles.input, flexGrow:1, margin:5 }}
|
|
74
|
+
onChangeText={(text) => setDraftSeason({ ...draft_season, season_name:text })}
|
|
75
|
+
value={draft_season.season_name}
|
|
76
|
+
placeholder="Competition Name"
|
|
77
|
+
placeholderTextColor={Colors.brand.slate}
|
|
78
|
+
/>
|
|
79
|
+
</View>
|
|
80
|
+
|
|
81
|
+
<View nativeID="competition_description" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width, marginTop:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
82
|
+
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
83
|
+
<Text theme='header_2'>Competition Description</Text>
|
|
84
|
+
<Text style={{ marginTop:3 }} theme='body'>Give the competition a memorable description that would entice users to participate.</Text>
|
|
85
|
+
</View>
|
|
86
|
+
<TextInput
|
|
87
|
+
style={{ ...view_styles.input, flexGrow:1, margin:5 }}
|
|
88
|
+
onChangeText={(text) => setDraftSeason({ ...draft_season, season_description:text })}
|
|
89
|
+
value={draft_season.season_description}
|
|
90
|
+
placeholder="Pick 5 games ATS from NFL Week 6 matchups"
|
|
91
|
+
placeholderTextColor={Colors.brand.slate}
|
|
92
|
+
/>
|
|
93
|
+
</View>
|
|
94
|
+
{player?.role == 'admin' ?
|
|
95
|
+
<View nativeID="invite_only" style={{ ...view_styles.body_row, flexWrap:'wrap', marginTop:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
96
|
+
<View style={{ flex:1, margin:5, marginRight:15 }}>
|
|
97
|
+
<Text theme='header_2'>Make Template</Text>
|
|
98
|
+
<Text style={{ marginTop:3 }} theme='body'>Can this season be selected by others to replicate? Any competition created in this competition will be extrapolated to others.</Text>
|
|
99
|
+
</View>
|
|
100
|
+
<Switch
|
|
101
|
+
value={draft_season.template ?? false}
|
|
102
|
+
switch_type="on_off"
|
|
103
|
+
onChange={(value) => onSeasonUpdate({ ...draft_season, template: value })}
|
|
104
|
+
/>
|
|
105
|
+
</View>
|
|
106
|
+
:<></>}
|
|
107
|
+
<View nativeID="invite_only" style={{ ...view_styles.body_row, flexWrap:'wrap', marginTop:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
108
|
+
<View style={{ flex:1, margin:5, marginRight:15 }}>
|
|
109
|
+
<Text theme='header_2'>Make Private</Text>
|
|
110
|
+
<Text style={{ marginTop:3 }} theme='body'>Only access this competition using an invite code.</Text>
|
|
111
|
+
</View>
|
|
112
|
+
<Switch
|
|
113
|
+
value={draft_season.invite_only}
|
|
114
|
+
switch_type="on_off"
|
|
115
|
+
onChange={(value) => onSeasonUpdate({ ...draft_season, invite_only: value })}
|
|
116
|
+
/>
|
|
117
|
+
</View>
|
|
118
|
+
</View>
|
|
119
|
+
:<></>}
|
|
120
|
+
</View>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export default SeasonInfoForm
|
|
@@ -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
|