be-components 3.5.7 → 3.5.8
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/CompetitionManager/components/AthleteSelector.js +52 -75
- package/lib/commonjs/CompetitionManager/components/AthleteSelector.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js +135 -119
- package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionHeader.js +69 -62
- package/lib/commonjs/CompetitionManager/components/CompetitionHeader.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js +86 -91
- package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js +143 -150
- package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/ContestSelector.js +57 -61
- package/lib/commonjs/CompetitionManager/components/ContestSelector.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js +120 -266
- package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/MarketSelector.js +35 -32
- package/lib/commonjs/CompetitionManager/components/MarketSelector.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/PlayerSelector.js +42 -39
- package/lib/commonjs/CompetitionManager/components/PlayerSelector.js.map +1 -1
- package/lib/commonjs/CompetitionManager/index.js +47 -50
- package/lib/commonjs/CompetitionManager/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/OrderBook.js +1 -0
- package/lib/commonjs/MarketComponents/components/OrderBook.js.map +1 -1
- package/lib/module/CompetitionManager/components/AthleteSelector.js +42 -65
- package/lib/module/CompetitionManager/components/AthleteSelector.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionContestsForm.js +93 -77
- package/lib/module/CompetitionManager/components/CompetitionContestsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionHeader.js +47 -40
- package/lib/module/CompetitionManager/components/CompetitionHeader.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionInfoForm.js +59 -64
- package/lib/module/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js +108 -115
- package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/ContestSelector.js +34 -38
- package/lib/module/CompetitionManager/components/ContestSelector.js.map +1 -1
- package/lib/module/CompetitionManager/components/ContestSettingsForm.js +90 -237
- package/lib/module/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
- package/lib/module/CompetitionManager/components/MarketSelector.js +26 -23
- package/lib/module/CompetitionManager/components/MarketSelector.js.map +1 -1
- package/lib/module/CompetitionManager/components/PlayerSelector.js +30 -27
- package/lib/module/CompetitionManager/components/PlayerSelector.js.map +1 -1
- package/lib/module/CompetitionManager/index.js +32 -35
- package/lib/module/CompetitionManager/index.js.map +1 -1
- package/lib/module/MarketComponents/components/OrderBook.js +1 -0
- package/lib/module/MarketComponents/components/OrderBook.js.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/AthleteSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.d.ts +1 -2
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionHeader.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.d.ts +1 -2
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.d.ts +1 -2
- package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSettingsForm.d.ts +1 -2
- package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/PlayerSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/index.d.ts +2 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/components/OrderBook.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/AthleteSelector.d.ts +1 -2
- package/lib/typescript/lib/module/CompetitionManager/components/AthleteSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionContestsForm.d.ts +2 -4
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionHeader.d.ts +1 -2
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionHeader.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionInfoForm.d.ts +2 -4
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionSettingsForm.d.ts +2 -4
- package/lib/typescript/lib/module/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/ContestSelector.d.ts +1 -2
- package/lib/typescript/lib/module/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/ContestSettingsForm.d.ts +2 -4
- package/lib/typescript/lib/module/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/MarketSelector.d.ts +1 -2
- package/lib/typescript/lib/module/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/PlayerSelector.d.ts +1 -2
- package/lib/typescript/lib/module/CompetitionManager/components/PlayerSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/index.d.ts +3 -3
- package/lib/typescript/lib/module/CompetitionManager/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/OrderBook.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/AthleteSelector.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionHeader.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts +1 -1
- package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/ContestSettingsForm.d.ts +1 -1
- package/lib/typescript/src/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/PlayerSelector.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/index.d.ts +7 -1
- package/lib/typescript/src/CompetitionManager/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/OrderBook.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/CompetitionManager/components/AthleteSelector.tsx +32 -52
- package/src/CompetitionManager/components/CompetitionContestsForm.tsx +82 -89
- package/src/CompetitionManager/components/CompetitionHeader.tsx +45 -37
- package/src/CompetitionManager/components/CompetitionInfoForm.tsx +36 -40
- package/src/CompetitionManager/components/CompetitionSettingsForm.tsx +88 -96
- package/src/CompetitionManager/components/ContestSelector.tsx +33 -36
- package/src/CompetitionManager/components/ContestSettingsForm.tsx +58 -179
- package/src/CompetitionManager/components/MarketSelector.tsx +19 -21
- package/src/CompetitionManager/components/PlayerSelector.tsx +23 -26
- package/src/CompetitionManager/index.tsx +22 -25
- package/src/MarketComponents/components/OrderBook.tsx +1 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Alert, Image } from 'react-native';
|
|
3
3
|
import type { CompetitionProps, CompetitionSummaryProps } from '../../types';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { view_styles } from '../../constants/styles';
|
|
4
|
+
import { useColors } from '../../constants/useColors';
|
|
5
|
+
import { Button, Text, View } from '../../Components/Themed';
|
|
7
6
|
|
|
8
7
|
type CompetitionHeaderProps = {
|
|
9
8
|
width:number,
|
|
@@ -24,7 +23,7 @@ type CompetitionHeaderProps = {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
const CompetitionHeader = ({ width, action_loading, competition_summaries, competition, competition_valid, onDelete, onActivate, onPause, onResume }:CompetitionHeaderProps) => {
|
|
27
|
-
|
|
26
|
+
const Colors = useColors();
|
|
28
27
|
const handleActivate = () => {
|
|
29
28
|
if(!competition_valid.valid){
|
|
30
29
|
return alert(`Please complete all the required sections before activating`)
|
|
@@ -40,8 +39,8 @@ const CompetitionHeader = ({ width, action_loading, competition_summaries, compe
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
return (
|
|
43
|
-
<View style={{
|
|
44
|
-
<View nativeID="competition_header" style={{ flexDirection:'row', alignItems:'center', padding:20, borderBottomWidth:1, borderColor:Colors.
|
|
42
|
+
<View style={{ flexGrow:1, minWidth:330, maxWidth:width }}>
|
|
43
|
+
<View nativeID="competition_header" style={{ flexDirection:'row', alignItems:'center', padding:20, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
45
44
|
<View>
|
|
46
45
|
<Image
|
|
47
46
|
source={{ uri: competition.image?.url ?? 'https://res.cloudinary.com/hoabts6mc/image/upload/v1649737862/be_logo_jte2ux.webp' }}
|
|
@@ -50,73 +49,83 @@ const CompetitionHeader = ({ width, action_loading, competition_summaries, compe
|
|
|
50
49
|
/>
|
|
51
50
|
</View>
|
|
52
51
|
<View style={{ flex:1, marginLeft:10 }}>
|
|
53
|
-
<Text theme='
|
|
54
|
-
<Text style={{ marginTop:4 }} theme='
|
|
52
|
+
<Text theme='h1'>{competition.competition_name}</Text>
|
|
53
|
+
<Text style={{ marginTop:4 }} theme='h2'>{competition.competition_description}</Text>
|
|
55
54
|
</View>
|
|
56
55
|
{competition.status == 'pending'?
|
|
57
56
|
<Button
|
|
58
57
|
title={'ACTIVATE'}
|
|
59
58
|
style={{ opacity:competition_valid.valid ? 1: 0.5 }}
|
|
60
59
|
loading={action_loading}
|
|
61
|
-
|
|
62
|
-
backgroundColor={Colors.utility.success}
|
|
60
|
+
type='success'
|
|
63
61
|
onPress={() => handleActivate()}
|
|
64
62
|
/>
|
|
65
63
|
:<></>}
|
|
66
64
|
</View>
|
|
67
65
|
{competition.status == 'pending' ?
|
|
68
|
-
<View style={{
|
|
69
|
-
<View style={{ flex:1 }}>
|
|
70
|
-
<Text theme='
|
|
71
|
-
<Text style={{ marginTop:3 }} theme='
|
|
66
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
67
|
+
<View transparent style={{ flex:1 }}>
|
|
68
|
+
<Text theme='h1'>COMPETITION IS PENDING</Text>
|
|
69
|
+
<Text style={{ marginTop:3 }} theme='description'>Complete each section and press 'ACTIVATE'.</Text>
|
|
72
70
|
</View>
|
|
73
71
|
<Button
|
|
74
72
|
title='DELETE'
|
|
75
73
|
style={{ opacity:!action_loading? 1: 0.5 }}
|
|
76
74
|
loading={action_loading}
|
|
77
|
-
|
|
78
|
-
backgroundColor={Colors.utility.error}
|
|
75
|
+
type='error'
|
|
79
76
|
onPress={async() => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
Alert.alert('Are you sure you would like to delete?', 'This cannot be undone', [
|
|
78
|
+
{
|
|
79
|
+
text:'Cancel',
|
|
80
|
+
onPress:() => console.log('hey')
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
text: `Yes I'm Sure`,
|
|
84
|
+
onPress:() => onDelete()
|
|
85
|
+
}
|
|
86
|
+
])
|
|
83
87
|
}}
|
|
84
88
|
/>
|
|
85
89
|
</View>
|
|
86
90
|
:<></>}
|
|
87
91
|
{competition.status == 'scheduled' ?
|
|
88
|
-
<View style={{
|
|
89
|
-
<View style={{ flex:1 }}>
|
|
90
|
-
<Text theme='
|
|
91
|
-
<Text style={{ marginTop:3 }} theme='
|
|
92
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
93
|
+
<View transparent style={{ flex:1 }}>
|
|
94
|
+
<Text theme='h1'>COMPETITION IS ACTIVE</Text>
|
|
95
|
+
<Text style={{ marginTop:3 }} theme='description'>In order to edit this competition, you must first pause it.</Text>
|
|
92
96
|
</View>
|
|
93
97
|
<Button
|
|
94
98
|
title='PAUSE'
|
|
95
99
|
style={{ opacity:!action_loading && competition_valid.valid ? 1: 0.5 }}
|
|
96
100
|
loading={action_loading}
|
|
97
|
-
|
|
98
|
-
backgroundColor={Colors.utility.success}
|
|
101
|
+
type='success'
|
|
99
102
|
onPress={() => onPause()}
|
|
100
103
|
/>
|
|
101
104
|
</View>
|
|
102
105
|
:<></>}
|
|
103
106
|
{competition.status == 'paused' ?
|
|
104
|
-
<View style={{
|
|
105
|
-
<View style={{ flex:1 }}>
|
|
106
|
-
<Text theme='
|
|
107
|
-
<Text style={{ marginTop:3 }} theme='
|
|
107
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
108
|
+
<View transparent style={{ flex:1 }}>
|
|
109
|
+
<Text theme='h1'>EDITING COMPETITION</Text>
|
|
110
|
+
<Text style={{ marginTop:3 }} theme='description'>Feel free to make changes. When done, simply press resume.</Text>
|
|
108
111
|
</View>
|
|
109
112
|
{competition_summaries.length == 0 ?
|
|
110
113
|
<Button
|
|
111
114
|
title='DELETE'
|
|
112
115
|
style={{ marginRight:5, opacity:!action_loading ? 1: 0.5 }}
|
|
113
116
|
loading={action_loading}
|
|
114
|
-
|
|
115
|
-
backgroundColor={Colors.utility.error}
|
|
117
|
+
type='error'
|
|
116
118
|
onPress={async() => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
Alert.alert('Are you sure you would like to delete?', 'This cannot be undone', [
|
|
120
|
+
{
|
|
121
|
+
text:'Cancel',
|
|
122
|
+
onPress:() => console.log('hey')
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
text: `Yes I'm Sure`,
|
|
126
|
+
onPress:() => onDelete()
|
|
127
|
+
}
|
|
128
|
+
])
|
|
120
129
|
}}
|
|
121
130
|
/>
|
|
122
131
|
:<></>}
|
|
@@ -124,8 +133,7 @@ const CompetitionHeader = ({ width, action_loading, competition_summaries, compe
|
|
|
124
133
|
title='RESUME'
|
|
125
134
|
style={{ opacity:!action_loading && competition_valid.valid ? 1: 0.5 }}
|
|
126
135
|
loading={action_loading}
|
|
127
|
-
|
|
128
|
-
backgroundColor={Colors.brand.electric}
|
|
136
|
+
type='success'
|
|
129
137
|
onPress={() => handleResume()}
|
|
130
138
|
/>
|
|
131
139
|
</View>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { view_styles } from "../../constants/styles"
|
|
2
|
+
import { Image } from "react-native"
|
|
4
3
|
//import ImageUploader from '../../Components/ImageUploader';
|
|
5
4
|
import type { CompetitionProps, MyPlayerProps } from '../../types';
|
|
6
|
-
import {
|
|
7
|
-
import Colors from '../../constants/colors';
|
|
5
|
+
import { Icons, Switch } from '../../Components';
|
|
8
6
|
import ImageUploader from '../../Components/ImageUploader';
|
|
7
|
+
import { Button, Text, TextInput, View } from '../../Components/Themed';
|
|
8
|
+
import { useColors } from '../../constants/useColors';
|
|
9
9
|
|
|
10
10
|
type CompetitionInfoFormProps = {
|
|
11
11
|
competition:CompetitionProps,
|
|
@@ -15,10 +15,10 @@ type CompetitionInfoFormProps = {
|
|
|
15
15
|
onCompetitionUpdate:(competition:CompetitionProps) => void
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const CompetitionInfoForm = ({ is_valid, player, competition,
|
|
18
|
+
const CompetitionInfoForm = ({ is_valid, player, competition, onCompetitionUpdate }:CompetitionInfoFormProps) => {
|
|
19
19
|
const [ expanded, setExpanded ] = useState(false);
|
|
20
20
|
const [ draft_competition, setDraftCompetition ] = useState<CompetitionProps | undefined>(undefined);
|
|
21
|
-
|
|
21
|
+
const Colors = useColors();
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
setDraftCompetition(competition)
|
|
24
24
|
},[competition])
|
|
@@ -26,36 +26,34 @@ const CompetitionInfoForm = ({ is_valid, player, competition, width, onCompetiti
|
|
|
26
26
|
if(!draft_competition){ return <></> }
|
|
27
27
|
const is_changed = JSON.stringify(draft_competition) != JSON.stringify(competition) ? true : false;
|
|
28
28
|
return (
|
|
29
|
-
<View style={{
|
|
30
|
-
<
|
|
29
|
+
<View float style={{ flexGrow:1, borderRadius:0 }}>
|
|
30
|
+
<Button float style={{ flexDirection:'row', alignItems:'center', borderRadius:0}} onPress={() => setExpanded(!expanded)}>
|
|
31
31
|
{is_valid ?
|
|
32
|
-
<Icons.CheckCirlceIcon size={16} color={Colors.
|
|
32
|
+
<Icons.CheckCirlceIcon size={16} color={Colors.text.success} />
|
|
33
33
|
:
|
|
34
|
-
<Icons.AlertIcon size={16} color={Colors.
|
|
34
|
+
<Icons.AlertIcon size={16} color={Colors.text.warning} />
|
|
35
35
|
}
|
|
36
|
-
<View style={{ flex:1, marginLeft:10 }}>
|
|
37
|
-
<Text theme='
|
|
38
|
-
<Text style={{ marginTop:3 }} theme='
|
|
36
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
37
|
+
<Text theme='h1'>Competition Information</Text>
|
|
38
|
+
<Text style={{ marginTop:3 }} theme='description'>Manage the high level information of this competition</Text>
|
|
39
39
|
</View>
|
|
40
40
|
{is_changed ?
|
|
41
41
|
<Button
|
|
42
42
|
title='SAVE'
|
|
43
|
-
|
|
44
|
-
title_color={Colors.shades.white}
|
|
45
|
-
backgroundColor={Colors.utility.success}
|
|
43
|
+
type='success'
|
|
46
44
|
onPress={() => onCompetitionUpdate(draft_competition)}
|
|
47
45
|
/>
|
|
48
46
|
:
|
|
49
|
-
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.
|
|
47
|
+
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.text.h1} size={8} />
|
|
50
48
|
}
|
|
51
|
-
</
|
|
49
|
+
</Button>
|
|
52
50
|
{expanded ?
|
|
53
|
-
<View nativeID="competition_info"
|
|
51
|
+
<View type='body' nativeID="competition_info">
|
|
54
52
|
|
|
55
|
-
<View nativeID="competition_image" style={{
|
|
56
|
-
<View style={{ flex:1, margin:5
|
|
57
|
-
<Text theme='
|
|
58
|
-
<Text style={{ marginTop:3 }} theme='
|
|
53
|
+
<View type='row' nativeID="competition_image" style={{ alignItems:'flex-start', borderBottomWidth:1, borderColor:Colors.borders.light, padding:10 }}>
|
|
54
|
+
<View style={{ flex:1, margin:5 }}>
|
|
55
|
+
<Text theme='h1'>Competition Image</Text>
|
|
56
|
+
<Text style={{ marginTop:3 }} theme='description'>Give this competition an image so it is recognizable to those trying to join.</Text>
|
|
59
57
|
</View>
|
|
60
58
|
<ImageUploader
|
|
61
59
|
public_id={`comp_image_${competition.competition_id}_${Math.random()}`}
|
|
@@ -66,41 +64,39 @@ const CompetitionInfoForm = ({ is_valid, player, competition, width, onCompetiti
|
|
|
66
64
|
style={{ height: 50, width:50, borderRadius:4 }}
|
|
67
65
|
resizeMode='cover'
|
|
68
66
|
/>
|
|
69
|
-
<Text size={12} color={Colors.
|
|
67
|
+
<Text style={{ marginTop:10 }} size={12} color={Colors.text.action} textAlign='center'>CHANGE</Text>
|
|
70
68
|
</ImageUploader>
|
|
71
69
|
</View>
|
|
72
70
|
|
|
73
|
-
<View nativeID="competition_name" style={{
|
|
71
|
+
<View type='row' nativeID="competition_name" style={{ flexWrap:'wrap', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
74
72
|
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
75
|
-
<Text theme='
|
|
76
|
-
<Text style={{ marginTop:3 }} theme='
|
|
73
|
+
<Text theme='h1'>Competition Name</Text>
|
|
74
|
+
<Text style={{ marginTop:3 }} theme='description'>Give the competition a memorable name that aligns with the type and payout.</Text>
|
|
77
75
|
</View>
|
|
78
76
|
<TextInput
|
|
79
|
-
style={{
|
|
77
|
+
style={{ flex:1, minWidth:200, margin:5 }}
|
|
80
78
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, competition_name:text })}
|
|
81
79
|
value={draft_competition.competition_name}
|
|
82
80
|
placeholder="Competition Name"
|
|
83
|
-
placeholderTextColor={Colors.brand.slate}
|
|
84
81
|
/>
|
|
85
82
|
</View>
|
|
86
83
|
|
|
87
|
-
<View nativeID="competition_description" style={{
|
|
84
|
+
<View type='row' nativeID="competition_description" style={{ flexWrap:'wrap', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
88
85
|
<View style={{ flex:1, margin:5, minWidth:200 }}>
|
|
89
|
-
<Text theme='
|
|
90
|
-
<Text style={{ marginTop:3 }} theme='
|
|
86
|
+
<Text theme='h2'>Competition Description</Text>
|
|
87
|
+
<Text style={{ marginTop:3 }} theme='description'>Give the competition a memorable description that would entice users to participate.</Text>
|
|
91
88
|
</View>
|
|
92
89
|
<TextInput
|
|
93
|
-
style={{
|
|
90
|
+
style={{ flex:1, minWidth:200, margin:5 }}
|
|
94
91
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, competition_description:text })}
|
|
95
92
|
value={draft_competition.competition_description}
|
|
96
93
|
placeholder="Pick 5 games ATS from NFL Week 6 matchups"
|
|
97
|
-
placeholderTextColor={Colors.brand.slate}
|
|
98
94
|
/>
|
|
99
95
|
</View>
|
|
100
|
-
<View nativeID="invite_only" style={{
|
|
96
|
+
<View type='row' nativeID="invite_only" style={{ flexWrap:'wrap', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
101
97
|
<View style={{ flex:1, margin:5, marginRight:15 }}>
|
|
102
|
-
<Text theme='
|
|
103
|
-
<Text style={{ marginTop:3 }} theme='
|
|
98
|
+
<Text theme='h1'>Make Private</Text>
|
|
99
|
+
<Text style={{ marginTop:3 }} theme='description'>Only access this competition using an invite code.</Text>
|
|
104
100
|
</View>
|
|
105
101
|
<Switch
|
|
106
102
|
disabled={competition.competition_season_id ? true : false}
|
|
@@ -110,10 +106,10 @@ const CompetitionInfoForm = ({ is_valid, player, competition, width, onCompetiti
|
|
|
110
106
|
/>
|
|
111
107
|
</View>
|
|
112
108
|
{player?.role == 'admin' ?
|
|
113
|
-
<View nativeID="invite_only" style={{
|
|
109
|
+
<View type='row' nativeID="invite_only" style={{ flexWrap:'wrap', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
114
110
|
<View style={{ flex:1, margin:5, marginRight:15 }}>
|
|
115
|
-
<Text theme='
|
|
116
|
-
<Text style={{ marginTop:3 }} theme='
|
|
111
|
+
<Text theme='h2'>Make Template</Text>
|
|
112
|
+
<Text style={{ marginTop:3 }} theme='description'>This will allow for other users to copy this competition and create it for themselves.</Text>
|
|
117
113
|
</View>
|
|
118
114
|
<Switch
|
|
119
115
|
value={competition.template ? true : false}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Image } from "react-native"
|
|
2
2
|
import React, { useEffect, useState } from "react";
|
|
3
3
|
import type { CompetitionProps, CompetitionResultTypeProps, MyPlayerProps, PublicPlayerProps } from "../../types";
|
|
4
4
|
import { ManageCompetitionApi } from "../api";
|
|
5
|
-
import
|
|
6
|
-
import { Button, Icons, Text } from "../../Components";
|
|
7
|
-
import { view_styles } from "../../constants/styles";
|
|
5
|
+
import { Icons, Toggle } from "../../Components";
|
|
8
6
|
import DropDown from "../../Components/Dropdown";
|
|
9
7
|
import moment from "moment-mini";
|
|
8
|
+
import { Button, Text, TextInput, View } from "../../Components/Themed";
|
|
9
|
+
import { useColors } from "../../constants/useColors";
|
|
10
10
|
|
|
11
11
|
type CompetitionSettingsFormProps = {
|
|
12
12
|
player?: MyPlayerProps,
|
|
@@ -20,12 +20,12 @@ type CompetitionSettingsFormProps = {
|
|
|
20
20
|
|
|
21
21
|
const market_types = ['FOR_MONEY', 'FREE']
|
|
22
22
|
|
|
23
|
-
const CompetitionSettingsForm = ({ is_valid, player,
|
|
23
|
+
const CompetitionSettingsForm = ({ is_valid, player, competition, competition_result_types, onCompetitionUpdate, onShowPacers }: CompetitionSettingsFormProps) => {
|
|
24
24
|
const [ expanded, setExpanded ] = useState(false);
|
|
25
25
|
const [ draft_competition, setDraftCompetition ] = useState<CompetitionProps | undefined>(undefined);
|
|
26
26
|
//const [ player_selector_visible, setPlayerSelectorVisible ] = useState(false);
|
|
27
27
|
const [ pacer, setPacer ] = useState<PublicPlayerProps | MyPlayerProps>();
|
|
28
|
-
|
|
28
|
+
const Colors = useColors();
|
|
29
29
|
const competition_result_type = competition_result_types.find(crt => crt.competition_result_type_id == competition?.competition_result_type_id);
|
|
30
30
|
|
|
31
31
|
useEffect(() => {
|
|
@@ -51,71 +51,58 @@ const CompetitionSettingsForm = ({ is_valid, player, width, competition, competi
|
|
|
51
51
|
setPacer(ps[0])
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const renderMarketTypes = (data:{ item:string, index:number }) => {
|
|
55
|
-
if(!draft_competition){ return <></> }
|
|
56
|
-
const selected = data.item == competition.market_type ? true : false
|
|
57
|
-
return (
|
|
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 })}>
|
|
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>
|
|
62
|
-
</TouchableOpacity>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
|
|
66
54
|
|
|
67
55
|
if(!competition || !draft_competition){ return <></> }
|
|
68
56
|
const is_changed = JSON.stringify(competition) != JSON.stringify(draft_competition) ? true : false
|
|
69
57
|
|
|
70
58
|
return (
|
|
71
|
-
<View style={{
|
|
72
|
-
<
|
|
59
|
+
<View float style={{ flexGrow:1, borderRadius:0 }}>
|
|
60
|
+
<Button float style={{ flexDirection:'row', alignItems:'center', borderRadius:0 }} onPress={() => setExpanded(!expanded)}>
|
|
73
61
|
{is_valid ?
|
|
74
|
-
<Icons.CheckCirlceIcon size={16} color={Colors.
|
|
62
|
+
<Icons.CheckCirlceIcon size={16} color={Colors.text.success} />
|
|
75
63
|
:
|
|
76
|
-
<Icons.AlertIcon size={16} color={Colors.
|
|
64
|
+
<Icons.AlertIcon size={16} color={Colors.text.warning} />
|
|
77
65
|
}
|
|
78
|
-
<View style={{ flex:1, marginLeft:10 }}>
|
|
79
|
-
<Text theme='
|
|
80
|
-
<Text style={{ marginTop:3 }} theme='
|
|
66
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
67
|
+
<Text theme='h1'>Competition Settings</Text>
|
|
68
|
+
<Text style={{ marginTop:3 }} theme='description'>Manage the high level information of this competition</Text>
|
|
81
69
|
</View>
|
|
82
70
|
{is_changed ?
|
|
83
71
|
<Button
|
|
84
72
|
title='SAVE'
|
|
85
|
-
|
|
86
|
-
title_color={Colors.shades.white}
|
|
87
|
-
backgroundColor={Colors.utility.success}
|
|
73
|
+
type='success'
|
|
88
74
|
onPress={() => onCompetitionUpdate(draft_competition)}
|
|
89
75
|
/>
|
|
90
76
|
:
|
|
91
|
-
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.
|
|
77
|
+
<Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.text.h1} size={8} />
|
|
92
78
|
}
|
|
93
|
-
</
|
|
79
|
+
</Button>
|
|
94
80
|
{expanded ?
|
|
95
|
-
<View nativeID="competition_settings" style={{
|
|
81
|
+
<View type='body' nativeID="competition_settings" style={{ flexGrow:1 }}>
|
|
96
82
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
<Text theme="
|
|
101
|
-
<Text style={{ marginTop:3 }} theme="body">Is the ticket price in real-money or edge coins?</Text>
|
|
83
|
+
<View nativeID="competition_currency" style={{ padding:10, borderBottomWidth:1, borderBottomColor:Colors.borders.light }}>
|
|
84
|
+
<View style={{ margin:5, minWidth:200 }}>
|
|
85
|
+
<Text theme="h1">Competition Currency</Text>
|
|
86
|
+
<Text style={{ marginTop:3 }} theme="description">Is the ticket price in real-money or edge coins?</Text>
|
|
102
87
|
</View>
|
|
103
|
-
<View style={{ justifyContent:'flex-end', margin: 5, borderRadius:8
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
88
|
+
<View style={{ justifyContent:'flex-end', margin: 5, borderRadius:8 }}>
|
|
89
|
+
<Toggle
|
|
90
|
+
options={market_types.map(t => {
|
|
91
|
+
return { key: t, label: t }
|
|
92
|
+
})}
|
|
93
|
+
onSelectOption={(key) => onCompetitionUpdate({ ...draft_competition, market_type: key})}
|
|
94
|
+
selected_option={competition.market_type}
|
|
109
95
|
/>
|
|
96
|
+
|
|
110
97
|
</View>
|
|
111
98
|
</View>
|
|
112
|
-
|
|
113
|
-
<View nativeID="competition_payout" style={{
|
|
114
|
-
<View style={{ flex:1,
|
|
115
|
-
<Text theme="
|
|
116
|
-
<Text style={{ marginTop:3 }} theme="
|
|
99
|
+
<View style={{borderBottomWidth:1, borderBottomColor:Colors.borders.light, padding:10}}>
|
|
100
|
+
<View type='row' nativeID="competition_payout" style={{ flexWrap:'wrap' }}>
|
|
101
|
+
<View transparent style={{ flex:1, minWidth:200 }}>
|
|
102
|
+
<Text theme="h1">Competition Payout Type</Text>
|
|
103
|
+
<Text style={{ marginTop:3 }} theme="description">{competition_result_type?competition_result_type.description:'Choose the type of payout for this competition'}</Text>
|
|
117
104
|
</View>
|
|
118
|
-
<View style={{ justifyContent:'flex-end', margin:5, borderRadius:8
|
|
105
|
+
<View transparent style={{ flex:1, justifyContent:'flex-end', margin:5, borderRadius:8 }}>
|
|
119
106
|
<DropDown
|
|
120
107
|
read_only={competition.competition_season_id ? true : false}
|
|
121
108
|
dropdown_options={[
|
|
@@ -131,82 +118,87 @@ const CompetitionSettingsForm = ({ is_valid, player, width, competition, competi
|
|
|
131
118
|
</View>
|
|
132
119
|
</View>
|
|
133
120
|
{competition_result_type?.type == 'outpace' ?
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
121
|
+
<View transparent style={{ marginTop:10 }}>
|
|
122
|
+
<Text style={{ marginBottom:10 }} theme="h1">Select a Pacer</Text>
|
|
123
|
+
<Button
|
|
124
|
+
float
|
|
125
|
+
disabled={competition.competition_season_id ? true : false}
|
|
126
|
+
style={{ borderRadius:8, padding:10 }} onPress={() => onShowPacers()}>
|
|
127
|
+
{pacer ?
|
|
128
|
+
<View transparent type='row'>
|
|
129
|
+
<Icons.PacerCarIcon size={24} color={Colors.text.h1} />
|
|
130
|
+
<Image
|
|
131
|
+
source={{ uri: pacer.profile_pic && pacer.profile_pic != '' ? pacer.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
132
|
+
style={{ height:40, width:40, borderRadius:4, marginLeft:10 }}
|
|
133
|
+
resizeMode="cover"
|
|
134
|
+
/>
|
|
135
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
136
|
+
<Text theme="h2">@{pacer.username}</Text>
|
|
137
|
+
<Text style={{ marginTop:3 }} theme="description">Joined {moment(pacer.create_datetime).format('MMM YYYY')}</Text>
|
|
138
|
+
</View>
|
|
139
|
+
<Icons.ChevronIcon direction="right" color={Colors.text.h1} size={8} />
|
|
148
140
|
</View>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
<
|
|
141
|
+
:
|
|
142
|
+
<View type='row'>
|
|
143
|
+
<Icons.AlertIcon size={20} color={Colors.text.warning} />
|
|
144
|
+
<Image
|
|
145
|
+
source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
146
|
+
style={{ height:40, width:40, borderRadius:4, marginLeft:10 }}
|
|
147
|
+
resizeMode="cover"
|
|
148
|
+
/>
|
|
149
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
150
|
+
<Text theme="h2">Select A Pacer!</Text>
|
|
151
|
+
</View>
|
|
152
|
+
<Icons.ChevronIcon direction="right" color={Colors.text.h1} size={8} />
|
|
161
153
|
</View>
|
|
162
|
-
|
|
163
|
-
</
|
|
164
|
-
|
|
165
|
-
</TouchableOpacity>
|
|
154
|
+
}
|
|
155
|
+
</Button>
|
|
156
|
+
</View>
|
|
166
157
|
:<></>}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
<Text
|
|
158
|
+
</View>
|
|
159
|
+
<View type='row' nativeID="buy_in" style={{ flexWrap:'wrap', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
160
|
+
<View style={{ flex:1, minWidth:200 }}>
|
|
161
|
+
<Text theme="h1">Ticket Price</Text>
|
|
162
|
+
<Text style={{ marginTop:3 }} theme="description">Set the amount required to purchase a ticket to participate</Text>
|
|
171
163
|
</View>
|
|
172
164
|
<TextInput
|
|
173
|
-
style={{
|
|
165
|
+
style={{ flex:1, textAlign:'center', width:100 }}
|
|
174
166
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, buy_in: text })}
|
|
175
167
|
placeholder="0"
|
|
168
|
+
keyboardType="decimal-pad"
|
|
176
169
|
editable={competition.competition_season_id ? false : true}
|
|
177
170
|
value={draft_competition.buy_in as string}
|
|
178
|
-
placeholderTextColor={Colors.brand.slate}
|
|
179
171
|
/>
|
|
180
172
|
</View>
|
|
181
173
|
{player?.role == 'admin' ?
|
|
182
|
-
<View nativeID="buy_in" style={{
|
|
183
|
-
<View style={{ flex:1,
|
|
184
|
-
<Text theme="
|
|
185
|
-
<Text style={{ marginTop:3 }} theme="
|
|
174
|
+
<View type='row' nativeID="buy_in" style={{ flexWrap:'wrap', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
175
|
+
<View style={{ flex:1, minWidth:200 }}>
|
|
176
|
+
<Text theme="h1">Guaranteed Payout</Text>
|
|
177
|
+
<Text style={{ marginTop:3 }} theme="description">ADMIN ONLY - How much is guaranteed to be paid out?</Text>
|
|
186
178
|
</View>
|
|
187
179
|
<TextInput
|
|
188
|
-
style={{
|
|
180
|
+
style={{ flex:1, textAlign:'center', width:100 }}
|
|
189
181
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, guaranteed_payout: text })}
|
|
190
182
|
placeholder="0"
|
|
183
|
+
keyboardType="decimal-pad"
|
|
191
184
|
editable={competition.competition_season_id ? false : true}
|
|
192
185
|
value={draft_competition.guaranteed_payout as string}
|
|
193
|
-
placeholderTextColor={Colors.brand.slate}
|
|
194
186
|
/>
|
|
195
187
|
</View>
|
|
196
188
|
:<></>}
|
|
197
189
|
|
|
198
|
-
<View nativeID="Max Tickets" style={{
|
|
199
|
-
<View style={{ flex:1, marginRight:5 }}>
|
|
200
|
-
<Text theme="
|
|
201
|
-
<Text style={{ marginTop:3 }} theme="
|
|
190
|
+
<View type='row' nativeID="Max Tickets" style={{ flexWrap:'wrap', padding:10, borderBottomWidth:1, borderBottomColor:Colors.borders.light }}>
|
|
191
|
+
<View style={{ flex:1, marginRight:5, minWidth:200 }}>
|
|
192
|
+
<Text theme="h1">Max Tickets</Text>
|
|
193
|
+
<Text style={{ marginTop:3 }} theme="description">Maximum number of tickets that can be sold</Text>
|
|
202
194
|
</View>
|
|
203
195
|
<TextInput
|
|
204
|
-
style={{
|
|
196
|
+
style={{ flex:1, textAlign:'center', width:100 }}
|
|
205
197
|
onChangeText={(text) => setDraftCompetition({ ...draft_competition, available_tickets: text })}
|
|
206
198
|
placeholder="100"
|
|
199
|
+
keyboardType="decimal-pad"
|
|
207
200
|
editable={competition.competition_season_id ? false : true}
|
|
208
201
|
value={draft_competition.available_tickets as string}
|
|
209
|
-
placeholderTextColor={Colors.brand.slate}
|
|
210
202
|
/>
|
|
211
203
|
</View>
|
|
212
204
|
</View>
|