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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
import React, { Component } from 'react'
import {
AppRegistry,
Dimensions,
Image,
StyleSheet,
StatusBar,
Text,
View
} from 'react-native'
import { Route, Link, Redirect, withRouter } from 'react-router-dom'
const window = Dimensions.get('window')
import db from '../db'
import Home from '../views/home'
import Nav from '../views/nav'
import Timeline from '../timeline'
import Drone from '../drone'
import Livestream from '../views/livestream'
import Information from '../views/information'
import Contact from '../views/contact'
import Credits from '../views/credits'
import Privacy from '../views/privacy'
import WebViewModal from '../components/webViewModal'
import Footer from '../components/footer'
import Header from '../components/header'
let touchTimeout;
class App extends Component {
constructor() {
super()
this.state = {
view: 'home',
db: db.backup(),
visitedTimeline: false,
url: '',
}
// reset to home screen after some period of inactivity
this.visitedTimeline = false
this.onLinkPress = this.onLinkPress.bind(this)
this.onCloseWebViewModal = this.onCloseWebViewModal.bind(this)
db.fetch(data => this.setState({ db: data }))
}
onLinkPress(url) {
if (url.indexOf('/') === 0) {
this.props.history.push(url)
}
else {
global.open(url)
}
}
onCloseWebViewModal() {
this.setState({ url: '' })
}
render() {
return (
<View style={styles.container}>
<Route path='/' render={(props) => {
return ( <Header location={props.location} /> )
}}/>
<View style={styles.inner}>
<Route exact path='/' render={(props) => (
<Home />
)}/>
<Route path='/timeline' render={(props) => {
if (! this.visitedTimeline) {
setTimeout(() => {
this.visitedTimeline = true
}, 600)
}
else if (this.timelineView) {
setImmediate( () => this.timelineView.onFilter('') )
}
return (
<Timeline
ref={(ref) => this.timelineView = ref}
firstTime={! this.visitedTimeline}
content={this.state.db.page['history-of-surveillance']}
events={this.state.db.timeline}
onLinkPress={this.onLinkPress}
{...props}
/>
)
}}/>
<Route path='/drones' render={(props) => (
<Drone
content={this.state.db.drone}
onLinkPress={this.onLinkPress}
{...props}
/>
)}/>
<Route path='/livestream' render={(props) => (
<Livestream
content={this.state.db.stream}
{...props}
/>
)}/>
<Route path='/information' render={(props) => (
<Information
essays={this.state.db.essay}
content={this.state.db.about}
onLinkPress={this.onLinkPress}
{...props}
/>
)}/>
<Route path='/page/credits' render={(props) => (
<Credits
content={this.state.db.page['credits']}
onLinkPress={this.onLinkPress}
{...props}
/>
)}/>
<Route path='/page/privacy' render={(props) => (
<Privacy
content={this.state.db.page['privacy-policy']}
onLinkPress={this.onLinkPress}
{...props}
/>
)}/>
<Route path='/contact' render={(props) => (
<Contact
content={this.state.db.page['contact']}
comments={this.state.db.comments}
{...props}
/>
)}/>
</View>
<Footer onLinkPress={this.onLinkPress} />
<StatusBar hidden />
</View>
)
}
componentDidMount() {
setTimeout( () => {
document.body.classList.remove("loading")
}, 500)
}
}
// <Redirect to="/" />
export default App
const styles = StyleSheet.create({
container: {
width: '100%',
height: '100%',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#000000',
},
inner: {
flex: 1,
flexDirection: 'row',
height: window.innerHeight - 50 - 50,
},
logo: {
marginTop: 0,
height: 50,
marginBottom: 10,
}
})
|