-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Maps for location and fixed busiest time
Signed-off-by: knrt10 <tripathi.kautilya@gmail.com>
- Loading branch information
Showing
5 changed files
with
53 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/livechat/client/views/app/realtimevisitors/livechatRealTimeVisitorSession.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,39 @@ | ||
import { Template } from 'meteor/templating'; | ||
import { ReactiveVar } from 'meteor/reactive-var'; | ||
|
||
import { settings } from '../../../../../settings'; | ||
import { t } from '../../../../../utils'; | ||
import './livechatRealTimeVisitorSession.html'; | ||
|
||
|
||
Template.visitorSession.helpers({ | ||
user() { | ||
return Template.instance().data; | ||
}, | ||
pageTitle() { | ||
return this.navigation.page.title || t('Empty_title'); | ||
}, | ||
geolocationError() { | ||
const access = Template.instance().geolocation.get(); | ||
if (!access) { | ||
return t('Livechat_session_geolocation'); | ||
} | ||
}, | ||
mapOptions() { | ||
const { location: { latitude, longitude } } = Template.instance().data; | ||
return `https://maps.googleapis.com/maps/api/staticmap?zoom=14&size=500x250&markers=color:gray%7Clabel:%7C${ latitude },${ longitude }&key=${ settings.get('MapView_GMapsAPIKey') }`; | ||
}, | ||
}); | ||
|
||
Template.visitorSession.onCreated(function() { | ||
this.geolocation = new ReactiveVar(true); | ||
this.autorun(() => { | ||
const isMapViewEnabled = settings.get('MapView_Enabled') === true; | ||
const googleMapsApiKey = settings.get('MapView_GMapsAPIKey'); | ||
const canGetGeolocation = isMapViewEnabled && (googleMapsApiKey && googleMapsApiKey.length); | ||
|
||
if (!canGetGeolocation) { | ||
Template.instance().geolocation.set(false); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters