diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 0000000..688abaa
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+0.10
\ No newline at end of file
diff --git a/README.md b/README.md
index 39dd534..8141ae7 100644
--- a/README.md
+++ b/README.md
@@ -36,10 +36,20 @@ npm run dist
to compile, and copy all site files to the `dist/` folder
+## How I should install correct node version, npm and bower?
+the best result you can have with [nvm](https://github.com/nvm-sh/nvm).
+
+* Install it with a simple instruction on the link.
+* install correct node version for the app by using `nvm install 0.10`
+* use installed `node` with command `nvm use 0.10`
+* Install `bower` with command `npm install -g bower`
+* you already have correct `npm version`
+
+
## How do I install it?
* clone the repo
- * make sure you have [node](https://nodejs.org/) and [bower](http://bower.io/) installed
+ * make sure you have [node](https://nodejs.org/) and [bower](http://bower.io/) installed. Check `How I should install correct node version?` section in case of any problem.
* in the root of the repo, run ```npm install```
* in the root of the repo, run ```bower install```
* in a separate terminal window run ```npm start```
diff --git a/src/app/router.js b/src/app/router.js
index f4ddb4c..4b7cd02 100644
--- a/src/app/router.js
+++ b/src/app/router.js
@@ -16,11 +16,12 @@ define([
'views/layout/activity_indicator',
'views/layout/mobile-alert',
'views/modals/modal-model',
- 'views/modals/modal'
+ 'views/modals/modal',
+ 'views/layout/landing'
], function($, deparam, _, Backbone, CityModel,
CityBuildings, HeaderView, FooterView, MapView,
AddressSearchView, YearControlView,
- BuildingComparisonView, ActivityIndicator, MobileAlert, ModalModel, ModalController) {
+ BuildingComparisonView, ActivityIndicator, MobileAlert, ModalModel, ModalController, Landing) {
var RouterState = Backbone.Model.extend({
queryFields: ['filters', 'categories', 'layer', 'metrics', 'sort', 'order', 'lat', 'lng', 'zoom', 'building'],
@@ -104,6 +105,7 @@ define([
var comparisonView = new BuildingComparisonView({state: this.state});
var footerView = new FooterView({state: this.state});
var mobileAlert = new MobileAlert({state: this.state});
+ var landing = new Landing({state: this.state});
// $(window).on('resize.main', _.debounce(_.bind(this.onWindowResize, this), 200));
// this.onWindowResize();
diff --git a/src/app/templates/layout/landing-cards.html b/src/app/templates/layout/landing-cards.html
new file mode 100644
index 0000000..72756f3
--- /dev/null
+++ b/src/app/templates/layout/landing-cards.html
@@ -0,0 +1,5 @@
+
+
<%= title %>
+ <%= unit %>
+ <%= value %>
+
\ No newline at end of file
diff --git a/src/app/templates/layout/landing.html b/src/app/templates/layout/landing.html
new file mode 100644
index 0000000..ab873be
--- /dev/null
+++ b/src/app/templates/layout/landing.html
@@ -0,0 +1,15 @@
+
+
+ Energy benchmarking means tracking a building's energy and water use and using a standard metric to compare the building's
+ performance against past performance and to its peers nationwide.
+ These companions have been shown to drive energy efficiency upgrades and increase occupancy rates and property values.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/views/layout/landing.js b/src/app/views/layout/landing.js
new file mode 100644
index 0000000..aa7a466
--- /dev/null
+++ b/src/app/views/layout/landing.js
@@ -0,0 +1,336 @@
+define([
+ 'jquery',
+ 'underscore',
+ 'backbone',
+ 'store',
+ 'd3',
+ 'text!templates/layout/landing.html',
+ 'text!templates/layout/landing-cards.html',
+ 'text!templates/layout/footer.html'
+], function($, _, Backbone, Store, d3, LandingTemplate, LandingCardsTemplate, FooterTemplate){
+ var TOTAL_GHG_EMISSIONS = 'Total Greenhouse emissions';
+ var TOTAL_GHG_EMISSIONS_UNIT = 'kg CO2e';
+ var TOTAL_GROSS_FLOOR_AREA_COVERED = 'Total Gross Floor Area Covered';
+ var TOTAL_ENERGY_CONSUMPTION = 'Total Energy Consumption';
+ var TOTAL_ENERGY_CONSUMPTION_UNIT = '(% kBtu)';
+ var TOTAL_BUILDING_REPORTED = 'Total building Reported';
+ var SUBMISSIONS_RECEIVED = '% Submissions Received';
+ var DATA_COMPLETE_AND_ACCURATE = 'Data Complete and Accurate';
+
+ var Landing = Backbone.View.extend({
+ el: '#landing',
+
+ initialize: function(options){
+ this.state = options.state;
+ this.template = _.template(LandingTemplate);
+ this.cardTemplate = _.template(LandingCardsTemplate);
+ this.mainContainer = $('.main-container');
+
+ // when loader hide, we have all the data
+ this.listenTo(this.state, 'hideActivityLoader', this.render);
+
+ },
+
+ events: {
+ 'click #navigate-further': 'onContinue',
+ 'click .modal-link': 'onModalLink'
+ },
+
+ renderCardsAndHistogram: function () {
+ this.getSiteEUI();
+ this.$el.find('.landing-main-container--cards').html(
+ this.getTotalGhgEmissions() +
+ this.getReportedGrossFloorArea() +
+ this.getTotalBuildingsReported() +
+ this.getTotalEnergyConsumption() +
+ this.getSubmissionReceived() +
+ this.getDataCompleteAndAccurate()
+ );
+
+ },
+
+ onContinue: function() {
+ this.mainContainer.removeClass('scroll-blocked');
+ this.remove();
+ },
+
+ onModalLink: function(evt) {
+ if (evt.preventDefault) evt.preventDefault();
+
+ // Since this is a modal link, we need to make sure
+ // our handler exists
+ var modelFn = this.state.get('setModal');
+ if (!modelFn) return false;
+
+ modelFn(evt.target.dataset.modal);
+
+ return false;
+ },
+
+ getSiteEUI: function () {
+ var allbuildings = this.state.get('allbuildings');
+ if(allbuildings) {
+ var siteEui = allbuildings.map(building => building.get('site_eui')).filter(item => item !== null);
+ siteEui = siteEui.reduce((acc, value, i, arr) => {
+ if(i === arr.length - 1) {
+ return (acc + value) / arr.length;
+ }
+ return acc + value;
+ }, 0);
+ }
+ },
+
+ buildD3Histogram: function (data) {
+ var margin = {top: 60, right: 30, bottom: 60, left: 60};
+ var width = 900 - margin.left - margin.right;
+ var height = 400 - margin.top - margin.bottom;
+
+ var title = 'Average Site EUI';
+ var titleX = 'Year';
+
+ var svg = d3.select('#landing-histogram')
+ .append('svg')
+ .style({width: '100%', height: '100%'})
+ .attr("viewBox", `0 0 ${width + margin.left + margin.right} ${height + margin.top + margin.bottom}`)
+ .attr('preserveAspectRatio', "xMidYMid meet")
+ .append('g')
+ .attr('transform',
+ 'translate(' + margin.left + ',' + margin.top + ')')
+
+ var x = d3.time.scale()
+ .domain(d3.extent(data, (d)=> new Date(d.date)))
+ .range([ 0, width ]);
+ var y = d3.scale.linear()
+ .domain( [0, 100])
+ .range([ height, 0 ]);
+
+ // Add X axis --> it is a date format
+ svg.append('g')
+ .attr('transform', 'translate(0,' + height + ')')
+ .attr('class', 'x-axis')
+ .call(
+ d3.svg.axis()
+ .scale(x)
+ .orient('bottom')
+ .ticks(12)
+ );
+
+ // Add Y axis
+ svg.append('g')
+ .attr('class', 'y-axis')
+ .call(
+ d3.svg.axis()
+ .scale(y)
+ .orient('left')
+ .ticks(10)
+ );
+
+ // Add the line
+ svg.append('path')
+ .datum(data)
+ .attr('fill', 'none')
+ .attr('stroke', 'steelblue')
+ .attr('stroke-width', 1.5)
+ .attr('d', d3.svg.line()
+ .x(function(d) { return x(new Date(d.date)) })
+ .y(function(d) { return y(d.value) })
+ )
+
+ // Tooltip
+ var Tooltip = d3.select('#landing-histogram')
+ .append('div')
+ .attr('class', 'tooltip')
+
+ var mouseover = function(d) {
+ Tooltip
+ .attr('class', 'tooltip tooltip__visible')
+ }
+ var mousemove = function(d) {
+ Tooltip
+ .html(`