Skip to content

Commit

Permalink
Add fix for missing talk titles for Keynotes; Fix duplicate labels fo…
Browse files Browse the repository at this point in the history
…r Keynote talks; Add fix for missing speakers for regular talks
  • Loading branch information
Mario Muniz committed Jun 1, 2018
1 parent 0609773 commit 3132c79
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 74 deletions.
150 changes: 79 additions & 71 deletions app/views/specialEvents/SpecialEventsDetailView.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,104 @@
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 = (
<Text style={styles.sessionDesc}>
{data['full-description']}
</Text>
)
}
else if (data.speakers) {
talkDescription = (
data.speakers.map((object, i) => (
<View style={styles.speakerContainer} key={String(object.name) + String(i)}>
<Text style={styles.speakerSubTalkTitle}>{object['sub-talk-title']}</Text>
<Text style={styles.speakerName}>{object.name}</Text>
<Text style={styles.speakerPosition}>{object.position}</Text>
</View>
))
)
}

// Speaker(s) Info
let speakersInfoElement = null
if (data['speaker-shortdesc']) {
speakersInfoElement = (
<View>
<Text style={styles.hostedBy}>Hosted By</Text>
<View style={styles.speakerContainer}>
<Text style={styles.speakerName}>{data['speaker-shortdesc']}</Text>
</View>
</View>
)
}

return (
<ScrollView style={css.scroll_default} contentContainerStyle={css.main_full}>
<View style={styles.detailContainer}>
<View style={styles.starButton}>
<Touchable onPress={() => (
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'])
)
)}>
)}
>
<View style={styles.starButtonInner}>
<Icon
name={'ios-star-outline'}
name="ios-star-outline"
size={32}
style={styles.starOuterIcon}
/>
{ isSaved(saved, data.id) ? (
<Icon
name={'ios-star'}
name="ios-star"
size={26}
style={styles.starInnerIcon}
/>
Expand All @@ -68,9 +111,6 @@ class SpecialEventsDetailView extends React.Component {
{ data.label ? (
<Text style={[styles.labelText, { color: data['label-theme'] ? data['label-theme'] : COLOR_BLACK }]}>{data.label}</Text>
) : null }
{ data['talk-type'] === 'Keynote' ? (
<Text style={styles.labelText}>{data['talk-type']}</Text>
) : null }
{ data.label || data['talk-type'] === 'Keynote' ? (
<Text style={styles.labelText}> - </Text>
) : null }
Expand All @@ -84,13 +124,11 @@ class SpecialEventsDetailView extends React.Component {
{data.location} - {moment(Number(data['start-time'])).format('MMM Do YYYY, h:mm a')}
</Text>

<Text style={styles.sessionDesc}>
{data['full-description']}
</Text>
{talkDescription}

{(data.directions && data.directions.latitude && data.directions.longitude) ? (
<Touchable
underlayColor={'rgba(200,200,200,.1)'}
underlayColor="rgba(200,200,200,.1)"
onPress={() => gotoNavigationApp(data.directions.latitude, data.directions.longitude)}
>
<View style={styles.sed_dir}>
Expand All @@ -99,57 +137,27 @@ class SpecialEventsDetailView extends React.Component {
</View>
</Touchable>
) : null }


{data.speakers ? (
<View>
<Text style={styles.hostedBy}>Hosted By</Text>
{data.speakers.map((object, i) => (
<View style={styles.speakerContainer} key={i}>
<Text style={styles.speakerName}>{object.name}</Text>
<Text style={styles.speakerPosition}>{object.position}</Text>
{/*<Text style={styles.speakerSubTalkTitle}>{object['sub-talk-title']}</Text>*/}
</View>
))}
</View>
) : null }
{speakersInfoElement}
</View>
</ScrollView>
);
}

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 },
Expand All @@ -162,14 +170,14 @@ 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' },
starInnerIcon: { color: COLOR_YELLOW, position: 'absolute', zIndex: platformIOS() ? 5 : 15, marginTop: 3 },
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
3 changes: 0 additions & 3 deletions app/views/specialEvents/SpecialEventsItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ const SpecialEventsItem = ({ navigation, specialEventsData, saved, add, remove,
{ specialEventsData.label ? (
<Text style={[styles.labelText, { color: specialEventsData['label-theme'] ? specialEventsData['label-theme'] : COLOR_BLACK }]}>{specialEventsData.label}</Text>
) : null }
{ specialEventsData['talk-type'] === 'Keynote' ? (
<Text style={styles.labelText}>{specialEventsData['talk-type']}</Text>
) : null }
{ specialEventsData.label || specialEventsData['talk-type'] === 'Keynote' ? (
<Text style={styles.labelText}> - </Text>
) : null }
Expand Down

0 comments on commit 3132c79

Please sign in to comment.