diff --git a/.gitignore b/.gitignore index ecb633c..cf8a05b 100644 --- a/.gitignore +++ b/.gitignore @@ -14,14 +14,6 @@ yarn-error.log /osrm/pbf /osrm/pbf/* -/config/frontend.js -/config/backend.js -/config/pwa.js - -/src/config/frontend.ts -/src/config/backend.js -/src/config/pwa.js - # Bundle *.js.map stats.json diff --git a/src/config/frontend.ts b/src/config/frontend.ts new file mode 100644 index 0000000..c498a40 --- /dev/null +++ b/src/config/frontend.ts @@ -0,0 +1,29 @@ +import { DEFAULT_PROVIDER, PROVIDERS } from '~/constants/providers'; +import { LatLngLiteral } from 'leaflet'; + +const PUBLIC_PATH = process.env.REACT_APP_PUBLIC_PATH || ''; +const API_ADDR = process.env.REACT_APP_API_ADDR || ''; +const OSRM_URL = process.env.REACT_APP_OSRM_URL || ''; +const OSRM_PROFILE = process.env.REACT_APP_OSRM_PROFILE || 'bike'; +const OSRM_TEST_URL = ([south_west, north_east]: LatLngLiteral[]) => ( + `${OSRM_URL}/${OSRM_PROFILE}/${Object.values(south_west).join(',')};${Object.values(north_east).join(',')}` +); + +export const CLIENT = { + OSRM_URL, + API_ADDR, + OSRM_TEST_URL, + OSRM_PROFILE, + STROKE_WIDTH: 5, + PUBLIC_PATH, + NOMINATIM_TEST_URL: '', + NOMINATIM_URL: '', +}; + +export const COLORS = { + PATH_COLOR: ['#ff7700', '#ff3344'], +}; + +export const PROVIDER = PROVIDERS[DEFAULT_PROVIDER]; + +export const MOBILE_BREAKPOINT = 768; diff --git a/src/config/pwa.js b/src/config/pwa.js new file mode 100644 index 0000000..5319c26 --- /dev/null +++ b/src/config/pwa.js @@ -0,0 +1,22 @@ +const path = require('path'); + +module.exports = { + MANIFEST: (src) => ({ + name: 'Редактор маршрутов', + short_name: 'Маршруты', + description: 'Велосипедные маршруты в новосибирске', + background_color: '#333333', + theme_color: '#01579b', + display: 'fullscreen', + 'theme-color': '#01579b', + start_url: '/', + icons: [ + { + src, // : path.resolve('./src/sprites/app.png') + sizes: [96, 128, 192, 256, 384, 512], + destination: path.join('assets', 'icons') + } + ] + }), + PUBLIC_PATH: process.env.REACT_APP_PUBLIC_PATH, +}; diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts new file mode 100644 index 0000000..6431bc5 --- /dev/null +++ b/src/react-app-env.d.ts @@ -0,0 +1 @@ +///