be-components 2.0.0 → 2.0.2
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/Components/Icons.js +50 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/MarketComponents/api/index.js +50 -0
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/ContestStats.js +293 -0
- package/lib/commonjs/MarketComponents/components/ContestStats.js.map +1 -0
- package/lib/commonjs/MarketComponents/components/EventScoringCard.js +86 -0
- package/lib/commonjs/MarketComponents/components/EventScoringCard.js.map +1 -0
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +26 -6
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/commonjs/Poll/components/CampaignLeaderboard.js +21 -26
- package/lib/commonjs/Poll/components/CampaignLeaderboard.js.map +1 -1
- package/lib/commonjs/Poll/components/CampaignPlay.js +1 -7
- package/lib/commonjs/Poll/components/CampaignPlay.js.map +1 -1
- package/lib/commonjs/Poll/components/CampaignResult.js +1 -19
- package/lib/commonjs/Poll/components/CampaignResult.js.map +1 -1
- package/lib/commonjs/Poll/components/PollCard.js +87 -152
- package/lib/commonjs/Poll/components/PollCard.js.map +1 -1
- package/lib/commonjs/Poll/components/PollQuestionsSection.js +11 -3
- package/lib/commonjs/Poll/components/PollQuestionsSection.js.map +1 -1
- package/lib/commonjs/Poll/index.js +83 -14
- package/lib/commonjs/Poll/index.js.map +1 -1
- package/lib/module/Components/Icons.js +50 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/MarketComponents/api/index.js +50 -0
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/ContestStats.js +284 -0
- package/lib/module/MarketComponents/components/ContestStats.js.map +1 -0
- package/lib/module/MarketComponents/components/EventScoringCard.js +79 -0
- package/lib/module/MarketComponents/components/EventScoringCard.js.map +1 -0
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js +26 -6
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/module/Poll/components/CampaignLeaderboard.js +21 -26
- package/lib/module/Poll/components/CampaignLeaderboard.js.map +1 -1
- package/lib/module/Poll/components/CampaignPlay.js +1 -7
- package/lib/module/Poll/components/CampaignPlay.js.map +1 -1
- package/lib/module/Poll/components/CampaignResult.js +1 -20
- package/lib/module/Poll/components/CampaignResult.js.map +1 -1
- package/lib/module/Poll/components/PollCard.js +89 -154
- package/lib/module/Poll/components/PollCard.js.map +1 -1
- package/lib/module/Poll/components/PollQuestionsSection.js +11 -3
- package/lib/module/Poll/components/PollQuestionsSection.js.map +1 -1
- package/lib/module/Poll/index.js +85 -16
- package/lib/module/Poll/index.js.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +1 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts +4 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/ContestStats.d.ts +8 -0
- package/lib/typescript/src/MarketComponents/components/ContestStats.d.ts.map +1 -0
- package/lib/typescript/src/MarketComponents/components/EventScoringCard.d.ts +8 -0
- package/lib/typescript/src/MarketComponents/components/EventScoringCard.d.ts.map +1 -0
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
- package/lib/typescript/src/Poll/components/CampaignLeaderboard.d.ts.map +1 -1
- package/lib/typescript/src/Poll/components/CampaignPlay.d.ts.map +1 -1
- package/lib/typescript/src/Poll/components/CampaignResult.d.ts.map +1 -1
- package/lib/typescript/src/Poll/components/PollCard.d.ts +7 -6
- package/lib/typescript/src/Poll/components/PollCard.d.ts.map +1 -1
- package/lib/typescript/src/Poll/components/PollQuestionsSection.d.ts +1 -1
- package/lib/typescript/src/Poll/components/PollQuestionsSection.d.ts.map +1 -1
- package/lib/typescript/src/Poll/index.d.ts +3 -1
- package/lib/typescript/src/Poll/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Components/Icons.tsx +24 -0
- package/src/MarketComponents/api/index.ts +42 -1
- package/src/MarketComponents/components/ContestStats.tsx +194 -0
- package/src/MarketComponents/components/EventScoringCard.tsx +53 -0
- package/src/MarketComponents/components/TeamEventMarket/index.tsx +27 -4
- package/src/Poll/components/CampaignLeaderboard.tsx +7 -9
- package/src/Poll/components/CampaignPlay.tsx +2 -5
- package/src/Poll/components/CampaignResult.tsx +1 -20
- package/src/Poll/components/PollCard.tsx +75 -122
- package/src/Poll/components/PollQuestionsSection.tsx +6 -4
- package/src/Poll/index.tsx +64 -13
- package/src/types.d.ts +13 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, FlatList, TouchableOpacity, Image, ActivityIndicator } from 'react-native';
|
|
3
|
+
import type { AthleteProps, ContestStatProps, EventProps } from '../../types';
|
|
4
|
+
import { MarketComponentApi, MarketComponentHelpers } from '../api';
|
|
5
|
+
import { Button, Icons, Text } from '../../Components';
|
|
6
|
+
import EventScoringCard from './EventScoringCard';
|
|
7
|
+
import { view_styles } from '../../constants/styles';
|
|
8
|
+
import Colors from '../../constants/colors';
|
|
9
|
+
|
|
10
|
+
type ContestStatsCardProps = {
|
|
11
|
+
event:EventProps
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const ContestStatsCard = ({ event }:ContestStatsCardProps) => {
|
|
15
|
+
const [ show_stats, setShowStats ] = useState(false);
|
|
16
|
+
const [ card_data, setData ] = useState<{
|
|
17
|
+
loading:boolean,
|
|
18
|
+
contest_stats:ContestStatProps[],
|
|
19
|
+
athletes:AthleteProps[],
|
|
20
|
+
active_stat_label?:string,
|
|
21
|
+
active_team_id?:string,
|
|
22
|
+
}>({
|
|
23
|
+
loading:false,
|
|
24
|
+
contest_stats: [],
|
|
25
|
+
athletes: []
|
|
26
|
+
})
|
|
27
|
+
const { loading, contest_stats, athletes, active_stat_label, active_team_id } = card_data;
|
|
28
|
+
|
|
29
|
+
const home_team = event.home
|
|
30
|
+
const away_team = event.away
|
|
31
|
+
const away_athletes = athletes.filter(a => a.team_id == away_team?.team_id);
|
|
32
|
+
const home_athletes = athletes.filter(a => a.team_id == home_team?.team_id);
|
|
33
|
+
|
|
34
|
+
const unique_stats = [ ...new Set(contest_stats.map(s => s.stat_label)) ]
|
|
35
|
+
|
|
36
|
+
let filtered_stats = contest_stats.filter(s => s.stat_label == active_stat_label);
|
|
37
|
+
if(active_team_id == away_team?.team_id){
|
|
38
|
+
filtered_stats = filtered_stats.filter(s => away_athletes.map(a => a.athlete_id.toString()).includes(s.participant_id.toString()))
|
|
39
|
+
}
|
|
40
|
+
if(active_team_id == home_team?.team_id){
|
|
41
|
+
filtered_stats = filtered_stats.filter(s => home_athletes.map(a => a.athlete_id.toString()).includes(s.participant_id.toString()))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
console.log('gettin it!')
|
|
47
|
+
getDataFromServer(event.event_id)
|
|
48
|
+
},[event.event_id])
|
|
49
|
+
|
|
50
|
+
const getDataFromServer = async(contest_id:string) => {
|
|
51
|
+
const stats = await MarketComponentApi.getContestStatsByEvent(contest_id);
|
|
52
|
+
const active_stats = [ ...new Set(stats.map(s => s.stat_label)) ]
|
|
53
|
+
|
|
54
|
+
const athlete_ids = [ ...new Set(stats.filter(s => s.participant_type == 'athlete').map(s => s.participant_id)) ]
|
|
55
|
+
const ps = await MarketComponentApi.getAthletesByIds(athlete_ids)
|
|
56
|
+
setData({
|
|
57
|
+
...card_data,
|
|
58
|
+
athletes: ps,
|
|
59
|
+
contest_stats: stats,
|
|
60
|
+
active_stat_label: active_stats[0],
|
|
61
|
+
loading:false,
|
|
62
|
+
active_team_id:event.away_team_id
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const renderAthletes = (data: { item:ContestStatProps, index:number }) => {
|
|
67
|
+
const athlete = athletes.find(a => a.athlete_id == data.item.participant_id);
|
|
68
|
+
if(!athlete){ return <></> }
|
|
69
|
+
return (
|
|
70
|
+
<View style={{ ...view_styles.body_row, padding:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
71
|
+
<View style={{ flex:1 }}>
|
|
72
|
+
<Text theme='header_2'>{athlete.first_name} {athlete.last_name} ({athlete.position})</Text>
|
|
73
|
+
</View>
|
|
74
|
+
<Text theme='header_2'>{data.item.value}</Text>
|
|
75
|
+
</View>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const renderStatOptions = (data: { item:string, index:number }) => {
|
|
80
|
+
return (
|
|
81
|
+
<TouchableOpacity
|
|
82
|
+
style={{ ...view_styles.body_row, padding:10, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}
|
|
83
|
+
onPress={() => {
|
|
84
|
+
setData({ ...card_data, active_stat_label: data.item })
|
|
85
|
+
setShowStats(false)
|
|
86
|
+
}}>
|
|
87
|
+
<Text theme='header_2'>{MarketComponentHelpers.prettyKey(data.item)}</Text>
|
|
88
|
+
</TouchableOpacity>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
94
|
+
<View style={{ padding:10 }}>
|
|
95
|
+
<EventScoringCard
|
|
96
|
+
event={event}
|
|
97
|
+
/>
|
|
98
|
+
<View style={{ ...view_styles.body_row, marginTop:10, padding:0, borderWidth:3, borderColor:Colors.shades.shade100, borderRadius:22 }}>
|
|
99
|
+
{away_team?
|
|
100
|
+
<TouchableOpacity
|
|
101
|
+
style={{
|
|
102
|
+
flex:1,
|
|
103
|
+
padding:10,
|
|
104
|
+
flexDirection:'row',
|
|
105
|
+
alignItems:'center',
|
|
106
|
+
backgroundColor:active_team_id == away_team.team_id ? Colors.brand.midnight : Colors.shades.white,
|
|
107
|
+
borderRadius:22
|
|
108
|
+
}}
|
|
109
|
+
onPress={() => setData({ ...card_data, active_team_id:away_team.team_id })}
|
|
110
|
+
>
|
|
111
|
+
<View style={{ height:30, width:30, borderRadius:100, marginRight:10, backgroundColor:Colors.shades.white, justifyContent:'center', alignItems:'center' }}>
|
|
112
|
+
<Image
|
|
113
|
+
source={{ uri: away_team.image?.url }}
|
|
114
|
+
style={{ height:22, width:22, borderRadius:4 }}
|
|
115
|
+
resizeMode='cover'
|
|
116
|
+
/>
|
|
117
|
+
</View>
|
|
118
|
+
<Text style={{ flex:1, marginRight:30 }} textAlign='center' size={12} color={active_team_id == away_team.team_id ? Colors.shades.white : Colors.brand.midnight} weight={active_team_id == away_team.team_id ? 'bold' : 'regular'}>{away_team.abbr}</Text>
|
|
119
|
+
</TouchableOpacity>
|
|
120
|
+
:<></>}
|
|
121
|
+
{home_team ?
|
|
122
|
+
<TouchableOpacity
|
|
123
|
+
style={{
|
|
124
|
+
flex:1,
|
|
125
|
+
padding:10,
|
|
126
|
+
flexDirection:'row',
|
|
127
|
+
alignItems:'center',
|
|
128
|
+
backgroundColor:active_team_id == home_team.team_id ? Colors.brand.midnight : Colors.shades.white,
|
|
129
|
+
borderRadius:22
|
|
130
|
+
}}
|
|
131
|
+
onPress={() => setData({ ...card_data, active_team_id:home_team.team_id })}
|
|
132
|
+
>
|
|
133
|
+
<View style={{ height:30, width:30, borderRadius:100, marginRight:10, backgroundColor:Colors.shades.white, justifyContent:'center', alignItems:'center' }}>
|
|
134
|
+
<Image
|
|
135
|
+
source={{ uri: home_team.image?.url }}
|
|
136
|
+
style={{ height:22, width:22, borderRadius:4 }}
|
|
137
|
+
resizeMode='cover'
|
|
138
|
+
/>
|
|
139
|
+
</View>
|
|
140
|
+
<Text style={{ flex:1, marginRight:30 }} textAlign='center' size={12} color={active_team_id == home_team.team_id ? Colors.shades.white : Colors.brand.midnight} weight={active_team_id == home_team.team_id ? 'bold' : 'regular'}>{home_team.abbr}</Text>
|
|
141
|
+
</TouchableOpacity>
|
|
142
|
+
:<></>}
|
|
143
|
+
</View>
|
|
144
|
+
<View style={{ ...view_styles.body_row, borderTopRightRadius:8, borderTopLeftRadius:8, backgroundColor:Colors.shades.shade100, marginTop:5, marginBottom:5 }}>
|
|
145
|
+
<View style={{ flex:1 }}>
|
|
146
|
+
<Text theme='header'>Box Score</Text>
|
|
147
|
+
</View>
|
|
148
|
+
<TouchableOpacity style={{ padding:10, borderWidth:1, borderColor:Colors.brand.electric, borderRadius:8, flexDirection:'row', alignItems:'center' }}
|
|
149
|
+
onPress={() => setShowStats(!show_stats)}
|
|
150
|
+
>
|
|
151
|
+
<Text style={{ marginRight:8 }} size={12} color={Colors.brand.electric}>{active_stat_label ? MarketComponentHelpers.prettyKey(active_stat_label) : 'Select'}</Text>
|
|
152
|
+
<Icons.ChevronIcon size={8} direction={show_stats ? 'up' : 'down'} color={Colors.brand.electric} />
|
|
153
|
+
</TouchableOpacity>
|
|
154
|
+
{show_stats ?
|
|
155
|
+
<View style={{ position:'absolute', bottom:0, right:0, backgroundColor:Colors.shades.white, ...view_styles.float, minWidth:250, borderRadius:8, borderWidth:1, borderColor:Colors.shades.shade600, maxHeight: 250 }}>
|
|
156
|
+
<View style={{ ...view_styles.section_header, backgroundColor:Colors.shades.shade100 }}>
|
|
157
|
+
<View style={{ flex:1 }}>
|
|
158
|
+
<Text theme='header'>Select Stat</Text>
|
|
159
|
+
</View>
|
|
160
|
+
<Button
|
|
161
|
+
title='X'
|
|
162
|
+
backgroundColor={Colors.shades.white}
|
|
163
|
+
borderWidth={1}
|
|
164
|
+
title_color={Colors.utility.error}
|
|
165
|
+
borderRadius={8}
|
|
166
|
+
borderColor={Colors.utility.error}
|
|
167
|
+
onPress={() => setShowStats(false)}
|
|
168
|
+
/>
|
|
169
|
+
</View>
|
|
170
|
+
<FlatList
|
|
171
|
+
data={unique_stats}
|
|
172
|
+
renderItem={renderStatOptions}
|
|
173
|
+
keyExtractor={(item) => item}
|
|
174
|
+
|
|
175
|
+
/>
|
|
176
|
+
</View>
|
|
177
|
+
:<></>}
|
|
178
|
+
</View>
|
|
179
|
+
{loading ?
|
|
180
|
+
<ActivityIndicator style={{ padding:10, alignSelf:'center' }} color={Colors.brand.midnight} size='large' />
|
|
181
|
+
:<></>}
|
|
182
|
+
<FlatList
|
|
183
|
+
data={filtered_stats.sort((a,b) => b.value - a.value)}
|
|
184
|
+
renderItem={renderAthletes}
|
|
185
|
+
keyExtractor={(item) => `${item.stat}:${item.participant_id}`}
|
|
186
|
+
/>
|
|
187
|
+
</View>
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
</View>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export default ContestStatsCard
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Image, View } from "react-native"
|
|
2
|
+
import { view_styles } from "../../constants/styles"
|
|
3
|
+
import { Text } from "../../Components"
|
|
4
|
+
import type { EventProps } from "../../types"
|
|
5
|
+
import React from "react"
|
|
6
|
+
|
|
7
|
+
type EventScoringCardProps = {
|
|
8
|
+
event:EventProps
|
|
9
|
+
}
|
|
10
|
+
const EventScoringCard = ({ event }:EventScoringCardProps) => {
|
|
11
|
+
const overtime_occurred = event.event_scoring && event.event_scoring.length > 4 ? true : false;
|
|
12
|
+
if(!event.event_scoring){ return <></> }
|
|
13
|
+
return (
|
|
14
|
+
<View>
|
|
15
|
+
<View style={view_styles.body_row}>
|
|
16
|
+
<Image
|
|
17
|
+
source={{ uri: event.away?.image?.url }}
|
|
18
|
+
style={{ height:20, width:20, borderRadius:4, marginRight:5 }}
|
|
19
|
+
resizeMode="cover"
|
|
20
|
+
/>
|
|
21
|
+
<Text style={{ flex:1 }} theme="body">{event.away?.abbr}</Text>
|
|
22
|
+
<View style={{ flex:1, flexDirection:'row', alignItems:'center' }}>
|
|
23
|
+
{event.event_scoring.sort((a,b) => a.period - b.period).map(s => {
|
|
24
|
+
return (
|
|
25
|
+
<View style={{ flex:1 }}>
|
|
26
|
+
<Text theme={overtime_occurred && s.period == 4 ? 'error_header_2': 'header_2'}>{s.away_cumulative_score}</Text>
|
|
27
|
+
</View>
|
|
28
|
+
)
|
|
29
|
+
})}
|
|
30
|
+
</View>
|
|
31
|
+
</View>
|
|
32
|
+
<View style={view_styles.body_row}>
|
|
33
|
+
<Image
|
|
34
|
+
source={{ uri: event.home?.image?.url }}
|
|
35
|
+
style={{ height:20, width:20, borderRadius:4, marginRight:5 }}
|
|
36
|
+
resizeMode="cover"
|
|
37
|
+
/>
|
|
38
|
+
<Text style={{ flex:1 }} theme="body">{event.home?.abbr}</Text>
|
|
39
|
+
<View style={{ flex:1, flexDirection:'row', alignItems:'center' }}>
|
|
40
|
+
{event.event_scoring.map(s => {
|
|
41
|
+
return (
|
|
42
|
+
<View style={{ flex:1 }}>
|
|
43
|
+
<Text theme={overtime_occurred && s.period == 4 ? 'error_header_2': 'header_2'}>{s.home_cumulative_score}</Text>
|
|
44
|
+
</View>
|
|
45
|
+
)
|
|
46
|
+
})}
|
|
47
|
+
</View>
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default EventScoringCard
|
|
@@ -14,6 +14,7 @@ import { MarketButtonHelpers } from '../MarketButton/api';
|
|
|
14
14
|
import LinearGradient from 'react-native-linear-gradient';
|
|
15
15
|
import { useIsInViewport } from '../../../Components/ViewportObserver';
|
|
16
16
|
import type { BEEventProps } from '../../../Observer/api/types';
|
|
17
|
+
import ContestStatsCard from '../ContestStats';
|
|
17
18
|
|
|
18
19
|
type TeamEventMarketProps = {
|
|
19
20
|
event:EventProps,
|
|
@@ -50,6 +51,7 @@ const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, comp
|
|
|
50
51
|
expanded:false,
|
|
51
52
|
athletes:[]
|
|
52
53
|
})
|
|
54
|
+
const [ show_stats, setShowStats ] = useState(false);
|
|
53
55
|
const [ sponsor, setSponsor ] = useState<CompanyProps|undefined>(undefined);
|
|
54
56
|
const [ competitions_expanded, setCompetitionsExpanded ] = useState(false);
|
|
55
57
|
const { expanded, athletes, loaded, loading } = expanded_data;
|
|
@@ -314,10 +316,24 @@ const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, comp
|
|
|
314
316
|
}
|
|
315
317
|
<View nativeID='primary_markets' style={{ flexDirection:'row' }}>
|
|
316
318
|
<View nativeID='team_details' style={{ flex:1, padding:5, paddingRight:0 }}>
|
|
317
|
-
<
|
|
318
|
-
|
|
319
|
-
<
|
|
320
|
-
|
|
319
|
+
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center', marginTop:5, marginBottom:5, marginLeft:10 }} onPress={() => setShowStats(!show_stats)}>
|
|
320
|
+
{show_stats ?
|
|
321
|
+
<Button
|
|
322
|
+
title='X'
|
|
323
|
+
title_size={10}
|
|
324
|
+
padding={0}
|
|
325
|
+
style={{ marginRight:5 }}
|
|
326
|
+
disabled={true}
|
|
327
|
+
title_color={Colors.utility.error}
|
|
328
|
+
onPress={() => console.log('')}
|
|
329
|
+
/>
|
|
330
|
+
:<></>}
|
|
331
|
+
{!show_stats ?
|
|
332
|
+
<View style={{ marginRight:5, height:10, width:10, borderRadius:100, backgroundColor:event_status=='active'?Colors.utility.success:event_status=='inactive'?Colors.brand.electric:Colors.utility.error }} />
|
|
333
|
+
:<></>}
|
|
334
|
+
|
|
335
|
+
<Text size={12} color={show_stats ? Colors.utility.error : Colors.brand.electric}>{show_stats ? 'Hide Boxscore': `${TeamEventMarketHelpers.getTimeDetail(event)}`}</Text>
|
|
336
|
+
</TouchableOpacity>
|
|
321
337
|
<View nativeID='away_details' style={{ ...view_styles.body_row, minHeight:48 }}>
|
|
322
338
|
<Image
|
|
323
339
|
source={{ uri: event.away.image?.url }}
|
|
@@ -476,6 +492,13 @@ const TeamEventMarket = ({ event, init_expanded, show_id, activate_loading, comp
|
|
|
476
492
|
/>
|
|
477
493
|
</View>
|
|
478
494
|
:<></>}
|
|
495
|
+
{show_stats ?
|
|
496
|
+
<View style={{ borderTopWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
497
|
+
<ContestStatsCard
|
|
498
|
+
event={event}
|
|
499
|
+
/>
|
|
500
|
+
</View>
|
|
501
|
+
:<></>}
|
|
479
502
|
</View>
|
|
480
503
|
)
|
|
481
504
|
}
|
|
@@ -72,7 +72,7 @@ const CampaignLeaderboard = ({ poll_campaign, height, view_mode, onShowFullLeade
|
|
|
72
72
|
const player = players.find(p => p.player_id == data.item.player_id);
|
|
73
73
|
if(!player){ return <></> }
|
|
74
74
|
return (
|
|
75
|
-
<View style={{ flexDirection:'row', alignItems:'center', margin:4, padding:
|
|
75
|
+
<View style={{ flexDirection:'row', alignItems:'center', margin:4, padding:5, borderRadius:22, backgroundColor:Colors.shades.white, borderWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
76
76
|
<View nativeID="place" style={{ margin:5, height:20, width:20, justifyContent:'center', alignItems:'center', borderRadius:100, borderWidth:1, borderColor:Colors.brand.slate }}>
|
|
77
77
|
<Text size={10} color={Colors.brand.midnight} weight='bold' textAlign="center">{offset > 0 ? offset:''}{data.index+1}</Text>
|
|
78
78
|
</View>
|
|
@@ -80,7 +80,7 @@ const CampaignLeaderboard = ({ poll_campaign, height, view_mode, onShowFullLeade
|
|
|
80
80
|
<View nativeID="profile_pic" style={{ marginRight:10 }}>
|
|
81
81
|
<Image
|
|
82
82
|
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1689262384/default-avatar_bbkn2t.png' }}
|
|
83
|
-
style={{ height:
|
|
83
|
+
style={{ height:35, width:35, borderRadius:100 }}
|
|
84
84
|
resizeMode='cover'
|
|
85
85
|
/>
|
|
86
86
|
</View>
|
|
@@ -99,16 +99,14 @@ const CampaignLeaderboard = ({ poll_campaign, height, view_mode, onShowFullLeade
|
|
|
99
99
|
return (
|
|
100
100
|
<View style={{ flex:1, height:height, backgroundColor:Colors.shades.shade100 }}>
|
|
101
101
|
{my_leader && me ?
|
|
102
|
-
<View nativeID="my_results">
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<Text size={10} color={Colors.brand.midnight} weight='bold' textAlign="center">{my_leader.place}</Text>
|
|
106
|
-
</View>
|
|
102
|
+
<View nativeID="my_results" style={{ backgroundColor:Colors.brand.midnight, padding:10 }}>
|
|
103
|
+
<Text style={{ padding:10 }} size={14} color={Colors.shades.white} weight='bold'>My Results</Text>
|
|
104
|
+
<View style={{ flexDirection:'row', alignItems:'center', margin:4, padding:5, borderRadius:22, backgroundColor:Colors.shades.white }}>
|
|
107
105
|
<View nativeID="player" style={{ flex:1, flexDirection:'row', alignItems:'center' }}>
|
|
108
106
|
<View nativeID="profile_pic" style={{ marginRight:10 }}>
|
|
109
107
|
<Image
|
|
110
108
|
source={{ uri: me.profile_pic && me.profile_pic != '' ? me.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1689262384/default-avatar_bbkn2t.png' }}
|
|
111
|
-
style={{ height:
|
|
109
|
+
style={{ height:35, width:35, borderRadius:100 }}
|
|
112
110
|
resizeMode='cover'
|
|
113
111
|
/>
|
|
114
112
|
</View>
|
|
@@ -123,7 +121,7 @@ const CampaignLeaderboard = ({ poll_campaign, height, view_mode, onShowFullLeade
|
|
|
123
121
|
</View>
|
|
124
122
|
</View>
|
|
125
123
|
:<></>}
|
|
126
|
-
<ScrollView style={{flex:1}}>
|
|
124
|
+
<ScrollView style={{flex:1, padding:10}}>
|
|
127
125
|
{loading ?
|
|
128
126
|
<ActivityIndicator size='large' color={Colors.brand.midnight} style={{ padding:10, alignSelf:'center' }} />
|
|
129
127
|
:<></>}
|
|
@@ -292,7 +292,7 @@ const CampaignPlay = ({ player_id, poll_campaign_id, onActiveViewChange, onReque
|
|
|
292
292
|
: active_view == 'respond_poll' && active_poll ?
|
|
293
293
|
<View nativeID='respond_poll' style={{ flex:1 }}>
|
|
294
294
|
<PollCard
|
|
295
|
-
|
|
295
|
+
poll_id={active_poll.poll_id}
|
|
296
296
|
view={init_view == 'result' ? 'result' : 'play'}
|
|
297
297
|
question_number={active_index + 1}
|
|
298
298
|
onShowAuthenticate={() => {
|
|
@@ -306,10 +306,7 @@ const CampaignPlay = ({ player_id, poll_campaign_id, onActiveViewChange, onReque
|
|
|
306
306
|
}}
|
|
307
307
|
total_questions={playable_polls.length}
|
|
308
308
|
onSkip={() => handleSkip()}
|
|
309
|
-
|
|
310
|
-
if(campaign_complete){ return setActiveView('campaign_results') }
|
|
311
|
-
return handleSkip()
|
|
312
|
-
}}
|
|
309
|
+
|
|
313
310
|
onCancel={() => {
|
|
314
311
|
setActivePoll(undefined)
|
|
315
312
|
setActiveView('select_poll')
|
|
@@ -12,7 +12,7 @@ type CampaignResultProps = {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const CampaignResult = ({ poll_campaign, onShowFullLeaderboard } : CampaignResultProps) => {
|
|
15
|
-
const [ expanded, setExpanded ] = useState(
|
|
15
|
+
const [ expanded, setExpanded ] = useState(false);
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<View style={{ flex:1, ...view_styles.section }}>
|
|
@@ -37,23 +37,4 @@ const CampaignResult = ({ poll_campaign, onShowFullLeaderboard } : CampaignResul
|
|
|
37
37
|
)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
/*
|
|
42
|
-
<View style={{ borderRadius:22, backgroundColor:Colors.highlights.highlight200Faded, padding:10, marginTop:10 }}>
|
|
43
|
-
<TouchableOpacity style={{ flexDirection:'row', alignItems:'center' }} onPress={() => setPointsExpanded(!points_expanded)}>
|
|
44
|
-
<View style={{ flexDirection:'row', alignItems:'center', flex:1 }}>
|
|
45
|
-
<Icons.AlertIcon color={Colors.brand.midnight} size={14}/>
|
|
46
|
-
<Text style={{ marginLeft:5 }} size={14} color={Colors.brand.midnight} weight='semibold'>How are points calculated?</Text>
|
|
47
|
-
</View>
|
|
48
|
-
<Icons.ChevronIcon direction={points_expanded ? 'up' : 'down'} color={Colors.brand.midnight}/>
|
|
49
|
-
</TouchableOpacity>
|
|
50
|
-
{points_expanded ?
|
|
51
|
-
<View>
|
|
52
|
-
<Text size={12} color={Colors.brand.midnight} style={{ marginTop:10 }} weight='regular'>Points are calculated based on the total responses by all participants. Each response is worth 1 point. The responders that selected the winning option will split the total point pool.</Text>
|
|
53
|
-
<Text size={12} color={Colors.brand.midnight} style={{ marginTop:5 }} weight='regular'>Therefore, points earned will not be updated until the question is closed!</Text>
|
|
54
|
-
</View>
|
|
55
|
-
:<></>}
|
|
56
|
-
</View>
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
40
|
export default CampaignResult
|