-
Notifications
You must be signed in to change notification settings - Fork 52
/
index.js
126 lines (114 loc) · 4.68 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
var Container = require('react-container');
var Sentry = require('react-sentry');
var React = require('react');
var { animation, Link, Transitions } = require('../../touchstone');
var Social = require('../../mixins/social')
var Section = require('./section');
var EventEmitter = require('events').EventEmitter;
var emitter = new EventEmitter();
const scrollable = Container.initScrollable();
module.exports = React.createClass({
displayName: 'ViewMe',
contextTypes: { dataStore: React.PropTypes.object.isRequired },
mixins: [Sentry(), Transitions, Social, animation.Mixins.ScrollContainerToTop],
statics: {
navigationBar: 'main',
getNavigation (props) {
var name = props.me && props.me.name
return {
leftIcon: 'ion-android-menu',
leftAction: emitter.emit.bind(emitter, 'navigationBarLeftAction'),
rightAction: emitter.emit.bind(emitter, 'navigationBarRightAction'),
rightButtonDisabled: !name,
rightLabel: name ? 'Edit' : '',
title: 'Me'
}
}
},
getDefaultProps () {
return {
me: {}
}
},
componentDidMount () {
var self = this;
var body = document.getElementsByTagName('body')[0];
var menuWrapper = document.getElementsByClassName('Tabs-Navigator-wrapper')[0];
body.classList.remove('android-menu-is-open');
menuWrapper.addEventListener('click', function (e) {
body.classList.remove('android-menu-is-open');
});
// navbar actions
this.watch(emitter, 'navigationBarLeftAction', function () {
body.classList.toggle('android-menu-is-open');
});
this.watch(emitter, 'navigationBarRightAction', function () {
self.transitionTo('tabs:me-edit', { transition: 'fade' })
});
},
render () {
var person = this.props.me
var github = person.github && this.renderGithub(person.github)
var twitter = person.twitter && this.renderTwitter(person.twitter)
var ticketCode = this.context.dataStore.getTicketCode()
var hackathonTicketCode = this.context.dataStore.getHackathonTicketCode();
var workshopTicketCode = this.context.dataStore.getWorkshopTicketCode();
var qrUrl = 'https://chart.googleapis.com/chart?cht=qr&chl=' + ticketCode + '&chs=400x400';
return (
<Container fill scrollable={scrollable} ref="scrollContainer" align="center" direction="column" className="MeRegistration__body">
{/* Main event*/}
{(person && person.first_name) ? (
<Container align="center" className="MeRegistration__section">
<div className="PersonDetails">
{(person.picture || person.avatar_url || person.pic_url) ? (
<img src={person.picture || person.avatar_url || person.pic_url} className="PersonDetails__avatar" />
) : null}
{person.first_name && <div className="PersonDetails__heading">{person.first_name} {person.last_name}</div>}
{person.bio && <div className="PersonDetails__text text-block">{person.bio}</div>}
{(person.twitter || person.github) && <div className="PersonDetails__profiles">
{twitter}
{github}
</div>}
</div>
<Container align="center" className="entry-code">
<div className="entry-code__heading">Please show this to gain entry:</div>
<img src={qrUrl} className="entry-code__image" />
<div className="entry-code__text">{ticketCode.toUpperCase()}</div>
</Container>
</Container>
) : (
<Container align="center" className="MeRegistration__section">
<div className="MeRegistration__heading">ReactEurope 2016</div>
<p className="MeRegistration__intro">Register to get the most out of ReactEurope 2016!</p>
<Link to="app:onboarding-main-event" transition="fade" className="MeRegistration__footer-button">Register</Link>
</Container>
)}
<Section
title="Workshop"
ticketCode={workshopTicketCode}
registerLink="app:onboarding-workshop"
/>
<Section
title="Hackathon"
ticketCode={hackathonTicketCode}
registerLink="app:onboarding-hackathon"
/>
</Container>
);
}
});
// OLD CODE
/* <div className="MeRegistration__benefits">
<div className="MeRegistration__benefit">
<div className="MeRegistration__benefit__icon ion-qr-scanner" />
<div className="MeRegistration__benefit__label">Enter the conference simply by having your QR code scanned</div>
</div>
<div className="MeRegistration__benefit">
<div className="MeRegistration__benefit__icon ion-person" />
<div className="MeRegistration__benefit__label">Make your profile public and view the full list of public attendees</div>
</div>
<div className="MeRegistration__benefit">
<div className="MeRegistration__benefit__icon ion-speakerphone" />
<div className="MeRegistration__benefit__label">Leave feedback for the speakers on your favourite talks</div>
</div>
</div> */