From 3e72bfa56c860826429a842f6c128d78d4a930db Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 1 Jun 2017 19:47:08 -0400 Subject: react-native-web port of fmf app --- client/src/lib/views/contact.js | 307 ++++++++++++++++++++++++++++++++++++ client/src/lib/views/credits.js | 34 ++++ client/src/lib/views/home.js | 98 ++++++++++++ client/src/lib/views/information.js | 114 +++++++++++++ client/src/lib/views/livestream.js | 134 ++++++++++++++++ client/src/lib/views/nav.js | 119 ++++++++++++++ client/src/lib/views/privacy.js | 33 ++++ 7 files changed, 839 insertions(+) create mode 100644 client/src/lib/views/contact.js create mode 100644 client/src/lib/views/credits.js create mode 100644 client/src/lib/views/home.js create mode 100644 client/src/lib/views/information.js create mode 100644 client/src/lib/views/livestream.js create mode 100644 client/src/lib/views/nav.js create mode 100644 client/src/lib/views/privacy.js (limited to 'client/src/lib/views') diff --git a/client/src/lib/views/contact.js b/client/src/lib/views/contact.js new file mode 100644 index 0000000..74f79b5 --- /dev/null +++ b/client/src/lib/views/contact.js @@ -0,0 +1,307 @@ +import React, { Component } from 'react'; +import { + ActivityIndicator, + KeyboardAvoidingView, + TouchableHighlight, + TouchableWithoutFeedback, + StyleSheet, + TextInput, + Keyboard, + Text, + View +} from 'react-native'; + +import hosts from '../db/hosts' + +const validator = require("email-validator") + +import ScrollableContainer from '../components/scrollableContainer' +import ClearText from '../components/text' +import Heading from '../components/heading' +import Button from '../components/button' +import CheckBox from '../components/checkbox' +import Modal from '../components/modal' + +export default class Contact extends Component { + constructor() { + super() + this.state = { + name: '', + email: '', + message: '', + track: false, + publish: false, + sending: false, + done: false, + } + this.setName = this.setName.bind(this) + this.setEmail = this.setEmail.bind(this) + this.setTrack = this.setTrack.bind(this) + this.setPublish = this.setPublish.bind(this) + this.setMessage = this.setMessage.bind(this) + this.send = this.send.bind(this) + this.reset = this.reset.bind(this) + } + setName(name) { + this.setState({ name, error: false }) + } + setEmail(email) { + this.setState({ email, error: false }) + } + setTrack(track) { + this.setState({ track: ! track }) + } + setPublish(publish) { + this.setState({ publish: ! publish }) + } + setMessage(message) { + this.setState({ message: message }) + } + send() { + var isValidEmail = validator.validate(this.state.email) + if (! isValidEmail) { + // return this.setState({ error: true }) + this.setState({ sending: true, track: false }) + } + else { + this.setState({ sending: true }) + } +// fetch('POST', hosts.feedback, { +// 'Content-Type' : 'multipart/form-data', +// }, [ +// { name: 'name', data: this.state.name }, +// { name: 'email', data: this.state.email }, +// { name: 'message', data: this.state.message }, +// { name: 'track', data: this.state.track }, +// { name: 'publish', data: this.state.publish }, +// { name: 'secret', data: 'iNr51NbvUDqbBzyray7gdZZjigDtlJj9' }, +// ]).then(() => { +// this.setState({ done: true }) +// }).catch((e) => { +// console.warn(e) +// this.setState({ done: true }) +// }) + } + reset() { + this.setState({ + name: '', + email: '', + message: '', + track: false, + publish: false, + sending: false, + done: false, + }) + } + render() { + return ( + + + + {this.props.content.body} + + + {this.renderForm()} + {this.renderComments()} + + + + {this.renderActivity()} + + + ) + } + renderForm() { + let error = this.state.error ? ( + Please enter a valid email address + ) : ( + + ) + return ( + + + + {error} + + + + + +