Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/control/content/components/LocationsActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LocationsActionBar extends React.Component {
onFileChange() {
const file = this.fileInput.files[0];
const reader = new FileReader();

console.log(file);
reader.onload = (e) => {
const rows = csv.parse(e.target.result).slice(1);
const { places } = this.props;
Expand All @@ -42,6 +42,7 @@ class LocationsActionBar extends React.Component {
description,
image,
] = row;
console.log(locations);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it please.

const selectedCategory = [];

const cat = Number.isInteger(categories)
Expand Down Expand Up @@ -134,6 +135,8 @@ class LocationsActionBar extends React.Component {
if (!promises.length) {
while (locations.length) {
let paginatedLocations = locations.splice(0, 500);
console.log("paginated locations");
console.log(paginatedLocations[0]);
this.props.onMultipleSubmit(paginatedLocations);
}
} else {
Expand All @@ -143,6 +146,8 @@ class LocationsActionBar extends React.Component {
window.locs = locs;
while (locs.length) {
let paginatedLocations = locs.splice(0, 500);
console.log("paginated locations");
console.log(paginatedLocations);
this.props.onMultipleSubmit(paginatedLocations);
}
});
Expand Down Expand Up @@ -289,6 +294,7 @@ class LocationsActionBar extends React.Component {
)}
</div>
</div>

<div className="col-xs-8">
<input
onChange={() => this.onFileChange()}
Expand Down
36 changes: 35 additions & 1 deletion src/control/content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ class Content extends React.Component {
* @param {Object} locations Locations array
*/
onMultipleLocationSubmit(locations) {

locations = locations.filter((location) => typeof location === "object");
let locationsForUpdate = [];
let locationsForInsert = [];
Expand Down Expand Up @@ -520,13 +521,46 @@ class Content extends React.Component {
console.error(err);
} else if (result && result.data && result.data.length) {
const newDataCount = result.data.length;

for (let skip = 0; skip < newDataCount; skip += 50) {
buildfire.datastore.search(
{ filter: {}, skip, limit: 50 },
{ filter: {}, skip, limit: 50, sort:{createdOn : -1} },
"places-list",
(err, innerResult) => {
if (err) return;

innerResult.forEach((item) => {
console.log("GOING TO ADD TO SEARCH ENGINE");
if(item && item.id && item.data.title){
let insertData = {
tag: "place-data",
title: item.data.title,
description: item.data.description ? item.data.description.replace(/(<([^>]+)>)/gi, "") : "",
imageUrl: item.data.image ? item.data.image : "",
keywords: item.data.subtitle ? item.data.subtitle : "",
data: {
placeId: item.id,
},
};


SearchEngine.insert(insertData, (callbackData) => {
console.log(callbackData);
});


}











Deeplink.getById(item.id, (err, locationDeeplink) => {
if (!err && locationDeeplink) {
locationDeeplink.name = item.data.title
Expand Down
2 changes: 1 addition & 1 deletion src/widget/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="utf-8">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBOp1GltsWARlkHhF1H_cb6xtdR1pvNDAk"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBOp1GltsWARlkHhF1H_cb6xtdR1pvNDAk&sensor=false"></script>
<script src="../../../scripts/_bundles/buildfire_lightcarousel.min.js"></script>
<link rel="stylesheet" href="https://cdn.quilljs.com/1.0.0/quill.snow.css"/>
<script src="../../../scripts/buildfire/components/toast/toast.js"></script>
Expand Down
39 changes: 21 additions & 18 deletions src/widget/js/map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Handlebars from "./lib/handlebars"

import { stringsConfig } from "../js/shared/stringsConfig";
import "../js/shared/strings";

Expand Down Expand Up @@ -166,6 +165,7 @@ window.mapView = {
};

// Add a marker clusterer to manage the markers.
console.log("is error from here");
mapView.settings.markerClusterer = new MarkerClusterer(map, app.state.markers, clusterOptions);

},
Expand Down Expand Up @@ -222,22 +222,24 @@ window.mapView = {
});
}
if (skip) return;
let marker = new google.maps.Marker({
position: place.address,
markerData: place,
map: map,
icon: mapView.createMarker(iconType)
});

if(place.address){
let lat = place.address.lat,
lng = place.address.lng;

app.state.markers.push(marker);
app.state.bounds.extend({lat, lng});
if (mapView.settings.markerClusterer) mapView.settings.markerClusterer.addMarker(marker);

marker.addListener('click', () => {mapView.markerClick(place, marker)});
if(place && place.address && place.address.lat && place.address.lng){
let marker = new google.maps.Marker({
position: place.address,
markerData: place,
map: map,
icon: mapView.createMarker(iconType)
});

if(place.address){
let lat = place.address.lat,
lng = place.address.lng;

app.state.markers.push(marker);
app.state.bounds.extend({lat, lng});
if (mapView.settings.markerClusterer) mapView.settings.markerClusterer.addMarker(marker);

marker.addListener('click', () => {mapView.markerClick(place, marker)});
}
}
},
markerClick: (place, marker) => {
Expand Down Expand Up @@ -389,5 +391,6 @@ window.mapView = {

window.originalHeight = (app.views.mapView) ? app.views.mapView.getBoundingClientRect().height: 0;

}
},

};
1 change: 0 additions & 1 deletion src/widget/js/shared/Deeplink.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default class Deeplink {
console.error(err, '<<< ERROR WHILE REGISTERING DEEP LINK.');
return callback(err);
}

callback(null, {
deeplinkId: result && result.data && result.data.deeplinkId ? result.data.deeplinkId : null,
deeplinkData: new Deeplink(result && result.data ? result.data : null)
Expand Down
2 changes: 2 additions & 0 deletions src/widget/list.html
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<div class="listViewFilter" id="filter"></div>
<div style="padding: 20px;">
</div>
1 change: 1 addition & 0 deletions src/widget/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
<div id="googleMap" style="height:100%;width:100%;position:absolute;"></div>
<div class="mapCenter" id="mapCenter"></div>
<div class="listViewFilter" id="mapFilter"></div>