Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ehasa-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WIMMA Lab 2019
Overflow
ehasa-frontend
Commits
2a0e7689
Commit
2a0e7689
authored
5 years ago
by
Ronnie Friman
Browse files
Options
Downloads
Patches
Plain Diff
get gameId from url
parent
7caaa498
No related branches found
Branches containing commit
No related tags found
2 merge requests
!46
Development to testing
,
!34
Filter player replay
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/ReplayMap.js
+23
-34
23 additions, 34 deletions
src/components/ReplayMap.js
with
23 additions
and
34 deletions
src/components/ReplayMap.js
+
23
−
34
View file @
2a0e7689
// https://github.com/linghuam/Leaflet.TrackPlayBack
// https://github.com/linghuam/Leaflet.TrackPlayBack
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
L
from
"
leaflet
"
;
import
L
from
"
leaflet
"
;
import
{
Map
,
TileLayer
,
ZoomControl
,
Marker
,
Popup
}
from
"
react-leaflet
"
;
import
{
Map
,
TileLayer
,
ZoomControl
,
Marker
,
Popup
}
from
"
react-leaflet
"
;
import
"
../track-playback/src/leaflet.trackplayback/clock
"
;
import
"
../track-playback/src/leaflet.trackplayback/clock
"
;
...
@@ -26,51 +27,36 @@ export default class ReplayMap extends React.Component {
...
@@ -26,51 +27,36 @@ export default class ReplayMap extends React.Component {
}
}
async
componentDidMount
()
{
async
componentDidMount
()
{
await
this
.
setState
({
gameId
:
await
new
URL
(
window
.
location
.
href
).
searchParams
.
get
(
"
id
"
)
});
await
this
.
fetchPlayerData
();
await
this
.
fetchPlayerData
();
//await this.fetchDrawingData();
//await this.fetchDrawingData();
//this.tickDrawings();
//this.tickDrawings();
this
.
replay
();
this
.
state
.
data
.
length
>
1
?
this
.
replay
()
:
alert
(
"
No replay data was found
"
);
}
}
componentWillReceiveProps
(
nextProps
)
{}
componentWillReceiveProps
(
nextProps
)
{}
// cloud game a1231e2b-aa29-494d-b687-ea2d48cc23df
// local game wimma 314338f9-b0bb-4bf7-9554-769c7b409bce
// local game vbox 16977b13-c419-48b4-b7d6-e7620f27bf39
// fetch player locations from the game
fetchPlayerData
=
async
()
=>
{
fetchPlayerData
=
async
()
=>
{
await
fetch
(
let
res
=
await
fetch
(
`
${
`
${
process
.
env
.
REACT_APP_API_URL
}
/replay/players/
${
this
.
state
.
gameId
}
`
process
.
env
.
REACT_APP_API_URL
);
}
/replay/players/314338f9-b0bb-4bf7-9554-769c7b409bce`
,
{
if
(
res
.
ok
)
{
method
:
"
GET
"
await
this
.
setState
({
data
:
res
.
json
()
});
}
}
else
{
)
alert
(
"
Game not found
"
);
.
then
(
async
res
=>
await
res
.
json
())
window
.
document
.
location
.
href
=
"
/
"
;
.
then
(
}
async
res
=>
{
await
this
.
setState
({
data
:
res
});
},
// Note: it's important to handle errors here
// instead of a catch() block so that we don't swallow
// exceptions from actual bugs in components.
error
=>
{
console
.
log
(
error
);
}
);
};
};
fetchDrawingData
=
async
()
=>
{
fetchDrawingData
=
async
()
=>
{
await
fetch
(
await
fetch
(
`
${
process
.
env
.
REACT_APP_API_URL
}
/replay/
${
this
.
gameId
}
`
,
{
`
${
process
.
env
.
REACT_APP_API_URL
}
/replay/{
method
:
"
GET
"
"lng": 25.72588,
})
"lat": 62.23147
}`
,
{
method
:
"
GET
"
}
)
.
then
(
async
res
=>
await
res
.
json
())
.
then
(
async
res
=>
await
res
.
json
())
.
then
(
.
then
(
async
res
=>
{
async
res
=>
{
...
@@ -170,6 +156,9 @@ export default class ReplayMap extends React.Component {
...
@@ -170,6 +156,9 @@ export default class ReplayMap extends React.Component {
)}
)}
</Map> */
</Map> */
<
React
.
Fragment
>
<
React
.
Fragment
>
<
Link
to
=
"
/
"
>
<
button
>
Game
selection
<
/button
>
<
/Link
>
<
div
className
=
"
map
"
ref
=
"
map
"
/>
<
div
className
=
"
map
"
ref
=
"
map
"
/>
<
/React.Fragment
>
<
/React.Fragment
>
);
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment