|
@@ -1,37 +1,12 @@
|
|
|
import React from 'react';
|
|
|
-import { compose, withProps } from "recompose";
|
|
|
-import { withScriptjs, withGoogleMap, StreetViewPanorama, GoogleMap, Marker } from "react-google-maps";
|
|
|
import { gameInfo, getGuesses, sendGuess } from "../../services/ggsh.service";
|
|
|
-import withGoogleApiKey from "../with-google-key.component";
|
|
|
import GuessPane from "./guess-pane.component";
|
|
|
import Loading from '../loading.component';
|
|
|
+import PositionedStreetView from "../maps/positioned-street-view.component";
|
|
|
|
|
|
// TODO want a button for moving the pano back to start somehow
|
|
|
|
|
|
-const getMapUrl = googleApiKey => `https://maps.googleapis.com/maps/api/js?key=${googleApiKey}&v=3.exp&libraries=geometry,drawing,places`
|
|
|
-
|
|
|
-const PositionedStreetView = compose(
|
|
|
- withProps({
|
|
|
- loadingElement: <div style={{ height: `100%` }} />,
|
|
|
- containerElement: <div style={{ height: "100%" }} />,
|
|
|
- mapElement: <div style={{ height: `100%` }} />,
|
|
|
- }),
|
|
|
- withScriptjs,
|
|
|
- withGoogleMap
|
|
|
-)(({ point }) =>
|
|
|
- <StreetViewPanorama
|
|
|
- defaultPosition={point}
|
|
|
- options={{
|
|
|
- addressControl: false,
|
|
|
- showRoadLabels: false,
|
|
|
- clickToGo: true,
|
|
|
- }}
|
|
|
- visible
|
|
|
- />
|
|
|
-);
|
|
|
-
|
|
|
const GamePanel = ({
|
|
|
- googleApiKey,
|
|
|
onSelectPoint,
|
|
|
onSubmitGuess,
|
|
|
streetViewPoint,
|
|
@@ -47,12 +22,7 @@ const GamePanel = ({
|
|
|
alignItems: "center"
|
|
|
}}>
|
|
|
<div style={{ height: "100%", margin: "2px", flex: 3 }}>
|
|
|
- <div style={{ position: "relative", height: "100%" }}>
|
|
|
- <PositionedStreetView
|
|
|
- googleMapURL={getMapUrl(googleApiKey)}
|
|
|
- point={streetViewPoint}
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <PositionedStreetView position={streetViewPoint} />
|
|
|
</div>
|
|
|
<GuessPane
|
|
|
roundSeconds={roundSeconds}
|
|
@@ -64,8 +34,6 @@ const GamePanel = ({
|
|
|
</div>
|
|
|
);
|
|
|
|
|
|
-const GamePanelWithApiKey = withGoogleApiKey(GamePanel);
|
|
|
-
|
|
|
class GamePanelContainer extends React.Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
@@ -122,7 +90,7 @@ class GamePanelContainer extends React.Component {
|
|
|
}
|
|
|
|
|
|
return (
|
|
|
- <GamePanelWithApiKey
|
|
|
+ <GamePanel
|
|
|
onSelectPoint={selectedPoint => this.setState({ selectedPoint })}
|
|
|
onSubmitGuess={() => this.handleSubmitGuess()}
|
|
|
streetViewPoint={targetPoint}
|