diff --git a/public/_redirects b/public/_redirects
deleted file mode 100644
index 50a4633..0000000
--- a/public/_redirects
+++ /dev/null
@@ -1 +0,0 @@
-/* /index.html 200
\ No newline at end of file
diff --git a/public/cn.html b/public/cn.html
new file mode 100644
index 0000000..4b59b4f
--- /dev/null
+++ b/public/cn.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+ Great Circle Map
+
+
+
+
+
+
+
diff --git a/public/netlify.toml b/public/netlify.toml
new file mode 100644
index 0000000..152075d
--- /dev/null
+++ b/public/netlify.toml
@@ -0,0 +1,10 @@
+[[redirects]]
+ from = "/*"
+ to = "/cn.html"
+ status = 200
+ force = false
+[[redirects]]
+ from = "/*"
+ to = "/index.html"
+ status = 200
+ force = false
\ No newline at end of file
diff --git a/server.js b/server.js
index 63e8009..b0e4dad 100644
--- a/server.js
+++ b/server.js
@@ -1,31 +1,34 @@
-const path = require("path")
-const express = require("express")
-const favicon = require("serve-favicon")
-const cookieParser = require("cookie-parser")
-const bodyParser = require("body-parser")
-const session = require("express-session")
-const compression = require("compression")
+const path = require('path');
+const express = require('express');
+const favicon = require('serve-favicon');
+const cookieParser = require('cookie-parser');
+const bodyParser = require('body-parser');
+const session = require('express-session');
+const compression = require('compression');
-const port = process.env.PORT || "3000"
-const app = express()
+const port = process.env.PORT || '3000';
+const app = express();
-app.use(compression())
-app.use(favicon(path.join(__dirname, "public", "favicon.ico")))
-app.use(bodyParser.json())
-app.use(bodyParser.urlencoded({ extended: false }))
-app.use(cookieParser())
-app.use(session({ // REMOVE IF NOT NEEDED
- secret: "What is this secret for??", // CHANGE!
- resave: false,
- saveUninitialized: false
-}))
+app.use(compression());
+app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
+app.use(bodyParser.json());
+app.use(bodyParser.urlencoded({ extended: false }));
+app.use(cookieParser());
+app.use(
+ session({
+ // REMOVE IF NOT NEEDED
+ secret: 'What is this secret for??', // CHANGE!
+ resave: false,
+ saveUninitialized: false
+ })
+);
-app.use(express.static(path.join(__dirname, "public")))
+app.use(express.static(path.join(__dirname, 'public')));
-app.get("*", (req, res) => {
- res.sendFile(path.join(__dirname, "public", "index.html"))
-})
+app.get('*', (req, res) => {
+ res.sendFile(path.join(__dirname, 'public', 'index.html'));
+});
/* eslint-disable no-console */
-app.listen(port, () => console.log(`Server listening on port ${port}`))
+app.listen(port, () => console.log(`Server listening on port ${port}`));
/* eslint-enable no-console */
diff --git a/src/components/GoogleMapWrapper.jsx b/src/components/GoogleMapWrapper.jsx
index 350ebb5..ab133f7 100644
--- a/src/components/GoogleMapWrapper.jsx
+++ b/src/components/GoogleMapWrapper.jsx
@@ -1,7 +1,7 @@
-import React, { Component } from 'react';
import PropTypes from 'prop-types';
+import React, { Component } from 'react';
import { connect } from 'react-redux';
-import { getRoutes, getAirports, getSectors, getBrighterColor } from '../selectors';
+import { getAirports, getBrighterColor, getRoutes, getSectors } from '../selectors';
import GoogleMap from './GoogleMap';
class GoogleMapWrapper extends Component {
@@ -46,10 +46,21 @@ class GoogleMapWrapper extends Component {
}
render() {
- const { routes, airports, sectors, mapType, label, routeColor, pointColor, map } = this.props;
+ const {
+ routes,
+ airports,
+ sectors,
+ mapType,
+ label,
+ routeColor,
+ pointColor,
+ map,
+ country
+ } = this.props;
+ const rootUrl = country === 'cn' ? 'http://maps.google.cn' : 'https://maps.googleapis.com';
return (
}
containerElement={}
mapElement={}
@@ -67,6 +78,7 @@ class GoogleMapWrapper extends Component {
}
}
GoogleMapWrapper.propTypes = {
+ country: PropTypes.string,
dispatch: PropTypes.func.isRequired,
routes: PropTypes.arrayOf(PropTypes.array),
sectors: PropTypes.arrayOf(PropTypes.array).isRequired,
@@ -83,6 +95,7 @@ GoogleMapWrapper.defaultProps = { map: null, routes: null };
function mapStateToProps(state) {
return {
+ country: state.country,
routes: getRoutes(state).routes,
sectors: getSectors(state),
airports: getAirports(state),
diff --git a/src/index.jsx b/src/index.jsx
index 7a9e41e..7266bf6 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -1,18 +1,16 @@
import 'babel-polyfill';
+import createBrowserHistory from 'history/createBrowserHistory';
import React from 'react';
import ReactDOM from 'react-dom';
-import { createStore, applyMiddleware, combineReducers, compose } from 'redux';
import { Provider } from 'react-redux';
+import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
import { routerForBrowser } from 'redux-little-router';
-import createBrowserHistory from 'history/createBrowserHistory';
-import ReduxThunk from 'redux-thunk';
// import logger from 'redux-logger';
-
-import './stylesheets/styles.scss';
-import './stylesheets/map.scss';
-
-import reducers from './reducers';
+import ReduxThunk from 'redux-thunk';
import App from './components/App';
+import reducers from './reducers';
+import './stylesheets/map.scss';
+import './stylesheets/styles.scss';
import checkIfMobile from './utils/checkIfMobile';
const history = createBrowserHistory();
@@ -57,9 +55,12 @@ const { reducer, middleware, enhancer } = routerForBrowser({
routes
});
+const country = window.COUNTRY;
+delete window.COUNTRY;
+
const store = createStore(
combineReducers({ ...reducers, router: reducer }),
- { isMobile: checkIfMobile() },
+ { isMobile: checkIfMobile(), country },
compose(
enhancer,
applyMiddleware(ReduxThunk, middleware)
diff --git a/src/reducers/country.js b/src/reducers/country.js
new file mode 100644
index 0000000..846ce9d
--- /dev/null
+++ b/src/reducers/country.js
@@ -0,0 +1,5 @@
+const country = (state = null) => {
+ return state;
+};
+
+export default country;
diff --git a/src/reducers/index.js b/src/reducers/index.js
index 91b61f2..a2d1afd 100644
--- a/src/reducers/index.js
+++ b/src/reducers/index.js
@@ -1,13 +1,15 @@
import airportData from './airportData';
-import map from './map';
+import country from './country';
import inputMode from './inputMode';
-import settings from './settings';
import isMobile from './isMobile';
+import map from './map';
import searchInput from './searchInput';
+import settings from './settings';
import svgMap from './svgMap';
export default {
airportData,
+ country,
map,
inputMode,
settings,