better transition from map to explore
This commit is contained in:
parent
aa96d074af
commit
a44edbb17e
2 changed files with 4 additions and 2 deletions
|
@ -59,6 +59,7 @@ const _Router = Backbone.Router.extend({
|
|||
|
||||
Views.ExploreMaps.setCollection(Metamaps.Maps.Active)
|
||||
if (Metamaps.Maps.Active.length === 0) {
|
||||
Views.ExploreMaps.pending = true
|
||||
Metamaps.Maps.Active.getMaps(navigate) // this will trigger an explore maps render
|
||||
} else {
|
||||
Views.ExploreMaps.render(navigate)
|
||||
|
@ -134,6 +135,7 @@ const _Router = Backbone.Router.extend({
|
|||
}
|
||||
if (Metamaps.Maps[capitalize].length === 0) {
|
||||
Metamaps.Loading.show()
|
||||
Views.ExploreMaps.pending = true
|
||||
setTimeout(function () {
|
||||
Metamaps.Maps[capitalize].getMaps(navigate) // this will trigger an explore maps render
|
||||
}, 300) // wait 300 milliseconds till the other animations are done to do the fetch
|
||||
|
|
|
@ -41,7 +41,7 @@ class Maps extends Component {
|
|||
}
|
||||
|
||||
render = () => {
|
||||
const { maps, currentUser, juntoState, section, user, moreToLoad, loadMore, onStar, onRequest } = this.props
|
||||
const { maps, currentUser, juntoState, pending, section, user, moreToLoad, loadMore, onStar, onRequest } = this.props
|
||||
const style = { width: this.state.mapsWidth + 'px' }
|
||||
|
||||
return (
|
||||
|
@ -49,7 +49,7 @@ class Maps extends Component {
|
|||
<div id='exploreMaps' ref='maps'>
|
||||
<div style={ style }>
|
||||
{ user ? <MapperCard user={ user } /> : null }
|
||||
{ currentUser && !user ? <div className="map newMap"><a href="/maps/new"><div className="newMapImage"></div><span>Create new map...</span></a></div> : null }
|
||||
{ currentUser && !user && !(pending && maps.length === 0) ? <div className="map newMap"><a href="/maps/new"><div className="newMapImage"></div><span>Create new map...</span></a></div> : null }
|
||||
{ maps.models.map(map => <MapCard key={ map.id } map={ map } juntoState={ juntoState } currentUser={ currentUser } onStar={ onStar } onRequest={ onRequest } />) }
|
||||
<div className='clearfloat'></div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue