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 {
...
@@ -162,7 +162,10 @@ class Home extends Component {
.
collection
(
'device'
)
.
collection
(
'device'
)
.
doc
(
allDevicesId
[
i
])
.
doc
(
allDevicesId
[
i
])
.
get
();
.
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
)
{
if
(
i
===
allDevicesId
.
length
-
1
)
{
this
.
setState
({
allDeviceInfo
});
this
.
setState
({
allDeviceInfo
});
}
}
...
@@ -224,7 +227,7 @@ class Home extends Component {
...
@@ -224,7 +227,7 @@ class Home extends Component {
currentLast
:
currentLast
:
Math
.
round
(
Math
.
round
(
response
.
data
.
queries
[
0
].
results
[
5
].
values
[
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
][
1
]
*
100
)
/
100
,
)
/
100
,
revenueTotal
:
Math
.
round
(
this
.
getTotal
(
response
.
data
.
queries
[
0
].
results
[
4
].
values
)
*
100
)
/
100
,
revenueTotal
:
Math
.
round
(
this
.
getTotal
(
response
.
data
.
queries
[
0
].
results
[
4
].
values
)
*
100
)
/
100
,
...
@@ -241,7 +244,7 @@ class Home extends Component {
...
@@ -241,7 +244,7 @@ class Home extends Component {
remoteAvg
:
Math
.
round
(
this
.
getAvg
(
response
.
data
.
queries
[
0
].
results
[
2
].
values
)
*
100
)
/
100
,
remoteAvg
:
Math
.
round
(
this
.
getAvg
(
response
.
data
.
queries
[
0
].
results
[
2
].
values
)
*
100
)
/
100
,
fingerPrintTotal
:
Math
.
round
(
fingerPrintTotal
:
Math
.
round
(
response
.
data
.
queries
[
0
].
results
[
0
].
values
[
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
][
1
]
*
100
)
/
100
,
)
/
100
,
fingerPrintMax
:
Math
.
round
(
this
.
getMax
(
response
.
data
.
queries
[
0
].
results
[
0
].
values
)
*
100
)
/
100
,
fingerPrintMax
:
Math
.
round
(
this
.
getMax
(
response
.
data
.
queries
[
0
].
results
[
0
].
values
)
*
100
)
/
100
,
...
@@ -249,7 +252,7 @@ class Home extends Component {
...
@@ -249,7 +252,7 @@ class Home extends Component {
fingerPrintAvg
:
Math
.
round
(
this
.
getAvg
(
response
.
data
.
queries
[
0
].
results
[
0
].
values
)
*
100
)
/
100
,
fingerPrintAvg
:
Math
.
round
(
this
.
getAvg
(
response
.
data
.
queries
[
0
].
results
[
0
].
values
)
*
100
)
/
100
,
keycardTotal
:
Math
.
round
(
keycardTotal
:
Math
.
round
(
response
.
data
.
queries
[
0
].
results
[
3
].
values
[
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
][
1
]
*
100
)
/
100
,
)
/
100
,
keycardMax
:
Math
.
round
(
this
.
getMax
(
response
.
data
.
queries
[
0
].
results
[
3
].
values
)
*
100
)
/
100
,
keycardMax
:
Math
.
round
(
this
.
getMax
(
response
.
data
.
queries
[
0
].
results
[
3
].
values
)
*
100
)
/
100
,
...
@@ -343,7 +346,7 @@ class Home extends Component {
...
@@ -343,7 +346,7 @@ class Home extends Component {
/
>
/
>
<
/Row
>
<
/Row
>
<
Row
>
<
Row
>
<
Mapbox
/>
<
Mapbox
allDeviceInfo
=
{
allDeviceInfo
}
/
>
<
/Row
>
<
/Row
>
<
Row
>
<
Row
>
<
DataCard
<
DataCard
...
...
src/components/Mapbox.js
View file @
e3599688
...
@@ -14,12 +14,25 @@ const Data = [
...
@@ -14,12 +14,25 @@ const Data = [
{
id
:
5
,
position
:
[
100.679211
,
13.826122
],
name
:
'Fashion Island'
},
{
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
=
{
state
=
{
center
:
[
100.523186
,
13.736717
]
,
center
:
undefined
,
active
:
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
()
{
render
()
{
const
{
center
,
active
,
zoom
}
=
this
.
state
;
const
{
center
,
active
,
zoom
}
=
this
.
state
;
return
(
return
(
...
@@ -46,20 +59,20 @@ export default class Mapbox extends React.Component {
...
@@ -46,20 +59,20 @@ export default class Mapbox extends React.Component {
'circle-stroke-opacity'
:
1
,
'circle-stroke-opacity'
:
1
,
}}
}}
>
>
{
Object
.
keys
(
D
ata
).
map
((
item
,
index
)
=>
(
{
Object
.
keys
(
this
.
state
.
d
ata
).
map
((
item
,
index
)
=>
(
<
Feature
<
Feature
key
=
{
item
}
key
=
{
item
}
coordinates
=
{
D
ata
[
item
].
position
}
coordinates
=
{
this
.
state
.
d
ata
[
item
].
position
}
onMouseEnter
=
{()
=>
onMouseEnter
=
{()
=>
this
.
setState
({
this
.
setState
({
active
:
D
ata
[
item
],
active
:
this
.
state
.
d
ata
[
item
],
})
})
}
}
onClick
=
{()
=>
onClick
=
{()
=>
this
.
setState
({
this
.
setState
({
center
:
D
ata
[
item
].
position
,
center
:
this
.
state
.
d
ata
[
item
].
position
,
zoom
:
[
1
4
],
zoom
:
[
1
5
],
active
:
D
ata
[
item
],
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