From 3132c79c88fc695539bcaee29eb699a96bbe8d9b Mon Sep 17 00:00:00 2001 From: Mario Muniz Date: Fri, 1 Jun 2018 15:27:53 -0700 Subject: [PATCH] Add fix for missing talk titles for Keynotes; Fix duplicate labels for Keynote talks; Add fix for missing speakers for regular talks --- .../specialEvents/SpecialEventsDetailView.js | 150 +++++++++--------- app/views/specialEvents/SpecialEventsItem.js | 3 - 2 files changed, 79 insertions(+), 74 deletions(-) diff --git a/app/views/specialEvents/SpecialEventsDetailView.js b/app/views/specialEvents/SpecialEventsDetailView.js index dd2462bfb..90cc8eaef 100644 --- a/app/views/specialEvents/SpecialEventsDetailView.js +++ b/app/views/specialEvents/SpecialEventsDetailView.js @@ -1,40 +1,82 @@ -import React from 'react'; +import React from 'react' import { View, Text, ScrollView, StyleSheet, -} from 'react-native'; -import { connect } from 'react-redux'; -import Icon from 'react-native-vector-icons/Ionicons'; -import moment from 'moment'; - -import Touchable from '../common/Touchable'; -import css from '../../styles/css'; -import logger from '../../util/logger'; -import { gotoNavigationApp, getHumanizedDuration, platformIOS } from '../../util/general'; +} from 'react-native' +import { connect } from 'react-redux' +import Icon from 'react-native-vector-icons/Ionicons' +import moment from 'moment' + +import Touchable from '../common/Touchable' +import css from '../../styles/css' +import logger from '../../util/logger' +import { gotoNavigationApp, getHumanizedDuration, platformIOS } from '../../util/general' import { COLOR_DGREY, COLOR_MGREY, COLOR_PRIMARY, COLOR_BLACK, COLOR_YELLOW, -} from '../../styles/ColorConstants'; -import { - WINDOW_WIDTH -} from '../../styles/LayoutConstants'; +} from '../../styles/ColorConstants' +import { WINDOW_WIDTH } from '../../styles/LayoutConstants' class SpecialEventsDetailView extends React.Component { + static removeSession(remove, id, title) { + remove(id) + logger.trackEvent('Special Events', 'Session Removed: ' + title) + } + + static addSession(add, id, title) { + add(id) + logger.trackEvent('Special Events', 'Session Added: ' + title) + } + componentDidMount() { - const { navigation } = this.props; - const { data, title } = navigation.state.params; + const { navigation } = this.props + const { data } = navigation.state.params - logger.ga('View Loaded: SpecialEvents Detail: ' + data['talk-title']); + logger.ga('View Loaded: SpecialEvents Detail: ' + data['talk-title']) } render() { - const { navigation, saved } = this.props; - const { data, add, remove } = navigation.state.params; + const { navigation, saved } = this.props + const { data, add, remove } = navigation.state.params + + // Talk Description + let talkDescription = null + if (data['full-description'].length > 0) { + talkDescription = ( + + {data['full-description']} + + ) + } + else if (data.speakers) { + talkDescription = ( + data.speakers.map((object, i) => ( + + {object['sub-talk-title']} + {object.name} + {object.position} + + )) + ) + } + + // Speaker(s) Info + let speakersInfoElement = null + if (data['speaker-shortdesc']) { + speakersInfoElement = ( + + Hosted By + + {data['speaker-shortdesc']} + + + ) + } return ( @@ -42,20 +84,21 @@ class SpecialEventsDetailView extends React.Component { ( isSaved(saved, data.id) ? ( - this.removeSession(remove, data.id, data['talk-title']) + SpecialEventsDetailView.removeSession(remove, data.id, data['talk-title']) ) : ( - this.addSession(add, data.id, data['talk-title']) + SpecialEventsDetailView.addSession(add, data.id, data['talk-title']) ) - )}> + )} + > { isSaved(saved, data.id) ? ( @@ -68,9 +111,6 @@ class SpecialEventsDetailView extends React.Component { { data.label ? ( {data.label} ) : null } - { data['talk-type'] === 'Keynote' ? ( - {data['talk-type']} - ) : null } { data.label || data['talk-type'] === 'Keynote' ? ( - ) : null } @@ -84,13 +124,11 @@ class SpecialEventsDetailView extends React.Component { {data.location} - {moment(Number(data['start-time'])).format('MMM Do YYYY, h:mm a')} - - {data['full-description']} - + {talkDescription} {(data.directions && data.directions.latitude && data.directions.longitude) ? ( gotoNavigationApp(data.directions.latitude, data.directions.longitude)} > @@ -99,57 +137,27 @@ class SpecialEventsDetailView extends React.Component { ) : null } - - - {data.speakers ? ( - - Hosted By - {data.speakers.map((object, i) => ( - - {object.name} - {object.position} - {/*{object['sub-talk-title']}*/} - - ))} - - ) : null } + {speakersInfoElement} - ); - } - - removeSession(remove, id, title) { - remove(id); - logger.trackEvent('Special Events', 'Session Removed: ' + title) - } - - addSession(add, id, title) { - add(id); - logger.trackEvent('Special Events', 'Session Added: ' + title) + ) } - -}; +} function isSaved(savedArray, id) { if (Array.isArray(savedArray)) { for ( let i = 0; i < savedArray.length; ++i) { if (savedArray[i] === id) { - return true; + return true } } } - return false; + return false } -const mapStateToProps = (state) => ( - { - saved: state.specialEvents.saved - } -); +const mapStateToProps = state => ({ saved: state.specialEvents.saved }) -const ActualSpecialEventsDetailView = connect( - mapStateToProps -)(SpecialEventsDetailView); +const ActualSpecialEventsDetailView = connect(mapStateToProps)(SpecialEventsDetailView) const styles = StyleSheet.create({ detailContainer: { width: WINDOW_WIDTH, padding: 12 }, @@ -162,7 +170,7 @@ const styles = StyleSheet.create({ speakerContainer: { marginTop: 2 }, speakerName: { fontSize: 14, fontWeight: 'bold', color: COLOR_PRIMARY, marginTop: 10 }, speakerPosition: { fontSize: 10, marginTop: 2 }, - speakerSubTalkTitle: { fontSize: 10, marginTop: 2 }, + speakerSubTalkTitle: { fontSize: 14, fontWeight: 'bold', marginTop: 10 }, starButton: { width: 50, position: 'absolute', top: 2, right: -5, zIndex: 10 }, starButtonInner: { justifyContent: 'flex-start', alignItems: 'center' }, starOuterIcon: { color: COLOR_DGREY, position: platformIOS() ? 'absolute' : 'relative', zIndex: 10, backgroundColor: 'transparent' }, @@ -170,6 +178,6 @@ const styles = StyleSheet.create({ sed_dir: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', borderTopWidth: 1, borderTopColor: COLOR_MGREY, marginTop: 16, paddingVertical: 6 }, sed_dir_label: { flex: 1, fontSize: 22, color: COLOR_PRIMARY }, sed_dir_icon: { color: COLOR_PRIMARY, alignSelf: 'flex-end' }, -}); +}) -export default ActualSpecialEventsDetailView; +export default ActualSpecialEventsDetailView diff --git a/app/views/specialEvents/SpecialEventsItem.js b/app/views/specialEvents/SpecialEventsItem.js index b0eff4023..e52884a9b 100644 --- a/app/views/specialEvents/SpecialEventsItem.js +++ b/app/views/specialEvents/SpecialEventsItem.js @@ -42,9 +42,6 @@ const SpecialEventsItem = ({ navigation, specialEventsData, saved, add, remove, { specialEventsData.label ? ( {specialEventsData.label} ) : null } - { specialEventsData['talk-type'] === 'Keynote' ? ( - {specialEventsData['talk-type']} - ) : null } { specialEventsData.label || specialEventsData['talk-type'] === 'Keynote' ? ( - ) : null }