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.
Files changed (109) hide show
  1. package/lib/commonjs/CompetitionManager/components/AthleteSelector.js +52 -75
  2. package/lib/commonjs/CompetitionManager/components/AthleteSelector.js.map +1 -1
  3. package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js +135 -119
  4. package/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.js.map +1 -1
  5. package/lib/commonjs/CompetitionManager/components/CompetitionHeader.js +69 -62
  6. package/lib/commonjs/CompetitionManager/components/CompetitionHeader.js.map +1 -1
  7. package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js +86 -91
  8. package/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
  9. package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js +143 -150
  10. package/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
  11. package/lib/commonjs/CompetitionManager/components/ContestSelector.js +57 -61
  12. package/lib/commonjs/CompetitionManager/components/ContestSelector.js.map +1 -1
  13. package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js +120 -266
  14. package/lib/commonjs/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
  15. package/lib/commonjs/CompetitionManager/components/MarketSelector.js +35 -32
  16. package/lib/commonjs/CompetitionManager/components/MarketSelector.js.map +1 -1
  17. package/lib/commonjs/CompetitionManager/components/PlayerSelector.js +42 -39
  18. package/lib/commonjs/CompetitionManager/components/PlayerSelector.js.map +1 -1
  19. package/lib/commonjs/CompetitionManager/index.js +47 -50
  20. package/lib/commonjs/CompetitionManager/index.js.map +1 -1
  21. package/lib/commonjs/MarketComponents/components/OrderBook.js +1 -0
  22. package/lib/commonjs/MarketComponents/components/OrderBook.js.map +1 -1
  23. package/lib/module/CompetitionManager/components/AthleteSelector.js +42 -65
  24. package/lib/module/CompetitionManager/components/AthleteSelector.js.map +1 -1
  25. package/lib/module/CompetitionManager/components/CompetitionContestsForm.js +93 -77
  26. package/lib/module/CompetitionManager/components/CompetitionContestsForm.js.map +1 -1
  27. package/lib/module/CompetitionManager/components/CompetitionHeader.js +47 -40
  28. package/lib/module/CompetitionManager/components/CompetitionHeader.js.map +1 -1
  29. package/lib/module/CompetitionManager/components/CompetitionInfoForm.js +59 -64
  30. package/lib/module/CompetitionManager/components/CompetitionInfoForm.js.map +1 -1
  31. package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js +108 -115
  32. package/lib/module/CompetitionManager/components/CompetitionSettingsForm.js.map +1 -1
  33. package/lib/module/CompetitionManager/components/ContestSelector.js +34 -38
  34. package/lib/module/CompetitionManager/components/ContestSelector.js.map +1 -1
  35. package/lib/module/CompetitionManager/components/ContestSettingsForm.js +90 -237
  36. package/lib/module/CompetitionManager/components/ContestSettingsForm.js.map +1 -1
  37. package/lib/module/CompetitionManager/components/MarketSelector.js +26 -23
  38. package/lib/module/CompetitionManager/components/MarketSelector.js.map +1 -1
  39. package/lib/module/CompetitionManager/components/PlayerSelector.js +30 -27
  40. package/lib/module/CompetitionManager/components/PlayerSelector.js.map +1 -1
  41. package/lib/module/CompetitionManager/index.js +32 -35
  42. package/lib/module/CompetitionManager/index.js.map +1 -1
  43. package/lib/module/MarketComponents/components/OrderBook.js +1 -0
  44. package/lib/module/MarketComponents/components/OrderBook.js.map +1 -1
  45. package/lib/typescript/lib/commonjs/CompetitionManager/components/AthleteSelector.d.ts.map +1 -1
  46. package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.d.ts +1 -2
  47. package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
  48. package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionHeader.d.ts.map +1 -1
  49. package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.d.ts +1 -2
  50. package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
  51. package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.d.ts +1 -2
  52. package/lib/typescript/lib/commonjs/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
  53. package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
  54. package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSettingsForm.d.ts +1 -2
  55. package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
  56. package/lib/typescript/lib/commonjs/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
  57. package/lib/typescript/lib/commonjs/CompetitionManager/components/PlayerSelector.d.ts.map +1 -1
  58. package/lib/typescript/lib/commonjs/CompetitionManager/index.d.ts +2 -1
  59. package/lib/typescript/lib/commonjs/CompetitionManager/index.d.ts.map +1 -1
  60. package/lib/typescript/lib/commonjs/MarketComponents/components/OrderBook.d.ts.map +1 -1
  61. package/lib/typescript/lib/module/CompetitionManager/components/AthleteSelector.d.ts +1 -2
  62. package/lib/typescript/lib/module/CompetitionManager/components/AthleteSelector.d.ts.map +1 -1
  63. package/lib/typescript/lib/module/CompetitionManager/components/CompetitionContestsForm.d.ts +2 -4
  64. package/lib/typescript/lib/module/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
  65. package/lib/typescript/lib/module/CompetitionManager/components/CompetitionHeader.d.ts +1 -2
  66. package/lib/typescript/lib/module/CompetitionManager/components/CompetitionHeader.d.ts.map +1 -1
  67. package/lib/typescript/lib/module/CompetitionManager/components/CompetitionInfoForm.d.ts +2 -4
  68. package/lib/typescript/lib/module/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
  69. package/lib/typescript/lib/module/CompetitionManager/components/CompetitionSettingsForm.d.ts +2 -4
  70. package/lib/typescript/lib/module/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
  71. package/lib/typescript/lib/module/CompetitionManager/components/ContestSelector.d.ts +1 -2
  72. package/lib/typescript/lib/module/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
  73. package/lib/typescript/lib/module/CompetitionManager/components/ContestSettingsForm.d.ts +2 -4
  74. package/lib/typescript/lib/module/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
  75. package/lib/typescript/lib/module/CompetitionManager/components/MarketSelector.d.ts +1 -2
  76. package/lib/typescript/lib/module/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
  77. package/lib/typescript/lib/module/CompetitionManager/components/PlayerSelector.d.ts +1 -2
  78. package/lib/typescript/lib/module/CompetitionManager/components/PlayerSelector.d.ts.map +1 -1
  79. package/lib/typescript/lib/module/CompetitionManager/index.d.ts +3 -3
  80. package/lib/typescript/lib/module/CompetitionManager/index.d.ts.map +1 -1
  81. package/lib/typescript/lib/module/MarketComponents/components/OrderBook.d.ts.map +1 -1
  82. package/lib/typescript/src/CompetitionManager/components/AthleteSelector.d.ts.map +1 -1
  83. package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts +1 -1
  84. package/lib/typescript/src/CompetitionManager/components/CompetitionContestsForm.d.ts.map +1 -1
  85. package/lib/typescript/src/CompetitionManager/components/CompetitionHeader.d.ts.map +1 -1
  86. package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts +1 -1
  87. package/lib/typescript/src/CompetitionManager/components/CompetitionInfoForm.d.ts.map +1 -1
  88. package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts +1 -1
  89. package/lib/typescript/src/CompetitionManager/components/CompetitionSettingsForm.d.ts.map +1 -1
  90. package/lib/typescript/src/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
  91. package/lib/typescript/src/CompetitionManager/components/ContestSettingsForm.d.ts +1 -1
  92. package/lib/typescript/src/CompetitionManager/components/ContestSettingsForm.d.ts.map +1 -1
  93. package/lib/typescript/src/CompetitionManager/components/MarketSelector.d.ts.map +1 -1
  94. package/lib/typescript/src/CompetitionManager/components/PlayerSelector.d.ts.map +1 -1
  95. package/lib/typescript/src/CompetitionManager/index.d.ts +7 -1
  96. package/lib/typescript/src/CompetitionManager/index.d.ts.map +1 -1
  97. package/lib/typescript/src/MarketComponents/components/OrderBook.d.ts.map +1 -1
  98. package/package.json +1 -1
  99. package/src/CompetitionManager/components/AthleteSelector.tsx +32 -52
  100. package/src/CompetitionManager/components/CompetitionContestsForm.tsx +82 -89
  101. package/src/CompetitionManager/components/CompetitionHeader.tsx +45 -37
  102. package/src/CompetitionManager/components/CompetitionInfoForm.tsx +36 -40
  103. package/src/CompetitionManager/components/CompetitionSettingsForm.tsx +88 -96
  104. package/src/CompetitionManager/components/ContestSelector.tsx +33 -36
  105. package/src/CompetitionManager/components/ContestSettingsForm.tsx +58 -179
  106. package/src/CompetitionManager/components/MarketSelector.tsx +19 -21
  107. package/src/CompetitionManager/components/PlayerSelector.tsx +23 -26
  108. package/src/CompetitionManager/index.tsx +22 -25
  109. package/src/MarketComponents/components/OrderBook.tsx +1 -0
@@ -1,9 +1,8 @@
1
1
  import React from 'react';
2
- import { View, Image } from 'react-native';
2
+ import { Alert, Image } from 'react-native';
3
3
  import type { CompetitionProps, CompetitionSummaryProps } from '../../types';
4
- import { Button, Text } from '../../Components';
5
- import Colors from '../../constants/colors';
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={{ backgroundColor:Colors.shades.white, flexGrow:1, minWidth:330, maxWidth:width }}>
44
- <View nativeID="competition_header" style={{ flexDirection:'row', alignItems:'center', padding:20, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
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='header'>{competition.competition_name}</Text>
54
- <Text style={{ marginTop:4 }} theme='header_2>'>{competition.competition_description}</Text>
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
- title_color={Colors.shades.white}
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={{ ...view_styles.section_header, backgroundColor:Colors.shades.shade100 }}>
69
- <View style={{ flex:1 }}>
70
- <Text theme='header'>COMPETITION IS PENDING</Text>
71
- <Text style={{ marginTop:3 }} theme='body'>Complete each section and press 'ACTIVATE'.</Text>
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
- title_color={Colors.shades.white}
78
- backgroundColor={Colors.utility.error}
75
+ type='error'
79
76
  onPress={async() => {
80
- const confirmed = await confirm(`Are you sure you would like to delete this competition? This cannot be undone.`)
81
- if(!confirmed){ return }
82
- onDelete();
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={{ ...view_styles.section_header, backgroundColor:Colors.shades.shade100 }}>
89
- <View style={{ flex:1 }}>
90
- <Text theme='header'>COMPETITION IS ACTIVE</Text>
91
- <Text style={{ marginTop:3 }} theme='body'>In order to edit this competition, you must first pause it.</Text>
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
- title_color={Colors.shades.white}
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={{ ...view_styles.section_header, backgroundColor:Colors.shades.shade100 }}>
105
- <View style={{ flex:1 }}>
106
- <Text theme='header'>EDITING COMPETITION</Text>
107
- <Text style={{ marginTop:3 }} theme='body'>Feel free to make changes. When done, simply press resume.</Text>
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
- title_color={Colors.shades.white}
115
- backgroundColor={Colors.utility.error}
117
+ type='error'
116
118
  onPress={async() => {
117
- const confirmed = await confirm(`Are you sure you would like to delete this competition? This cannot be undone.`)
118
- if(!confirmed){ return }
119
- onDelete();
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
- title_color={Colors.shades.white}
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 { View, TouchableOpacity, Image } from "react-native"
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 { Button, Icons, Switch, Text, TextInput } from '../../Components';
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, width, onCompetitionUpdate }:CompetitionInfoFormProps) => {
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={{ ...view_styles.section, flexGrow:1 }}>
30
- <TouchableOpacity style={{ ...view_styles.section_header, maxWidth:width}} onPress={() => setExpanded(!expanded)}>
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.utility.success} />
32
+ <Icons.CheckCirlceIcon size={16} color={Colors.text.success} />
33
33
  :
34
- <Icons.AlertIcon size={16} color={Colors.utility.warning} />
34
+ <Icons.AlertIcon size={16} color={Colors.text.warning} />
35
35
  }
36
- <View style={{ flex:1, marginLeft:10 }}>
37
- <Text theme='header'>Competition Information</Text>
38
- <Text style={{ marginTop:3 }} theme='body'>Manage the high level information of this competition</Text>
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
- padding={10}
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.brand.midnight} size={8} />
47
+ <Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.text.h1} size={8} />
50
48
  }
51
- </TouchableOpacity>
49
+ </Button>
52
50
  {expanded ?
53
- <View nativeID="competition_info" style={{ ...view_styles.section_body, padding:10, minWidth:300, maxWidth:width, backgroundColor:Colors.shades.shade100 }}>
51
+ <View type='body' nativeID="competition_info">
54
52
 
55
- <View nativeID="competition_image" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
56
- <View style={{ flex:1, margin:5, minWidth:200 }}>
57
- <Text theme='header_2'>Competition Image</Text>
58
- <Text style={{ marginTop:3 }} theme='body'>Give this competition an image so it is recognizable to those trying to join.</Text>
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.brand.electric} textAlign='center'>CHANGE</Text>
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={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
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='header_2'>Competition Name</Text>
76
- <Text style={{ marginTop:3 }} theme='body'>Give the competition a memorable name that aligns with the type and payout.</Text>
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={{ ...view_styles.input, flexGrow:1, margin:5 }}
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={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width, marginTop:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
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='header_2'>Competition Description</Text>
90
- <Text style={{ marginTop:3 }} theme='body'>Give the competition a memorable description that would entice users to participate.</Text>
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={{ ...view_styles.input, flexGrow:1, margin:5 }}
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={{ ...view_styles.body_row, flexWrap:'wrap', marginTop:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
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='header_2'>Make Private</Text>
103
- <Text style={{ marginTop:3 }} theme='body'>Only access this competition using an invite code.</Text>
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={{ ...view_styles.body_row, flexWrap:'wrap', marginTop:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
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='header_2'>Make Template</Text>
116
- <Text style={{ marginTop:3 }} theme='body'>This will allow for other users to copy this competition and create it for themselves.</Text>
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 { FlatList, TextInput, TouchableOpacity, View, Image } from "react-native"
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 Colors from "../../constants/colors";
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, width, competition, competition_result_types, onCompetitionUpdate, onShowPacers }: CompetitionSettingsFormProps) => {
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={{ ...view_styles.section, flexGrow:1 }}>
72
- <TouchableOpacity style={{ ...view_styles.section_header, maxWidth: width }} onPress={() => setExpanded(!expanded)}>
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.utility.success} />
62
+ <Icons.CheckCirlceIcon size={16} color={Colors.text.success} />
75
63
  :
76
- <Icons.AlertIcon size={16} color={Colors.utility.warning} />
64
+ <Icons.AlertIcon size={16} color={Colors.text.warning} />
77
65
  }
78
- <View style={{ flex:1, marginLeft:10 }}>
79
- <Text theme='header'>Competition Settings</Text>
80
- <Text style={{ marginTop:3 }} theme='body'>Manage the high level information of this competition</Text>
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
- padding={10}
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.brand.midnight} size={8} />
77
+ <Icons.ChevronIcon direction={expanded ? 'up' : 'down'} color={Colors.text.h1} size={8} />
92
78
  }
93
- </TouchableOpacity>
79
+ </Button>
94
80
  {expanded ?
95
- <View nativeID="competition_settings" style={{ ...view_styles.section_body, maxWidth:width, backgroundColor:Colors.shades.shade100 }}>
81
+ <View type='body' nativeID="competition_settings" style={{ flexGrow:1 }}>
96
82
 
97
-
98
- <View nativeID="competition_currency" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width}}>
99
- <View style={{ flex:1, margin:5, minWidth:200 }}>
100
- <Text theme="header_2">Competition Currency</Text>
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, backgroundColor:Colors.shades.white }}>
104
- <FlatList
105
- data={market_types}
106
- renderItem={renderMarketTypes}
107
- keyExtractor={(item) => item}
108
- horizontal
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={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width}}>
114
- <View style={{ flex:1, margin:5, minWidth:200 }}>
115
- <Text theme="header_2">Competition Payout Type</Text>
116
- <Text style={{ marginTop:3 }} theme="body">{competition_result_type?competition_result_type.description:'Choose the type of payout for this competition'}</Text>
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, backgroundColor:Colors.shades.white }}>
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
- <TouchableOpacity
135
- disabled={competition.competition_season_id ? true : false}
136
- style={{ backgroundColor:Colors.shades.white, borderRadius:8, padding:10 }} onPress={() => onShowPacers()}>
137
- {pacer ?
138
- <View style={{ ...view_styles.body_row }}>
139
- <Icons.PacerCarIcon size={24} color={Colors.brand.midnight} />
140
- <Image
141
- source={{ uri: pacer.profile_pic && pacer.profile_pic != '' ? pacer.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
142
- style={{ height:40, width:40, borderRadius:4, marginLeft:10 }}
143
- resizeMode="cover"
144
- />
145
- <View style={{ flex:1, marginLeft:10 }}>
146
- <Text theme="header_2">@{pacer.username}</Text>
147
- <Text style={{ marginTop:3 }} theme="body">Joined {moment(pacer.create_datetime).format('MMM YYYY')}</Text>
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
- <Icons.ChevronIcon direction="right" color={Colors.brand.midnight} size={8} />
150
- </View>
151
- :
152
- <View style={{ ...view_styles.body_row }}>
153
- <Icons.AlertIcon size={20} color={Colors.utility.warning} />
154
- <Image
155
- source={{ uri: 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
156
- style={{ height:40, width:40, borderRadius:4, marginLeft:10 }}
157
- resizeMode="cover"
158
- />
159
- <View style={{ flex:1, marginLeft:10 }}>
160
- <Text theme="header_2">Select A Pacer!</Text>
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
- <Icons.ChevronIcon direction="right" color={Colors.brand.midnight} size={8} />
163
- </View>
164
- }
165
- </TouchableOpacity>
154
+ }
155
+ </Button>
156
+ </View>
166
157
  :<></>}
167
- <View nativeID="buy_in" style={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width}}>
168
- <View style={{ flex:1, margin:5, minWidth:200 }}>
169
- <Text theme="header_2">Ticket Price</Text>
170
- <Text style={{ marginTop:3 }} theme="body">Set the amount required to purchase a ticket to participate</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={{ ...view_styles.input, textAlign:'center', margin:5, width:100, backgroundColor:Colors.shades.white }}
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={{ ...view_styles.body_row, flexWrap:'wrap', maxWidth:width}}>
183
- <View style={{ flex:1, margin:5, minWidth:200 }}>
184
- <Text theme="header_2">Guaranteed Payout</Text>
185
- <Text style={{ marginTop:3 }} theme="body">ADMIN ONLY - How much is guaranteed to be paid out?</Text>
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={{ ...view_styles.input, textAlign:'center', margin:5, width:100, backgroundColor:Colors.shades.white }}
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={{ flexDirection:'row', flexWrap:'wrap', padding:10, borderBottomWidth:1, borderBottomColor:Colors.shades.white }}>
199
- <View style={{ flex:1, marginRight:5 }}>
200
- <Text theme="header_2">Max Tickets</Text>
201
- <Text style={{ marginTop:3 }} theme="body">Maximum number of tickets that can be sold</Text>
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={{ ...view_styles.input, textAlign:'center', width:100, backgroundColor:Colors.shades.white }}
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>