|
1
|
|
|
export const API_URL = "http://localhost:3535/v1"; |
|
2
|
|
|
const githubAuthUrl = 'https://github.com/login/oauth/authorize'; |
|
3
|
|
|
const clientId = 'Ov23liY1kaJ2acYLtBhq'; |
|
4
|
|
|
const redirectUri = 'http://localhost:5173/github/callback'; |
|
5
|
|
|
const scope = 'user:email'; |
|
6
|
|
|
import markerIcon from '../assets/images/station.png'; |
|
7
|
|
|
import markerblack from '../assets/images/marker-icon-2x-black.png'; |
|
8
|
|
|
// import markerblue from '../assets/images/marker-icon-2x-blue.png'; |
|
9
|
|
|
// import markergreen from '../assets/images/marker-icon-2x-green.png'; |
|
10
|
|
|
// import markergrey from '../assets/images/marker-icon-2x-grey.png'; |
|
11
|
|
|
// import markerorange from '../assets/images/marker-icon-2x-orange.png'; |
|
12
|
|
|
// import markerred from '../assets/images/marker-icon-2x-red.png'; |
|
13
|
|
|
// import markerviolet from '../assets/images/marker-icon-2x-violet.png'; |
|
14
|
|
|
import markeryellow from '../assets/images/marker-icon-2x-yellow.png'; |
|
15
|
|
|
import { Bounce, ToastOptions } from 'react-toastify'; |
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
export const GITHUB_URL = `${githubAuthUrl}?client_id=${clientId}&redirect_uri=${redirectUri}&scope=${scope}`; |
|
20
|
|
|
import L from 'leaflet'; |
|
21
|
|
|
|
|
22
|
|
|
export const getHeader = (token: string, contentType?: string ) => { |
|
23
|
|
|
const config = { |
|
24
|
|
|
headers: { |
|
25
|
|
|
"Content-type" : contentType || "application/json", |
|
26
|
|
|
"Authorization": `Bearer ${token}` |
|
27
|
|
|
} |
|
28
|
|
|
} |
|
29
|
|
|
return config; |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
export const iconStation = new L.Icon({ |
|
34
|
|
|
iconUrl: markerIcon, |
|
35
|
|
|
iconSize: [38, 38], // size of the icon |
|
36
|
|
|
shadowSize: [50, 64], // size of the shadow |
|
37
|
|
|
iconAnchor: [19, 38], // point of the icon which will correspond to marker's location |
|
38
|
|
|
shadowAnchor: [4, 62], // the same for the shadow |
|
39
|
|
|
popupAnchor: [-3, -76], // point from which the popup should open relative to the iconAnchor |
|
40
|
|
|
}); |
|
41
|
|
|
|
|
42
|
|
|
|
|
43
|
|
|
export function giveMarkerPin(index: number) { |
|
44
|
|
|
// const markers = [ |
|
45
|
|
|
// markeryellow, |
|
46
|
|
|
// markerblack, |
|
47
|
|
|
// markerblue, |
|
48
|
|
|
// markergreen, |
|
49
|
|
|
// markergrey, |
|
50
|
|
|
// markerorange, |
|
51
|
|
|
// markerred, |
|
52
|
|
|
// markerviolet ] |
|
53
|
|
|
|
|
54
|
|
|
const markers = [ |
|
55
|
|
|
markeryellow, |
|
56
|
|
|
markerblack] |
|
57
|
|
|
|
|
58
|
|
|
const marker = markers[index % markers.length]; |
|
59
|
|
|
|
|
60
|
|
|
return new L.Icon({ |
|
61
|
|
|
iconUrl: marker, |
|
62
|
|
|
iconSize: [25, 41], // Width and height of the icon |
|
63
|
|
|
iconAnchor: [12, 41], // The "tip" of the icon (bottom-middle) |
|
64
|
|
|
popupAnchor: [1, -34], // The point where the popup opens relative to the iconAnchor |
|
65
|
|
|
tooltipAnchor: [16, -28], // The point where the tooltip opens relative to the iconAnchor |
|
66
|
|
|
shadowSize: [41, 41], // Size of the shadow image |
|
67
|
|
|
shadowAnchor: [13, 41], |
|
68
|
|
|
}); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
export function giveColor(index: number) { |
|
73
|
|
|
// const colorArray = [ |
|
74
|
|
|
// "green", |
|
75
|
|
|
// "blue", |
|
76
|
|
|
// "orange", |
|
77
|
|
|
// "purple", |
|
78
|
|
|
// "pink", |
|
79
|
|
|
// "brown", |
|
80
|
|
|
// "black", |
|
81
|
|
|
// ] |
|
82
|
|
|
const colorArray = [ |
|
83
|
|
|
"yellow", |
|
84
|
|
|
"black" |
|
85
|
|
|
] |
|
86
|
|
|
return colorArray[index % 9 - 1] |
|
87
|
|
|
|
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
|
|
91
|
|
|
export const toastOptionsSuccess: ToastOptions = { |
|
92
|
|
|
position: "top-right", |
|
93
|
|
|
autoClose: 5000, |
|
94
|
|
|
hideProgressBar: false, |
|
95
|
|
|
closeOnClick: false, |
|
96
|
|
|
pauseOnHover: true, |
|
97
|
|
|
draggable: true, |
|
98
|
|
|
progress: undefined, |
|
99
|
|
|
theme: "colored", |
|
100
|
|
|
transition: Bounce, |
|
101
|
|
|
}; |
|
102
|
|
|
|
|
103
|
|
|
export const toastOptionsError: ToastOptions = { |
|
104
|
|
|
position: "top-right", |
|
105
|
|
|
autoClose: 5000, |
|
106
|
|
|
hideProgressBar: false, |
|
107
|
|
|
closeOnClick: false, |
|
108
|
|
|
pauseOnHover: true, |
|
109
|
|
|
draggable: true, |
|
110
|
|
|
progress: undefined, |
|
111
|
|
|
theme: "colored", |
|
112
|
|
|
transition: Bounce |
|
113
|
|
|
} |
|
114
|
|
|
|