-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
52 lines (47 loc) · 1.17 KB
/
config.js
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
const commonInfo = {
siteTitle: "",
title: "",
googleMapApiKey: "",
flightradarUsername: "",
};
const databasePath = `${__dirname}/../../db.sqlite3`;
const selectorsTitles = {
citiesSelectorTitle: "📍Cities",
flightsSelectorTitle: "✈️ Flights",
};
const deviceType = () => {
const ua = window.navigator.userAgent;
if (/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(ua)) {
return "tablet";
} else if (
/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(
ua
)
) {
return "mobile";
}
return "desktop";
};
const googleMapConfig = (maps) => {
const isDesktop = deviceType() === "desktop";
const mapTypeIds = Object.keys(maps);
const [mapTypeId] = mapTypeIds;
return {
center: isDesktop ? { lat: 25, lng: -2.5 } : { lat: 0, lng: 0 },
zoom: isDesktop ? 2 : 1,
scrollwheel: false,
streetViewControl: false,
fullscreenControl: true,
mapTypeId,
mapTypeControlOptions: {
mapTypeIds,
style: google.maps.MapTypeControlStyle.DEFAULT,
},
};
};
module.exports = {
commonInfo,
databasePath,
selectorsTitles,
googleMapConfig,
};