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/.babelrc | 3 + client/.buckconfig | 6 + client/.flowconfig | 47 + client/.gitattributes | 1 + client/.gitignore | 59 + client/.watchmanconfig | 1 + client/README.md | 118 + client/__tests__/app.js | 12 + client/app.js | 22 + client/app.json | 4 + client/index.web.js | 14 + client/package.json | 47 + client/src/.babelrc | 3 + client/src/.buckconfig | 6 + client/src/.flowconfig | 47 + client/src/.gitattributes | 1 + client/src/.gitignore | 53 + client/src/.watchmanconfig | 1 + client/src/img/afghanistan.png | Bin 0 -> 91548 bytes client/src/img/aiweiwei.png | Bin 0 -> 259114 bytes client/src/img/armory.png | Bin 0 -> 12274 bytes client/src/img/arrow-right.png | Bin 0 -> 2183 bytes client/src/img/aww.png | Bin 0 -> 99273 bytes client/src/img/checkbox-off.png | Bin 0 -> 1539 bytes client/src/img/checkbox-on.png | Bin 0 -> 2784 bytes client/src/img/close.png | Bin 0 -> 3812 bytes client/src/img/drone.jpg | Bin 0 -> 72821 bytes client/src/img/herzogDeMeuron.png | Bin 0 -> 653994 bytes client/src/img/icon/icon.png | Bin 0 -> 44250 bytes client/src/img/icon/splash.png | Bin 0 -> 34995 bytes client/src/img/logo.png | Bin 0 -> 24655 bytes client/src/img/nav/home/contact.png | Bin 0 -> 4534 bytes client/src/img/nav/home/drones.png | Bin 0 -> 4324 bytes client/src/img/nav/home/findyourface.png | Bin 0 -> 2418 bytes client/src/img/nav/home/home.png | Bin 0 -> 2036 bytes client/src/img/nav/home/information.png | Bin 0 -> 3516 bytes client/src/img/nav/home/livestream.png | Bin 0 -> 6797 bytes client/src/img/nav/home/timeline.png | Bin 0 -> 6654 bytes client/src/img/nav/old/contact.png | Bin 0 -> 13362 bytes client/src/img/nav/old/drones.png | Bin 0 -> 56309 bytes client/src/img/nav/old/findyourface.png | Bin 0 -> 33628 bytes client/src/img/nav/old/home.png | Bin 0 -> 26920 bytes client/src/img/nav/old/information.png | Bin 0 -> 29760 bytes client/src/img/nav/old/livestream.png | Bin 0 -> 90562 bytes client/src/img/nav/old/timeline.png | Bin 0 -> 85906 bytes client/src/img/nav/original/contact.png | Bin 0 -> 14674 bytes client/src/img/nav/original/drones.png | Bin 0 -> 30185 bytes client/src/img/nav/original/findyourface.png | Bin 0 -> 34446 bytes client/src/img/nav/original/home.png | Bin 0 -> 31869 bytes client/src/img/nav/original/information.png | Bin 0 -> 10993 bytes client/src/img/nav/original/livestream.png | Bin 0 -> 75343 bytes client/src/img/nav/original/timeline.png | Bin 0 -> 63672 bytes client/src/img/nav/selected/contact.png | Bin 0 -> 1906 bytes client/src/img/nav/selected/drones.png | Bin 0 -> 2138 bytes client/src/img/nav/selected/findyourface.png | Bin 0 -> 1582 bytes client/src/img/nav/selected/home.png | Bin 0 -> 1366 bytes client/src/img/nav/selected/information.png | Bin 0 -> 2076 bytes client/src/img/nav/selected/livestream.png | Bin 0 -> 2820 bytes client/src/img/nav/selected/timeline.png | Bin 0 -> 3560 bytes client/src/img/nav/sidebar/contact.png | Bin 0 -> 1906 bytes client/src/img/nav/sidebar/drones.png | Bin 0 -> 2138 bytes client/src/img/nav/sidebar/findyourface.png | Bin 0 -> 1526 bytes client/src/img/nav/sidebar/home.png | Bin 0 -> 1308 bytes client/src/img/nav/sidebar/information.png | Bin 0 -> 2002 bytes client/src/img/nav/sidebar/livestream.png | Bin 0 -> 2820 bytes client/src/img/nav/sidebar/timeline.png | Bin 0 -> 3387 bytes client/src/img/pakistan.png | Bin 0 -> 85241 bytes client/src/img/resize.sh | 8 + client/src/img/show-banner.jpg | Bin 0 -> 178307 bytes client/src/img/somalia.png | Bin 0 -> 40007 bytes client/src/img/yemen.png | Bin 0 -> 54048 bytes client/src/lib/app/index.js | 164 + client/src/lib/components/button.js | 55 + client/src/lib/components/checkbox.js | 35 + client/src/lib/components/close.js | 33 + client/src/lib/components/container.js | 50 + client/src/lib/components/definition.js | 52 + client/src/lib/components/footer.js | 77 + client/src/lib/components/header.js | 52 + client/src/lib/components/heading.js | 34 + client/src/lib/components/htmlStyles.js | 32 + client/src/lib/components/mapStyle.js | 287 ++ client/src/lib/components/modal.js | 41 + client/src/lib/components/pushNotifications.js | 38 + client/src/lib/components/scrollableContainer.js | 51 + client/src/lib/components/text.js | 30 + client/src/lib/components/webViewModal.js | 56 + client/src/lib/components/youtube.js | 91 + client/src/lib/db/backupDB.js | 2278 +++++++++ client/src/lib/db/hosts.js | 9 + client/src/lib/db/index.js | 85 + client/src/lib/drone/index.js | 216 + client/src/lib/timeline/index.js | 164 + client/src/lib/timeline/tickMarks.js | 192 + client/src/lib/timeline/timelineEvent.js | 102 + client/src/lib/timeline/timelineFilter.js | 127 + client/src/lib/timeline/timelineFull.js | 227 + client/src/lib/timeline/timelineHeader.js | 111 + 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 + client/src/package.json | 38 + client/web/shared.webpack.config.js | 64 + client/web/templates/index.ejs | 31 + client/web/vendor.webpack.config.js | 56 + client/web/webpack.config.js | 104 + client/yarn.lock | 5461 ++++++++++++++++++++++ 111 files changed, 11735 insertions(+) create mode 100644 client/.babelrc create mode 100644 client/.buckconfig create mode 100644 client/.flowconfig create mode 100644 client/.gitattributes create mode 100644 client/.gitignore create mode 100644 client/.watchmanconfig create mode 100644 client/README.md create mode 100644 client/__tests__/app.js create mode 100644 client/app.js create mode 100644 client/app.json create mode 100644 client/index.web.js create mode 100644 client/package.json create mode 100644 client/src/.babelrc create mode 100644 client/src/.buckconfig create mode 100644 client/src/.flowconfig create mode 100644 client/src/.gitattributes create mode 100644 client/src/.gitignore create mode 100644 client/src/.watchmanconfig create mode 100644 client/src/img/afghanistan.png create mode 100644 client/src/img/aiweiwei.png create mode 100644 client/src/img/armory.png create mode 100644 client/src/img/arrow-right.png create mode 100644 client/src/img/aww.png create mode 100644 client/src/img/checkbox-off.png create mode 100644 client/src/img/checkbox-on.png create mode 100644 client/src/img/close.png create mode 100644 client/src/img/drone.jpg create mode 100644 client/src/img/herzogDeMeuron.png create mode 100644 client/src/img/icon/icon.png create mode 100644 client/src/img/icon/splash.png create mode 100644 client/src/img/logo.png create mode 100644 client/src/img/nav/home/contact.png create mode 100644 client/src/img/nav/home/drones.png create mode 100644 client/src/img/nav/home/findyourface.png create mode 100644 client/src/img/nav/home/home.png create mode 100644 client/src/img/nav/home/information.png create mode 100644 client/src/img/nav/home/livestream.png create mode 100644 client/src/img/nav/home/timeline.png create mode 100644 client/src/img/nav/old/contact.png create mode 100644 client/src/img/nav/old/drones.png create mode 100644 client/src/img/nav/old/findyourface.png create mode 100644 client/src/img/nav/old/home.png create mode 100644 client/src/img/nav/old/information.png create mode 100644 client/src/img/nav/old/livestream.png create mode 100644 client/src/img/nav/old/timeline.png create mode 100644 client/src/img/nav/original/contact.png create mode 100644 client/src/img/nav/original/drones.png create mode 100644 client/src/img/nav/original/findyourface.png create mode 100644 client/src/img/nav/original/home.png create mode 100644 client/src/img/nav/original/information.png create mode 100644 client/src/img/nav/original/livestream.png create mode 100644 client/src/img/nav/original/timeline.png create mode 100644 client/src/img/nav/selected/contact.png create mode 100644 client/src/img/nav/selected/drones.png create mode 100644 client/src/img/nav/selected/findyourface.png create mode 100644 client/src/img/nav/selected/home.png create mode 100644 client/src/img/nav/selected/information.png create mode 100644 client/src/img/nav/selected/livestream.png create mode 100644 client/src/img/nav/selected/timeline.png create mode 100644 client/src/img/nav/sidebar/contact.png create mode 100644 client/src/img/nav/sidebar/drones.png create mode 100644 client/src/img/nav/sidebar/findyourface.png create mode 100644 client/src/img/nav/sidebar/home.png create mode 100644 client/src/img/nav/sidebar/information.png create mode 100644 client/src/img/nav/sidebar/livestream.png create mode 100644 client/src/img/nav/sidebar/timeline.png create mode 100644 client/src/img/pakistan.png create mode 100755 client/src/img/resize.sh create mode 100644 client/src/img/show-banner.jpg create mode 100644 client/src/img/somalia.png create mode 100644 client/src/img/yemen.png create mode 100644 client/src/lib/app/index.js create mode 100644 client/src/lib/components/button.js create mode 100644 client/src/lib/components/checkbox.js create mode 100644 client/src/lib/components/close.js create mode 100644 client/src/lib/components/container.js create mode 100644 client/src/lib/components/definition.js create mode 100644 client/src/lib/components/footer.js create mode 100644 client/src/lib/components/header.js create mode 100644 client/src/lib/components/heading.js create mode 100644 client/src/lib/components/htmlStyles.js create mode 100644 client/src/lib/components/mapStyle.js create mode 100644 client/src/lib/components/modal.js create mode 100644 client/src/lib/components/pushNotifications.js create mode 100644 client/src/lib/components/scrollableContainer.js create mode 100644 client/src/lib/components/text.js create mode 100644 client/src/lib/components/webViewModal.js create mode 100644 client/src/lib/components/youtube.js create mode 100644 client/src/lib/db/backupDB.js create mode 100644 client/src/lib/db/hosts.js create mode 100644 client/src/lib/db/index.js create mode 100644 client/src/lib/drone/index.js create mode 100644 client/src/lib/timeline/index.js create mode 100644 client/src/lib/timeline/tickMarks.js create mode 100644 client/src/lib/timeline/timelineEvent.js create mode 100644 client/src/lib/timeline/timelineFilter.js create mode 100644 client/src/lib/timeline/timelineFull.js create mode 100644 client/src/lib/timeline/timelineHeader.js 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 create mode 100644 client/src/package.json create mode 100644 client/web/shared.webpack.config.js create mode 100644 client/web/templates/index.ejs create mode 100644 client/web/vendor.webpack.config.js create mode 100644 client/web/webpack.config.js create mode 100644 client/yarn.lock diff --git a/client/.babelrc b/client/.babelrc new file mode 100644 index 0000000..8df53fe --- /dev/null +++ b/client/.babelrc @@ -0,0 +1,3 @@ +{ +"presets": ["react-native"] +} \ No newline at end of file diff --git a/client/.buckconfig b/client/.buckconfig new file mode 100644 index 0000000..934256c --- /dev/null +++ b/client/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/client/.flowconfig b/client/.flowconfig new file mode 100644 index 0000000..dcd5fd6 --- /dev/null +++ b/client/.flowconfig @@ -0,0 +1,47 @@ +[ignore] +; We fork some components by platform +.*/*[.]android.js + +; Ignore "BUCK" generated dirs +/\.buckd/ + +; Ignore unexpected extra "@providesModule" +.*/node_modules/.*/node_modules/fbjs/.* + +; Ignore duplicate module providers +; For RN Apps installed via npm, "Libraries" folder is inside +; "node_modules/react-native" but in the source repo it is in the root +.*/Libraries/react-native/React.js +.*/Libraries/react-native/ReactNative.js + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow +flow/ + +[options] +emoji=true + +module.system=haste + +experimental.strict_type_args=true + +munge_underscores=true + +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FixMe + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError + +unsafe.enable_getters_and_setters=true + +[version] +^0.40.0 diff --git a/client/.gitattributes b/client/.gitattributes new file mode 100644 index 0000000..d42ff18 --- /dev/null +++ b/client/.gitattributes @@ -0,0 +1 @@ +*.pbxproj -text diff --git a/client/.gitignore b/client/.gitignore new file mode 100644 index 0000000..a6f3f05 --- /dev/null +++ b/client/.gitignore @@ -0,0 +1,59 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# Web +web/build +web/vendor +web/vendor-dev +jsconfig.json + +# BUCK +buck-out/ +\.buckd/ +*.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots diff --git a/client/.watchmanconfig b/client/.watchmanconfig new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/client/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/client/README.md b/client/README.md new file mode 100644 index 0000000..3c5ebf9 --- /dev/null +++ b/client/README.md @@ -0,0 +1,118 @@ +# React Native for Web - Example App + +This is a boilerplate React Native app with `react-native-web` installed and configured. + +## Features + +* index.html as an EJS template +* Code-splitting + * Saves time during development, saves bandwidth during updates +* Offline Plugin + * Caches all of your assets so your app works without an internet connection + +Coming soon: + +* Pre-rendering as static HTML +* [react-hot-loader](https://github.com/gaearon/react-hot-loader) +* Script to deploy your build to AWS S3, and optionally clear your CloudFlare cache + + +> Note: This boilerplate project only contains an example webpack configuration for React Native Web. +> You should merge this into your favorite React Native starter project. + +## iOS and Android + +Use the default React Native Packager for iOS and Android: + +Script | Description +---|--- +`react-native start` | Starts React Native Packager +`react-native run-ios` | Runs the iOS app +`react-native run-android` | Runs the Android app + + +## Web + +`react-native-web` does not use the React Native Packager, so you need to use [webpack](https://webpack.github.io/) to compile your app. This example app contains a complete webpack configuration that is optimized for development and production. + +Script | Description +---|--- +`npm run web` | Starts the development server on port `3000`. +`npm run web:build:vendor-dev` | Builds the `react-native-web` library for development.
(The `web` task will automatically run this if it does not exist.) +`npm run web:build` | Builds your app for production.
(Runs `web:build:vendor` and `web:build:app`.) +`npm run web:build:vendor` | Builds the `react-native-web` library for production. +`npm run web:build:app` | Builds your app, and any implicit vendored libraries. +`npm run web:serve` | Serves the production build on port `3001`. +`npm run web:clean` | Deletes all generated files. + +> Note: If you haven't changed any libraries in `vendor.webpack.config.js`, you can run `npm run web:build:app` to just compile your app's source code. `npm run web:build` will recompile everything. + + +## index.html + +Your index file is generated from a template at [web/templates/index.ejs](/web/templates/index.ejs). +You can add variables to the [HTMLWebpackPlugin config](web/webpack.config.js#L49-L52) in `web/webpack.config.js`, and use these variables in the template. + + +### Examples: + +In `web/webpack.config.js`: + +```js + new HtmlWebpackPlugin({ + filename: 'index.html', + template: 'web/templates/index.ejs', + myVariable: 'foo', + }), +``` + +In `web/templates/index.ejs`: + +```html +
<%= htmlWebpackPlugin.options.myVariable %>
+``` + +or: + +```html +<% if (htmlWebpackPlugin.options.myVariable) { %> +
<%= htmlWebpackPlugin.options.myVariable %>
+<% } %> +``` + +> See the [HtmlWebpackPlugin README](https://github.com/jantimon/html-webpack-plugin#html-webpack-plugin) for more information. + + +## Code Splitting + +You can add any `react-*` and `react-native-*` libraries to the `entry` section in `vendor.webpack.config.js`. Webpack will compile these libraries separately, and link them with your app's code. (See the [DllPlugin](https://github.com/webpack/docs/wiki/list-of-plugins#dllplugin)). This saves a lot of time during development, because you don't have to keep recompiling your static libraries. This also saves bandwidth when you release an update, because your users will only need to download the updated app bundle. + +You can add multiple entry sections to `vendor.webpack.config.js`. I recommend creating another entry for "core" libraries that don't change very often, but are unrelated to `react` or `react-native-web`. In addition to the explicit vendoring in `vendor.webpack.config.js`, webpack will also create an implicitly vendored bundle, for any libraries in `node_modules/`. + +Here is an example of what your build directory will look like: + +``` +javascript/ + vendor/ + lib-6b8747b211107409.js + react-853080ae05a52a66.dll.js + app-6b8747b211107409.js +``` + +* `lib.*.js` is an implicitly vendored bundle, for all libraries in `node_modules` +* `react.*.dll.js` contains `react-native-web` and all of it's dependencies +* `app.*.js` is your app's source code. + + +## Offline Plugin + +If you want your app to be available offline, you can change this line at the top of `web/webpack.config.js`: + +```js +const enableOfflinePlugin = false +``` + +This will automatically configure a ServiceWorker (or AppCache) to download and cache all of your assets, so people will be able to use your app even if they don't have an internet connection. + +> The Offline Plugin will only be enabled in the production build. + diff --git a/client/__tests__/app.js b/client/__tests__/app.js new file mode 100644 index 0000000..5d3f8e3 --- /dev/null +++ b/client/__tests__/app.js @@ -0,0 +1,12 @@ +import 'react-native'; +import React from 'react'; +import App from '../app.js'; + +// Note: test renderer must be required after react-native. +import renderer from 'react-test-renderer'; + +it('renders correctly', () => { + const tree = renderer.create( + + ); +}); diff --git a/client/app.js b/client/app.js new file mode 100644 index 0000000..1be697c --- /dev/null +++ b/client/app.js @@ -0,0 +1,22 @@ +import React, { Component } from 'react'; +import { + StyleSheet, + Text, + View, + Platform, +} from 'react-native'; +import { BrowserRouter } from 'react-router-dom' +import App from './src/lib/app' + +const platformText = {ios: 'iOS', android: 'Android', web: 'Web' } + +export default class HanselGretelApp extends Component { + render() { + return ( + + + + ) + } +} + diff --git a/client/app.json b/client/app.json new file mode 100644 index 0000000..83c5798 --- /dev/null +++ b/client/app.json @@ -0,0 +1,4 @@ +{ + "name": "ExampleApp", + "displayName": "ExampleApp" +} \ No newline at end of file diff --git a/client/index.web.js b/client/index.web.js new file mode 100644 index 0000000..b48b84b --- /dev/null +++ b/client/index.web.js @@ -0,0 +1,14 @@ +import { AppRegistry } from 'react-native'; +import App from './app' + +// Sets up offline caching for all assets (disabled by default) +// You can enable offline caching by changing +// `enableOfflinePlugin` at the top of web/webpack.config.js +if (__OFFLINE__) { + require('offline-plugin/runtime').install() +} + +AppRegistry.registerComponent('HanselGretelApp', () => App); +AppRegistry.runApplication('HanselGretelApp', { + rootTag: window.document.getElementById('react-root'), +}); diff --git a/client/package.json b/client/package.json new file mode 100644 index 0000000..bec01c0 --- /dev/null +++ b/client/package.json @@ -0,0 +1,47 @@ +{ + "name": "ExampleApp", + "version": "0.0.1", + "private": true, + "scripts": { + "start": "node node_modules/react-native/local-cli/cli.js start", + "test": "jest", + "web:build:vendor-dev": "rm -rf web/vendor-dev; NODE_ENV=development webpack --config web/vendor.webpack.config.js || rm -rf web/vendor-dev", + "web": "[ -d web/vendor-dev ] || npm run web:build:vendor-dev && NODE_ENV=development webpack-dev-server -d --host 0.0.0.0 --port 3000 --config web/webpack.config.js --inline --hot --colors --history-api-fallback", + "web:clean": "rm -rf web/vendor web/vendor-dev web/build", + "web:build:vendor": "rm -rf web/vendor; NODE_ENV=production webpack --config web/vendor.webpack.config.js", + "web:build:app": "rm -rf web/build; NODE_ENV=production webpack --config web/webpack.config.js", + "web:build": "npm run web:build:vendor && npm run web:build:app", + "web:serve": "http-serve -p 3001 --gzip true ./web/build" + }, + "dependencies": { + "react": "16.0.0-alpha.6", + "react-native": "0.43.4", + "react-native-web": "^0.0.88", + "react-router-dom": "^4.1.1" + }, + "devDependencies": { + "add-asset-html-webpack-plugin": "^2.0.1", + "babel-jest": "19.0.0", + "babel-loader": "^7.0.0", + "babel-preset-react-native": "1.9.1", + "compression-webpack-plugin": "^0.4.0", + "copy-webpack-plugin": "^4.0.1", + "html-webpack-plugin": "^2.28.0", + "http-serve": "^1.0.1", + "jest": "19.0.2", + "json-loader": "^0.5.4", + "offline-plugin": "^4.7.0", + "react-dom": "^15.4.2", + "react-hot-loader": "^1.3.1", + "react-test-renderer": "16.0.0-alpha.6", + "url-loader": "^0.5.8", + "webpack": "^2.4.1", + "webpack-dev-server": "^2.4.2" + }, + "jest": { + "preset": "react-native", + "moduleNameMapper": { + "react-native": "/../" + } + } +} diff --git a/client/src/.babelrc b/client/src/.babelrc new file mode 100644 index 0000000..a9ce136 --- /dev/null +++ b/client/src/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["react-native"] +} diff --git a/client/src/.buckconfig b/client/src/.buckconfig new file mode 100644 index 0000000..934256c --- /dev/null +++ b/client/src/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/client/src/.flowconfig b/client/src/.flowconfig new file mode 100644 index 0000000..a76425e --- /dev/null +++ b/client/src/.flowconfig @@ -0,0 +1,47 @@ +[ignore] +; We fork some components by platform +.*/*[.]android.js + +; Ignore "BUCK" generated dirs +/\.buckd/ + +; Ignore unexpected extra "@providesModule" +.*/node_modules/.*/node_modules/fbjs/.* + +; Ignore duplicate module providers +; For RN Apps installed via npm, "Libraries" folder is inside +; "node_modules/react-native" but in the source repo it is in the root +.*/Libraries/react-native/React.js +.*/Libraries/react-native/ReactNative.js + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow +flow/ + +[options] +emoji=true + +module.system=haste + +experimental.strict_type_args=true + +munge_underscores=true + +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FixMe + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-2]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-2]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError + +unsafe.enable_getters_and_setters=true + +[version] +^0.42.0 diff --git a/client/src/.gitattributes b/client/src/.gitattributes new file mode 100644 index 0000000..d42ff18 --- /dev/null +++ b/client/src/.gitattributes @@ -0,0 +1 @@ +*.pbxproj -text diff --git a/client/src/.gitignore b/client/src/.gitignore new file mode 100644 index 0000000..10be197 --- /dev/null +++ b/client/src/.gitignore @@ -0,0 +1,53 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + +# BUCK +buck-out/ +\.buckd/ +*.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots diff --git a/client/src/.watchmanconfig b/client/src/.watchmanconfig new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/client/src/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/client/src/img/afghanistan.png b/client/src/img/afghanistan.png new file mode 100644 index 0000000..0e94a27 Binary files /dev/null and b/client/src/img/afghanistan.png differ diff --git a/client/src/img/aiweiwei.png b/client/src/img/aiweiwei.png new file mode 100644 index 0000000..4d6a346 Binary files /dev/null and b/client/src/img/aiweiwei.png differ diff --git a/client/src/img/armory.png b/client/src/img/armory.png new file mode 100644 index 0000000..bf881a0 Binary files /dev/null and b/client/src/img/armory.png differ diff --git a/client/src/img/arrow-right.png b/client/src/img/arrow-right.png new file mode 100644 index 0000000..0cb2588 Binary files /dev/null and b/client/src/img/arrow-right.png differ diff --git a/client/src/img/aww.png b/client/src/img/aww.png new file mode 100644 index 0000000..d24bb47 Binary files /dev/null and b/client/src/img/aww.png differ diff --git a/client/src/img/checkbox-off.png b/client/src/img/checkbox-off.png new file mode 100644 index 0000000..a089c3d Binary files /dev/null and b/client/src/img/checkbox-off.png differ diff --git a/client/src/img/checkbox-on.png b/client/src/img/checkbox-on.png new file mode 100644 index 0000000..c5957c5 Binary files /dev/null and b/client/src/img/checkbox-on.png differ diff --git a/client/src/img/close.png b/client/src/img/close.png new file mode 100644 index 0000000..2f78485 Binary files /dev/null and b/client/src/img/close.png differ diff --git a/client/src/img/drone.jpg b/client/src/img/drone.jpg new file mode 100644 index 0000000..905d9ce Binary files /dev/null and b/client/src/img/drone.jpg differ diff --git a/client/src/img/herzogDeMeuron.png b/client/src/img/herzogDeMeuron.png new file mode 100644 index 0000000..8f7a8a4 Binary files /dev/null and b/client/src/img/herzogDeMeuron.png differ diff --git a/client/src/img/icon/icon.png b/client/src/img/icon/icon.png new file mode 100644 index 0000000..83c0bdd Binary files /dev/null and b/client/src/img/icon/icon.png differ diff --git a/client/src/img/icon/splash.png b/client/src/img/icon/splash.png new file mode 100644 index 0000000..8390abe Binary files /dev/null and b/client/src/img/icon/splash.png differ diff --git a/client/src/img/logo.png b/client/src/img/logo.png new file mode 100644 index 0000000..14a9922 Binary files /dev/null and b/client/src/img/logo.png differ diff --git a/client/src/img/nav/home/contact.png b/client/src/img/nav/home/contact.png new file mode 100644 index 0000000..b912c22 Binary files /dev/null and b/client/src/img/nav/home/contact.png differ diff --git a/client/src/img/nav/home/drones.png b/client/src/img/nav/home/drones.png new file mode 100644 index 0000000..af9b454 Binary files /dev/null and b/client/src/img/nav/home/drones.png differ diff --git a/client/src/img/nav/home/findyourface.png b/client/src/img/nav/home/findyourface.png new file mode 100644 index 0000000..870df1c Binary files /dev/null and b/client/src/img/nav/home/findyourface.png differ diff --git a/client/src/img/nav/home/home.png b/client/src/img/nav/home/home.png new file mode 100644 index 0000000..3fb947e Binary files /dev/null and b/client/src/img/nav/home/home.png differ diff --git a/client/src/img/nav/home/information.png b/client/src/img/nav/home/information.png new file mode 100644 index 0000000..e5350b6 Binary files /dev/null and b/client/src/img/nav/home/information.png differ diff --git a/client/src/img/nav/home/livestream.png b/client/src/img/nav/home/livestream.png new file mode 100644 index 0000000..8d5f9ae Binary files /dev/null and b/client/src/img/nav/home/livestream.png differ diff --git a/client/src/img/nav/home/timeline.png b/client/src/img/nav/home/timeline.png new file mode 100644 index 0000000..5ad6792 Binary files /dev/null and b/client/src/img/nav/home/timeline.png differ diff --git a/client/src/img/nav/old/contact.png b/client/src/img/nav/old/contact.png new file mode 100644 index 0000000..7242391 Binary files /dev/null and b/client/src/img/nav/old/contact.png differ diff --git a/client/src/img/nav/old/drones.png b/client/src/img/nav/old/drones.png new file mode 100644 index 0000000..b2f9b28 Binary files /dev/null and b/client/src/img/nav/old/drones.png differ diff --git a/client/src/img/nav/old/findyourface.png b/client/src/img/nav/old/findyourface.png new file mode 100644 index 0000000..a4b6be6 Binary files /dev/null and b/client/src/img/nav/old/findyourface.png differ diff --git a/client/src/img/nav/old/home.png b/client/src/img/nav/old/home.png new file mode 100644 index 0000000..18c09e5 Binary files /dev/null and b/client/src/img/nav/old/home.png differ diff --git a/client/src/img/nav/old/information.png b/client/src/img/nav/old/information.png new file mode 100644 index 0000000..0dcec4f Binary files /dev/null and b/client/src/img/nav/old/information.png differ diff --git a/client/src/img/nav/old/livestream.png b/client/src/img/nav/old/livestream.png new file mode 100644 index 0000000..9c5f20f Binary files /dev/null and b/client/src/img/nav/old/livestream.png differ diff --git a/client/src/img/nav/old/timeline.png b/client/src/img/nav/old/timeline.png new file mode 100644 index 0000000..3fb0ce4 Binary files /dev/null and b/client/src/img/nav/old/timeline.png differ diff --git a/client/src/img/nav/original/contact.png b/client/src/img/nav/original/contact.png new file mode 100644 index 0000000..39529aa Binary files /dev/null and b/client/src/img/nav/original/contact.png differ diff --git a/client/src/img/nav/original/drones.png b/client/src/img/nav/original/drones.png new file mode 100644 index 0000000..9a9b489 Binary files /dev/null and b/client/src/img/nav/original/drones.png differ diff --git a/client/src/img/nav/original/findyourface.png b/client/src/img/nav/original/findyourface.png new file mode 100644 index 0000000..fcfa493 Binary files /dev/null and b/client/src/img/nav/original/findyourface.png differ diff --git a/client/src/img/nav/original/home.png b/client/src/img/nav/original/home.png new file mode 100644 index 0000000..2ca5596 Binary files /dev/null and b/client/src/img/nav/original/home.png differ diff --git a/client/src/img/nav/original/information.png b/client/src/img/nav/original/information.png new file mode 100644 index 0000000..d45c43d Binary files /dev/null and b/client/src/img/nav/original/information.png differ diff --git a/client/src/img/nav/original/livestream.png b/client/src/img/nav/original/livestream.png new file mode 100644 index 0000000..742996b Binary files /dev/null and b/client/src/img/nav/original/livestream.png differ diff --git a/client/src/img/nav/original/timeline.png b/client/src/img/nav/original/timeline.png new file mode 100644 index 0000000..49e2d83 Binary files /dev/null and b/client/src/img/nav/original/timeline.png differ diff --git a/client/src/img/nav/selected/contact.png b/client/src/img/nav/selected/contact.png new file mode 100644 index 0000000..90f1faf Binary files /dev/null and b/client/src/img/nav/selected/contact.png differ diff --git a/client/src/img/nav/selected/drones.png b/client/src/img/nav/selected/drones.png new file mode 100644 index 0000000..25122a9 Binary files /dev/null and b/client/src/img/nav/selected/drones.png differ diff --git a/client/src/img/nav/selected/findyourface.png b/client/src/img/nav/selected/findyourface.png new file mode 100644 index 0000000..8db3405 Binary files /dev/null and b/client/src/img/nav/selected/findyourface.png differ diff --git a/client/src/img/nav/selected/home.png b/client/src/img/nav/selected/home.png new file mode 100644 index 0000000..0073474 Binary files /dev/null and b/client/src/img/nav/selected/home.png differ diff --git a/client/src/img/nav/selected/information.png b/client/src/img/nav/selected/information.png new file mode 100644 index 0000000..30bd546 Binary files /dev/null and b/client/src/img/nav/selected/information.png differ diff --git a/client/src/img/nav/selected/livestream.png b/client/src/img/nav/selected/livestream.png new file mode 100644 index 0000000..c570591 Binary files /dev/null and b/client/src/img/nav/selected/livestream.png differ diff --git a/client/src/img/nav/selected/timeline.png b/client/src/img/nav/selected/timeline.png new file mode 100644 index 0000000..7f37591 Binary files /dev/null and b/client/src/img/nav/selected/timeline.png differ diff --git a/client/src/img/nav/sidebar/contact.png b/client/src/img/nav/sidebar/contact.png new file mode 100644 index 0000000..01eda6b Binary files /dev/null and b/client/src/img/nav/sidebar/contact.png differ diff --git a/client/src/img/nav/sidebar/drones.png b/client/src/img/nav/sidebar/drones.png new file mode 100644 index 0000000..0c455bc Binary files /dev/null and b/client/src/img/nav/sidebar/drones.png differ diff --git a/client/src/img/nav/sidebar/findyourface.png b/client/src/img/nav/sidebar/findyourface.png new file mode 100644 index 0000000..bfedb5f Binary files /dev/null and b/client/src/img/nav/sidebar/findyourface.png differ diff --git a/client/src/img/nav/sidebar/home.png b/client/src/img/nav/sidebar/home.png new file mode 100644 index 0000000..c0313d6 Binary files /dev/null and b/client/src/img/nav/sidebar/home.png differ diff --git a/client/src/img/nav/sidebar/information.png b/client/src/img/nav/sidebar/information.png new file mode 100644 index 0000000..184c8f5 Binary files /dev/null and b/client/src/img/nav/sidebar/information.png differ diff --git a/client/src/img/nav/sidebar/livestream.png b/client/src/img/nav/sidebar/livestream.png new file mode 100644 index 0000000..04c75c5 Binary files /dev/null and b/client/src/img/nav/sidebar/livestream.png differ diff --git a/client/src/img/nav/sidebar/timeline.png b/client/src/img/nav/sidebar/timeline.png new file mode 100644 index 0000000..a022e9a Binary files /dev/null and b/client/src/img/nav/sidebar/timeline.png differ diff --git a/client/src/img/pakistan.png b/client/src/img/pakistan.png new file mode 100644 index 0000000..fb5a677 Binary files /dev/null and b/client/src/img/pakistan.png differ diff --git a/client/src/img/resize.sh b/client/src/img/resize.sh new file mode 100755 index 0000000..caacfa9 --- /dev/null +++ b/client/src/img/resize.sh @@ -0,0 +1,8 @@ +for i in nav/original/* +do +echo $i +convert -background black -gravity center $i -resize 140x140 -extent 140x140 ${i/original/home} +convert -background black -gravity center $i -resize 80x80 -extent 100x100 ${i/original/sidebar} +convert -background white -negate -gravity center $i -resize 80x80 -extent 100x100 ${i/original/selected} +done + diff --git a/client/src/img/show-banner.jpg b/client/src/img/show-banner.jpg new file mode 100644 index 0000000..0648dca Binary files /dev/null and b/client/src/img/show-banner.jpg differ diff --git a/client/src/img/somalia.png b/client/src/img/somalia.png new file mode 100644 index 0000000..556ee8f Binary files /dev/null and b/client/src/img/somalia.png differ diff --git a/client/src/img/yemen.png b/client/src/img/yemen.png new file mode 100644 index 0000000..93d7d86 Binary files /dev/null and b/client/src/img/yemen.png differ diff --git a/client/src/lib/app/index.js b/client/src/lib/app/index.js new file mode 100644 index 0000000..dc4d9ac --- /dev/null +++ b/client/src/lib/app/index.js @@ -0,0 +1,164 @@ +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) + } + onLinkPress(url) { + if (url.indexOf('/') === 0) { + this.props.history.push(url) + } + else { + global.open(url) + } + } + onCloseWebViewModal() { + this.setState({ url: '' }) + } + render() { + return ( + + { + return (
) + }}/> + + ( + + )}/> + { + if (! this.visitedTimeline) { + setTimeout(() => { + this.visitedTimeline = true + }, 600) + } + else if (this.timelineView) { + setImmediate( () => this.timelineView.onFilter('') ) + } + return ( + this.timelineView = ref} + firstTime={! this.visitedTimeline} + content={this.state.db.page['history-of-surveillance']} + events={this.state.db.timeline} + onLinkPress={this.onLinkPress} + {...props} + /> + ) + }}/> + ( + + )}/> + ( + + )}/> + ( + + )}/> + ( + + )}/> + ( + + )}/> + ( + + )}/> + + +