11import React , { Component } from "react" ;
22import { Route , Switch } from "react-router-dom" ;
3- import GoogleMap from "./GoogleMap" ;
3+ import Map from './components/maps/Map' ;
44import Login from "./Login" ;
55import Sidebar from "./Sidebar" ;
66import SingleUser from "./SingleUser" ;
7- import { GoogleApiWrapper } from "google-maps-react" ;
87import firebase , { auth } from "~/fire" ;
98import NavBar from "./Navbar" ;
109import NewMap from "./NewMap" ;
1110import CircularLoad from "./CircularProgress" ;
12- import FollowingUsers from "./FollowingUsers"
11+ import FollowingUsers from "./FollowingUsers" ;
1312import FollowersUsers from "./FollowersUsers" ;
14- import CreatedMap from './components/CreatedMap'
15- import AllMaps from './components/AllMaps'
13+ import CreatedMap from "./components/CreatedMap" ;
14+ import AllMaps from "./components/AllMaps" ;
15+ import MapView from "./components/MapView"
1616
1717const db = firebase . firestore ( ) ;
18+ const maps = db . collection ( 'maps' )
1819
19- class App extends Component {
20+ export default class App extends Component {
2021 constructor ( ) {
2122 super ( ) ;
2223 this . state = {
@@ -114,7 +115,8 @@ class App extends Component {
114115
115116 render ( ) {
116117 const { user, documentId, numFollowers, numFollowing } = this . state ;
117- if ( this . state . loading === true ) return < CircularLoad size = { 200 } color = { `secondary` } /> ;
118+ if ( this . state . loading === true )
119+ return < CircularLoad size = { 200 } color = { `secondary` } /> ;
118120 if ( ! user ) return < Login user = { user } /> ;
119121 return (
120122 < div >
@@ -132,19 +134,15 @@ class App extends Component {
132134 < div className = "col-2" >
133135 < Switch >
134136 < Route
135- exact
136- path = "/"
137+ exact path = "/"
137138 render = { ( ) => (
138- < GoogleMap
139- google = { {
140- ...this . props . google ,
141- loc : { lat : 20 , lng : - 70 } ,
142- user : user
143- } }
139+ < Map
140+ google = { this . props . google }
141+ defaultCenter = { { lat : 20 , lng : - 70 } }
142+ defaultZoom = { 10 }
144143 />
145144 ) }
146145 />
147- )} / >
148146 < Route
149147 exact
150148 path = "/following/:userId"
@@ -172,31 +170,18 @@ class App extends Component {
172170 path = "/newmap/:id"
173171 render = { ( ) => < NewMap google = { this . props . google } /> }
174172 />
175- < Route
176- exact path = "/allmaps/:uid"
173+ < Route
174+ exact
175+ path = "/allmaps/:uid"
177176 render = { ( ) => < AllMaps signedInUser = { user } /> }
178177 />
179178 < Route
180179 exact
181180 path = "/map/:id"
182- render = { ( ) => (
183- < CreatedMap
184- google = { this . props . google }
185- followerUserId = { this . state . user . uid }
186- />
187- ) }
188- />
189- < Route
190- path = "/"
191- render = { ( ) => (
192- < GoogleMap
193- google = { {
194- ...this . props . google ,
195- loc : { lat : 20 , lng : - 70 } ,
196- user : user
197- } }
198- />
199- ) }
181+ component = {
182+ ( { match : { params : { id} } } ) =>
183+ < MapView of = { maps . doc ( id ) } />
184+ }
200185 />
201186 )} / >
202187 </ Switch >
@@ -206,7 +191,3 @@ class App extends Component {
206191 ) ;
207192 }
208193}
209-
210- export default GoogleApiWrapper ( {
211- apiKey : "AIzaSyBNO9SHxnyzMG6J1FCDYcle7DjXMjg6jBU"
212- } ) ( App ) ;
0 commit comments