Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
toiletcoin
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
atichat
toiletcoin
Commits
e3599688
Commit
e3599688
authored
Aug 07, 2019
by
Chaiwith Santaweesuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update map
parent
72949ed5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
14 deletions
+30
-14
src/Pages/Home.js
+8
-5
src/components/Mapbox.js
+22
-9
No files found.
src/Pages/Home.js
View file @
e3599688
...
...
@@ -162,7 +162,10 @@ class Home extends Component {
.
collection
(
'device'
)
.
doc
(
allDevicesId
[
i
])
.
get
();
allDeviceInfo
.
push
(
deviceInfo
.
data
());
let
devicedata
=
deviceInfo
.
data
();
devicedata
.
deviceid
=
allDevicesId
[
i
]
devicedata
.
position
=
[
devicedata
.
location
.
_long
,
devicedata
.
location
.
_lat
]
allDeviceInfo
.
push
(
devicedata
);
if
(
i
===
allDevicesId
.
length
-
1
)
{
this
.
setState
({
allDeviceInfo
});
}
...
...
@@ -224,7 +227,7 @@ class Home extends Component {
currentLast
:
Math
.
round
(
response
.
data
.
queries
[
0
].
results
[
5
].
values
[
response
.
data
.
queries
[
0
].
results
[
5
].
values
.
length
-
1
response
.
data
.
queries
[
0
].
results
[
5
].
values
.
length
-
1
][
1
]
*
100
)
/
100
,
revenueTotal
:
Math
.
round
(
this
.
getTotal
(
response
.
data
.
queries
[
0
].
results
[
4
].
values
)
*
100
)
/
100
,
...
...
@@ -241,7 +244,7 @@ class Home extends Component {
remoteAvg
:
Math
.
round
(
this
.
getAvg
(
response
.
data
.
queries
[
0
].
results
[
2
].
values
)
*
100
)
/
100
,
fingerPrintTotal
:
Math
.
round
(
response
.
data
.
queries
[
0
].
results
[
0
].
values
[
response
.
data
.
queries
[
0
].
results
[
0
].
values
.
length
-
1
response
.
data
.
queries
[
0
].
results
[
0
].
values
.
length
-
1
][
1
]
*
100
)
/
100
,
fingerPrintMax
:
Math
.
round
(
this
.
getMax
(
response
.
data
.
queries
[
0
].
results
[
0
].
values
)
*
100
)
/
100
,
...
...
@@ -249,7 +252,7 @@ class Home extends Component {
fingerPrintAvg
:
Math
.
round
(
this
.
getAvg
(
response
.
data
.
queries
[
0
].
results
[
0
].
values
)
*
100
)
/
100
,
keycardTotal
:
Math
.
round
(
response
.
data
.
queries
[
0
].
results
[
3
].
values
[
response
.
data
.
queries
[
0
].
results
[
3
].
values
.
length
-
1
response
.
data
.
queries
[
0
].
results
[
3
].
values
.
length
-
1
][
1
]
*
100
)
/
100
,
keycardMax
:
Math
.
round
(
this
.
getMax
(
response
.
data
.
queries
[
0
].
results
[
3
].
values
)
*
100
)
/
100
,
...
...
@@ -343,7 +346,7 @@ class Home extends Component {
/
>
<
/Row
>
<
Row
>
<
Mapbox
/>
<
Mapbox
allDeviceInfo
=
{
allDeviceInfo
}
/
>
<
/Row
>
<
Row
>
<
DataCard
...
...
src/components/Mapbox.js
View file @
e3599688
...
...
@@ -14,12 +14,25 @@ const Data = [
{
id
:
5
,
position
:
[
100.679211
,
13.826122
],
name
:
'Fashion Island'
},
];
export
default
class
Mapbox
extends
React
.
Component
{
export
default
class
Mapbox
extends
React
.
Pure
Component
{
state
=
{
center
:
[
100.523186
,
13.736717
]
,
center
:
undefined
,
active
:
undefined
,
zoom
:
[
5
],
zoom
:
[
15
],
data
:[]
};
componentDidUpdate
=
()
=>
{
if
(
this
.
props
.
allDeviceInfo
)
{
let
data1
=
this
.
props
.
allDeviceInfo
;
this
.
setState
({
data
:
data1
,
center
:
data1
[
0
].
position
,
active
:
data1
[
0
]
});
}
};
render
()
{
const
{
center
,
active
,
zoom
}
=
this
.
state
;
return
(
...
...
@@ -46,20 +59,20 @@ export default class Mapbox extends React.Component {
'circle-stroke-opacity'
:
1
,
}}
>
{
Object
.
keys
(
D
ata
).
map
((
item
,
index
)
=>
(
{
Object
.
keys
(
this
.
state
.
d
ata
).
map
((
item
,
index
)
=>
(
<
Feature
key
=
{
item
}
coordinates
=
{
D
ata
[
item
].
position
}
coordinates
=
{
this
.
state
.
d
ata
[
item
].
position
}
onMouseEnter
=
{()
=>
this
.
setState
({
active
:
D
ata
[
item
],
active
:
this
.
state
.
d
ata
[
item
],
})
}
onClick
=
{()
=>
this
.
setState
({
center
:
D
ata
[
item
].
position
,
zoom
:
[
1
4
],
active
:
D
ata
[
item
],
center
:
this
.
state
.
d
ata
[
item
].
position
,
zoom
:
[
1
5
],
active
:
this
.
state
.
d
ata
[
item
],
})
}
/
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment