diff --git a/src/components/AddressSearchBuildings/index.js b/src/components/AddressSearchBuildings/index.js index 139149e018bef1397c2ec581d6204356e7b1cac1..d004d6883841bfd81945d8cf356c3dbc44d0ad98 100644 --- a/src/components/AddressSearchBuildings/index.js +++ b/src/components/AddressSearchBuildings/index.js @@ -27,19 +27,19 @@ class AddressSearchBuildings extends Component { } componentDidMount() { - // Use the buildings stored in cookies to populate the buildingList - const buildingList = localStorage.activeBuildings; - if (buildingList !== undefined) { - this.props.buildingsSearched(JSON.parse(buildingList)); + // Use the buildings stored in cookies to populate the buildings + const buildings = localStorage.activeBuildings; + if (buildings !== undefined) { + this.props.buildingsSearched(JSON.parse(buildings)); } } componentWillReceiveProps(nextProps) { if ( - this.props.buildingList !== nextProps.buildingList + this.props.buildings !== nextProps.buildings ) { this.setState({ - address: nextProps.buildingList.address, + address: nextProps.buildings.address, }); } } @@ -113,7 +113,7 @@ class AddressSearchBuildings extends Component { } AddressSearchBuildings.propTypes = { - buildingList: PropTypes.objectOf, + buildings: PropTypes.objectOf, searchBuildings: PropTypes.func, buildingsSearched: PropTypes.func, setAddress: PropTypes.func, diff --git a/src/components/BuildingListTable/index.js b/src/components/BuildingListTable/index.js index 9d1df7656c8e44a56e3a804a93b83d8996c8ee47..3545941590968ef42e4204bd63571e7ce6095622 100644 --- a/src/components/BuildingListTable/index.js +++ b/src/components/BuildingListTable/index.js @@ -3,7 +3,7 @@ import ReactGA from 'react-ga'; import PropTypes from 'prop-types'; import { browserHistory } from 'react-router'; import './styles.css'; -import { buildingList, loadErrorPropTypes } from '../../containers/SearchBar/propTypes'; +import { loadErrorPropTypes } from '../../containers/SearchBar/propTypes'; import Loading from '../../components/Loading'; /* eslint-disable no-param-reassign */ @@ -167,7 +167,7 @@ export default function BuildingListTable({ } BuildingListTable.propTypes = { - buildings: buildingList, + buildings: PropTypes.arrayOf, loading: PropTypes.bool, error: loadErrorPropTypes.error, loadBuildings: PropTypes.func, diff --git a/src/components/BuildingOverview/index.js b/src/components/BuildingOverview/index.js index fbd573c6f6a179a9cd4532e8583dd4ee0d64a767..3a05a269ac2d07c0c3d4d406b8d84088c302f95a 100644 --- a/src/components/BuildingOverview/index.js +++ b/src/components/BuildingOverview/index.js @@ -17,8 +17,8 @@ export default class BuildingOverview extends Component { if (this.props.projects.loading) { return ; } - const projectList = this.props.projects.projects; - if (!projectList || projectList.length <= 0) { + const projects = this.props.projects.projects; + if (!projects || projects.length <= 0) { return (

No projects

@@ -26,7 +26,7 @@ export default class BuildingOverview extends Component { ); } - return projectList.map(project => ( + return projects.map(project => ( { - let projectList = localStorage.activeProjects; - if (projectList !== undefined) { - projectList = JSON.parse(projectList); + let projects = localStorage.activeProjects; + if (projects !== undefined) { + projects = JSON.parse(projects); const addList = [{ building_id: this.state.buildingId, id: this.state.projectId, @@ -147,7 +147,7 @@ class ProjectOverview extends Component { slug: project.slug, state: project.state, }]; - projectList = projectList.filter((val, index) => { + projects = projects.filter((val, index) => { // Make sure the list is smaller than 300 if (index >= 300) { return false; @@ -159,16 +159,16 @@ class ProjectOverview extends Component { return !sameProject; }); addList.map((val) => { - projectList.unshift(val); + projects.unshift(val); return val; }); } else { - projectList = [{ + projects = [{ building_id: this.state.buildingId, id: this.state.projectId, }]; } - localStorage.setItem('activeProjects', JSON.stringify(projectList)); + localStorage.setItem('activeProjects', JSON.stringify(projects)); } render() { @@ -333,8 +333,12 @@ function mapDispatchToProps(dispatch) { }, dispatch); } -function mapStateToProps({ documents, projectList, user }) { - return { documents, projects: projectList, user }; +function mapStateToProps({ documents, projects, user }) { + return { + documents, + projects, + user, + }; } export default connect(mapStateToProps, mapDispatchToProps)(ProjectOverview); diff --git a/src/components/SideBarDetail/index.js b/src/components/SideBarDetail/index.js index d5c015daaa0da548405d4e0d07ccc2b49919379a..bcd772a7bed2dc0c09cdda2e4422ababea7854e9 100644 --- a/src/components/SideBarDetail/index.js +++ b/src/components/SideBarDetail/index.js @@ -5,7 +5,7 @@ import { UncontrolledTooltip } from 'reactstrap'; import { Icon } from 'react-fa'; import './styles.css'; import { contactsPropTypes } from '../../containers/Project/propTypes'; -import buildingDetailPropType from '../../containers/Building/propTypes'; +import buildingPropType from '../../containers/Building/propTypes'; import { dimensionSVG, utilitySVG, @@ -207,7 +207,7 @@ export default function SideBarDetail({ building, children, contacts, user }) { SideBarDetail.propTypes = { children: PropTypes.element, - building: buildingDetailPropType, + building: buildingPropType, contacts: PropTypes.shape(contactsPropTypes), user: userPropType, }; diff --git a/src/components/Utilities/index.js b/src/components/Utilities/index.js index bda57cde60da427fcf2870105e52c1622ac08a6f..0a0c39faaaae95377c3b6c30ea1121e1967741c9 100644 --- a/src/components/Utilities/index.js +++ b/src/components/Utilities/index.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import ReactGA from 'react-ga'; import PropTypes from 'prop-types'; -import buildingDetailPropTypes from '../../containers/Building/propTypes'; +import buildingPropTypes from '../../containers/Building/propTypes'; import request from '../../utils/request'; import ErrorAlert from '../../components/ErrorAlert'; @@ -449,7 +449,7 @@ class Utilities extends Component { Utilities.propTypes = { buildingId: PropTypes.string, - building: buildingDetailPropTypes, + building: buildingPropTypes, user: userPropType, }; diff --git a/src/containers/BGroup/BGroup.js b/src/containers/BGroup/BGroup.js index 287edbd25c79825dd78677ecb536f16ec59be97c..76d39c4d263a1b15104dd907328552978efdd348 100644 --- a/src/containers/BGroup/BGroup.js +++ b/src/containers/BGroup/BGroup.js @@ -584,9 +584,9 @@ BGroup.defaultProps = { const mapStateToProps = state => ( { bGroup: state.bGroup, - projects: state.projectList, + projects: state.projects, report: state.report, - buildings: state.buildingList, + buildings: state.buildings, } ); diff --git a/src/containers/BGroup/reducer.js b/src/containers/BGroup/reducer.js index b920b2235b75a0c045c467ab5a362e92b77cfaeb..b7b66ab50666e539caa87f205af0171b834dee74 100644 --- a/src/containers/BGroup/reducer.js +++ b/src/containers/BGroup/reducer.js @@ -117,7 +117,7 @@ export default (state = initState, action) => { }; case BGROUP_BUILDINGS_SUCCEEDED: { - const buildings = action.buildings.data.map(i => ({ ...i, first_address: i.address_list.split(',')[0] })); + const buildings = action.buildings.data.map(i => ({ ...i, first_address: i.address_list !== null ? i.address_list.split(',')[0] : '' })); return { ...state, bGroupBuildings: buildings, diff --git a/src/containers/Blocnote/BudgetSimulator/index.js b/src/containers/Blocnote/BudgetSimulator/index.js index 68237c1cf9709621a5d0b9b01f78b4aa74e584a2..f582b08e6cc55ce80ed622035d52c9f3be5bfed9 100644 --- a/src/containers/Blocnote/BudgetSimulator/index.js +++ b/src/containers/Blocnote/BudgetSimulator/index.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import LinkBarDetail from '../../../components/LinkBarDetail'; -import buildingDetailPropTypes from '../../Building/propTypes'; +import buildingPropTypes from '../../Building/propTypes'; import Loading from '../../../components/Loading'; import BugetTable from '../../../components/Blocnote/BudgetSimulator/BugetTable'; import BudgetChart from '../../../components/Blocnote/BudgetSimulator/BudgetChart'; @@ -98,7 +98,7 @@ class BudgetSimulator extends Component { } BudgetSimulator.propTypes = { - building: buildingDetailPropTypes, + building: buildingPropTypes, blocnote: blocnoteProps, loadBudgetSimulator: PropTypes.func, buildingId: PropTypes.string, diff --git a/src/containers/Blocnote/FinancialInputs/index.js b/src/containers/Blocnote/FinancialInputs/index.js index c35c4734339444de7abb8f170263ffc66f249200..3d96f828ce3ff185026133ecf317226b7e8c7dba 100644 --- a/src/containers/Blocnote/FinancialInputs/index.js +++ b/src/containers/Blocnote/FinancialInputs/index.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import LinkBarDetail from '../../../components/LinkBarDetail'; -import buildingDetailPropTypes from '../../Building/propTypes'; +import buildingPropTypes from '../../Building/propTypes'; import Loading from '../../../components/Loading'; import { loadFinanceOverview, loadBills, loadBillsOverview, @@ -268,7 +268,7 @@ class FinancialInputs extends Component { FinancialInputs.propTypes = { buildingId: PropTypes.string, - building: buildingDetailPropTypes, + building: buildingPropTypes, blocnote: blocnoteProps, loadFinanceOverview: PropTypes.func, loadBills: PropTypes.func, diff --git a/src/containers/Blocnote/index.js b/src/containers/Blocnote/index.js index cb1b322eaef63b6fe4a9305aa8f0d53d59a14135..c7f1921de2d1eed5d5a55b7ab425a0f2be6e4652 100644 --- a/src/containers/Blocnote/index.js +++ b/src/containers/Blocnote/index.js @@ -5,7 +5,7 @@ import { bindActionCreators } from 'redux'; import { Table } from 'reactstrap'; import { Link } from 'react-router'; import LinkBarDetail from '../../components/LinkBarDetail'; -import buildingDetailPropTypes from '../Building/propTypes'; +import buildingPropTypes from '../Building/propTypes'; import { loadLandingData } from './actions'; import Loading from '../../components/Loading'; import blocnoteProps from './propTypes'; @@ -153,7 +153,7 @@ class Blocnote extends Component { } Blocnote.propTypes = { - building: buildingDetailPropTypes, + building: buildingPropTypes, loadLandingData: PropTypes.func, blocnote: blocnoteProps, }; diff --git a/src/containers/Building/index.js b/src/containers/Building/index.js index c9e37de155d878dc6742ad88769d1dbdbc5f4115..447b941b201278f014a2d35f877b60469a1d038b 100644 --- a/src/containers/Building/index.js +++ b/src/containers/Building/index.js @@ -75,15 +75,15 @@ class Building extends Component { updateStorage = (props) => { - let buildingList = localStorage.activeBuildings; + let buildings = localStorage.activeBuildings; const placeName = props.overview.place_name; - if (buildingList !== undefined) { - buildingList = JSON.parse(buildingList); + if (buildings !== undefined) { + buildings = JSON.parse(buildings); const addList = [{ ...props.overview, place_name: placeName, }]; - buildingList = buildingList.filter((val, index) => { + buildings = buildings.filter((val, index) => { // Make sure the list is smaller than 300 if (index >= 300) { return false; @@ -103,16 +103,16 @@ class Building extends Component { return !sameLot; }); addList.map((val) => { - buildingList.unshift(val); + buildings.unshift(val); return val; }); } else { - buildingList = [{ + buildings = [{ ...props.overview, place_name: placeName, }]; } - localStorage.setItem('activeBuildings', JSON.stringify(buildingList)); + localStorage.setItem('activeBuildings', JSON.stringify(buildings)); } render() { @@ -190,12 +190,12 @@ function mapDispatchToProps(dispatch) { }, dispatch); } -function mapStateToProps({ buildingDetail, documents, projectList }) { - const { overview } = buildingDetail; +function mapStateToProps({ building, documents, projects }) { + const { overview } = building; return { overview, documents, - projects: projectList, + projects, }; } diff --git a/src/containers/Dimensions/index.js b/src/containers/Dimensions/index.js index 531536a9dc96372ea5ef24829de907333f993572..2400ebfff43e44a9363878da1b12e7dbfae85180 100644 --- a/src/containers/Dimensions/index.js +++ b/src/containers/Dimensions/index.js @@ -50,9 +50,9 @@ class Dimensions extends Component { hitDecision={this.props.hitDecision} deleteHit={this.props.deleteHit} address={` - ${this.props.buildingDetail.overview.street_address} - ${this.props.buildingDetail.overview.borough}, New York - ${this.props.buildingDetail.overview.zipcode} + ${this.props.building.overview.street_address} + ${this.props.building.overview.borough}, New York + ${this.props.building.overview.zipcode} USA`} building_id={parseInt(this.props.buildingId, 10)} hit={this.props.dimensions.hit} @@ -66,8 +66,7 @@ class Dimensions extends Component { Dimensions.propTypes = { buildingId: PropTypes.string, - building: completeOverviewPropTypes, - buildingDetail: PropTypes.shape(overviewPropTypes), + building: PropTypes.shape(overviewPropTypes), dimensions: PropTypes.shape({ hit: turkHitPropTypes, }), @@ -87,8 +86,8 @@ function mapDispatchToProps(dispatch) { }, dispatch); } -function mapStateToProps({ dimensions, buildingDetail, user }) { - return { dimensions, buildingDetail, user }; +function mapStateToProps({ dimensions, building, user }) { + return { dimensions, building, user }; } export default connect(mapStateToProps, mapDispatchToProps)(Dimensions); diff --git a/src/containers/Envelope/index.js b/src/containers/Envelope/index.js index 49cd923e7a505177629cb8e6f9b3d97e4cdcf79a..6a8c60609d4e5819455ac9cd21bbb093cef41014 100644 --- a/src/containers/Envelope/index.js +++ b/src/containers/Envelope/index.js @@ -16,7 +16,7 @@ import { Icon } from 'react-fa'; import LinkBarDetail from '../../components/LinkBarDetail'; import RetrofitTable from './retrofitTable'; -import buildingDetailPropTypes from '../../containers/Building/propTypes'; +import buildingPropTypes from '../../containers/Building/propTypes'; import { loadSimStatus, runSimulation, loadMonthlyHeatingConsumption, loadHeatLossComponentBreakdown, loadDesignLoad, loadUtilityBillBreakdown, @@ -457,7 +457,7 @@ class Envelope extends Component { } Envelope.propTypes = { - building: buildingDetailPropTypes, + building: buildingPropTypes, envelope: envelopeProps, eng: engPropTypes, loadSimStatus: PropTypes.func, diff --git a/src/containers/Performance/index.js b/src/containers/Performance/index.js index 5234f1cff54ccab28650a5456c9d1251815a1d4b..88eeea555fd2124f22033071602e44d15451ca05 100644 --- a/src/containers/Performance/index.js +++ b/src/containers/Performance/index.js @@ -22,7 +22,7 @@ import { loadRetrofitProperties, } from '../Eng/actions'; import engPropTypes from '../Eng/propTypes'; -import buildingDetailPropTypes from '../../containers/Building/propTypes'; +import buildingPropTypes from '../../containers/Building/propTypes'; import LinkBarDetail from '../../components/LinkBarDetail'; import Impacts from '../../components/Performance/Impacts'; import Occupants from '../../components/Performance/Occupants'; @@ -217,7 +217,7 @@ class Performance extends Component { } Performance.propTypes = { - building: buildingDetailPropTypes, + building: buildingPropTypes, loadOccupants: PropTypes.func, loadOccupantsLog: PropTypes.func, loadThermalComfort: PropTypes.func, @@ -258,7 +258,7 @@ const mapDispatchToProps = dispatch => ( ); const mapStateToProps = state => ({ - performance: state.bloclink, + performance: state.performance, user: state.user, eng: state.eng, }); diff --git a/src/containers/Project/index.js b/src/containers/Project/index.js index 58d4f52546f1324bc3e6d22999693421d477425d..2f9ab6d99f884a25f61d46fce1c4cb7d04d1319e 100644 --- a/src/containers/Project/index.js +++ b/src/containers/Project/index.js @@ -26,8 +26,8 @@ class ProjectSearchBar extends Component { constructor(props) { super(props); this.state = { - type: this.props.projectList.type, - term: this.props.projectList.term, + type: this.props.projects.type, + term: this.props.projects.term, searchByDropdownOpen: false, }; } @@ -36,21 +36,21 @@ class ProjectSearchBar extends Component { if (!(this.state.term === '' && this.state.type === 'name')) { this.getProjects(this.state); } else { - // Use the projects stored in cookies to populate the projectList - const projectList = localStorage.activeProjects; - if (projectList !== undefined) { - this.props.projectsLoaded({ data: JSON.parse(projectList) }); + // Use the projects stored in cookies to populate the projects + const projects = localStorage.activeProjects; + if (projects !== undefined) { + this.props.projectsLoaded({ data: JSON.parse(projects) }); } } } componentWillReceiveProps(nextProps) { if ( - this.props.projectList !== nextProps.projectList + this.props.projects !== nextProps.projects ) { this.setState({ - type: nextProps.projectList.type, - term: nextProps.projectList.term, + type: nextProps.projects.type, + term: nextProps.projects.term, }); } } @@ -230,7 +230,7 @@ class ProjectSearchBar extends Component { } ProjectSearchBar.propTypes = { - projectList: completeProjectPropTypes, + projects: completeProjectPropTypes, updateProjectSearchParams: PropTypes.func, loadProjects: PropTypes.func, projectsLoaded: PropTypes.func, @@ -245,8 +245,8 @@ function mapDispatchToProps(dispatch) { }, dispatch); } -function mapStateToProps({ projectList }) { - return { projectList }; +function mapStateToProps({ projects }) { + return { projects }; } export default connect(mapStateToProps, mapDispatchToProps)(ProjectSearchBar); diff --git a/src/containers/Questionnaire/index.js b/src/containers/Questionnaire/index.js index bf4aa04e5f798210c55925fcffac3ed986136d06..742c2bb6d6144bb19711f6835d5f5016df9a3be3 100644 --- a/src/containers/Questionnaire/index.js +++ b/src/containers/Questionnaire/index.js @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { Button } from 'reactstrap'; import Loading from '../../components/Loading'; -import buildingDetailPropTypes from '../Building/propTypes'; +import buildingPropTypes from '../Building/propTypes'; import { loadQuestionnaire, submitQuestionnaire, @@ -431,7 +431,7 @@ class Questionnaire extends Component { } Questionnaire.propTypes = { - building: buildingDetailPropTypes, + building: buildingPropTypes, loadQuestionnaire: PropTypes.func, submitQuestionnaire: PropTypes.func, editQuestionnaire: PropTypes.func, diff --git a/src/containers/SearchBar/index.js b/src/containers/SearchBar/index.js index 6ddf2ef9c0961c5abe15debd7f16430829c04b15..2a19f88b8a881a378ac0911bd07742c15f04f4fa 100644 --- a/src/containers/SearchBar/index.js +++ b/src/containers/SearchBar/index.js @@ -9,7 +9,7 @@ import { buildingsSearched, } from './actions'; import './styles.css'; -import { buildingListPropTypes } from './propTypes'; +import { buildingsPropTypes } from './propTypes'; const mapAccess = { @@ -34,19 +34,19 @@ class SearchBar extends Component { } componentDidMount() { - // Use the buildings stored in cookies to populate the buildingList - const buildingList = localStorage.activeBuildings; - if (buildingList !== undefined) { - this.props.buildingsSearched(JSON.parse(buildingList)); + // Use the buildings stored in cookies to populate the buildings + const buildings = localStorage.activeBuildings; + if (buildings !== undefined) { + this.props.buildingsSearched(JSON.parse(buildings)); } } componentWillReceiveProps(nextProps) { if ( - this.props.buildingList !== nextProps.buildingList + this.props.buildings !== nextProps.buildings ) { this.setState({ - address: nextProps.buildingList.address, + address: nextProps.buildings.address, }); } } @@ -119,7 +119,7 @@ class SearchBar extends Component { } SearchBar.propTypes = { - buildingList: buildingListPropTypes, + buildings: buildingsPropTypes, searchBuildings: PropTypes.func, buildingsSearched: PropTypes.func, }; @@ -131,8 +131,8 @@ function mapDispatchToProps(dispatch) { }, dispatch); } -function mapStateToProps({ buildingList }) { - return { buildingList }; +function mapStateToProps({ buildings }) { + return { buildings }; } export default connect(mapStateToProps, mapDispatchToProps)(SearchBar); diff --git a/src/containers/SearchBar/propTypes.js b/src/containers/SearchBar/propTypes.js index 2eafabeacf08308372414b0225b061c701c531c6..7ad06875aa349f729421319a4cf42552868afc9b 100644 --- a/src/containers/SearchBar/propTypes.js +++ b/src/containers/SearchBar/propTypes.js @@ -10,7 +10,7 @@ export const loadErrorPropTypes = { ]), }; -export const buildingList = arrayOf( +export const buildings = arrayOf( shape({ street_address: string, bbl: number, @@ -28,8 +28,8 @@ export const searchParams = shape({ term: string, }); -export const buildingListPropTypes = PropTypes.shape({ +export const buildingsPropTypes = PropTypes.shape({ ...searchParams, - buildings: buildingList, + buildings, ...loadErrorPropTypes, }); diff --git a/src/reducers.js b/src/reducers.js index 1cf26ccab1c433a6480c75b43073611c31ca1cf9..78fd4b3c81f4d4cdfad81e03e33868599da1a862 100644 --- a/src/reducers.js +++ b/src/reducers.js @@ -1,10 +1,10 @@ import { combineReducers } from 'redux'; import { routerReducer } from 'react-router-redux'; -import SearchBarReducer from './containers/SearchBar/reducer'; -import ProjectSearchBarReducer from './containers/Project/reducer'; -import BuildingReducer from './containers/Building/reducer'; -import DimensionsReducer from './containers/Dimensions/reducer'; +import buildings from './containers/SearchBar/reducer'; +import projects from './containers/Project/reducer'; +import building from './containers/Building/reducer'; +import dimensions from './containers/Dimensions/reducer'; import documents from './containers/Documents/reducer'; import eng from './containers/Eng/reducer'; import envelope from './containers/Envelope/reducer'; @@ -17,16 +17,16 @@ import buildingArea from './containers/BuildingArea/reducer'; import weather from './containers/Weather/reducer'; import events from './containers/Event/reducer'; import blocnote from './containers/Blocnote/reducer'; -import bloclink from './containers/Performance/reducer'; +import performance from './containers/Performance/reducer'; import questionnaire from './containers/Questionnaire/reducer'; export default combineReducers({ routing: routerReducer, - buildingList: SearchBarReducer, - projectList: ProjectSearchBarReducer, - buildingDetail: BuildingReducer, - dimensions: DimensionsReducer, + buildings, + projects, + building, + dimensions, documents, eng, envelope, @@ -39,6 +39,6 @@ export default combineReducers({ weather, events, blocnote, - bloclink, + performance, questionnaire, }); diff --git a/src/screens/BuildingsHomePage/index.js b/src/screens/BuildingsHomePage/index.js index a984fcc6609178deb7bf18467997fd416f6392bf..5a747d0d245f33c067fcc5cad8380ee9b72e6513 100644 --- a/src/screens/BuildingsHomePage/index.js +++ b/src/screens/BuildingsHomePage/index.js @@ -5,7 +5,7 @@ import { bindActionCreators } from 'redux'; import NavBar from '../../components/NavBar'; import AddressSearchBuildings from '../../components/AddressSearchBuildings'; import BuildingListTable from '../../components/BuildingListTable'; -import { buildingListPropTypes } from '../../containers/SearchBar/propTypes'; +import { buildingsPropTypes } from '../../containers/SearchBar/propTypes'; import { searchBuildings, buildingsSearched, @@ -27,9 +27,9 @@ class BuildingsHomePage extends Component { componentWillReceiveProps(nextProps) { if ( - this.props.buildingList !== nextProps.buildingList - && this.props.buildingList.buildings.length !== 0 - && nextProps.buildingList.buildings.length === 0 + this.props.buildings !== nextProps.buildings + && this.props.buildings.buildings.length !== 0 + && nextProps.buildings.buildings.length === 0 ) { this.props.createBuilding(this.state.address); } @@ -51,9 +51,9 @@ class BuildingsHomePage extends Component { buildingsSearched={this.props.buildingsSearched} searchBuildings={this.props.searchBuildings} logoOnClick={() => { - const buildingList = localStorage.activeBuildings; - if (buildingList !== undefined) { - this.props.buildingsSearched(JSON.parse(buildingList)); + const buildings = localStorage.activeBuildings; + if (buildings !== undefined) { + this.props.buildingsSearched(JSON.parse(buildings)); } }} user={this.props.user} @@ -61,15 +61,15 @@ class BuildingsHomePage extends Component {
- There was a problem retrieving the buildings. | {this.props.buildingList.error.message} + There was a problem retrieving the buildings. | {this.props.buildings.error.message}
@@ -78,15 +78,15 @@ class BuildingsHomePage extends Component { } BuildingsHomePage.propTypes = { - buildingList: buildingListPropTypes, + buildings: buildingsPropTypes, searchBuildings: PropTypes.func, buildingsSearched: PropTypes.func, createBuilding: PropTypes.func, user: userPropType, }; -function mapStateToProps({ buildingList }) { - return { buildingList }; +function mapStateToProps({ buildings }) { + return { buildings }; } function mapDispatchToProps(dispatch) { return bindActionCreators({ diff --git a/src/screens/HomePage/index.js b/src/screens/HomePage/index.js index 58cc99b63bb98ca4093668a55bda638d1568a1cf..aa37acbeffe7a01db35469a446143e52c0bfa7df 100644 --- a/src/screens/HomePage/index.js +++ b/src/screens/HomePage/index.js @@ -125,12 +125,12 @@ class HomePage extends Component { } renderViewedProjects = () => { - const projectListJSON = localStorage.activeProjects; - let projectList = []; - if (projectListJSON !== null && projectListJSON !== undefined) { - projectList = JSON.parse(projectListJSON).slice(0, HomePage.recentViewedProjectLimit); + const projectsJSON = localStorage.activeProjects; + let projects = []; + if (projectsJSON !== null && projectsJSON !== undefined) { + projects = JSON.parse(projectsJSON).slice(0, HomePage.recentViewedProjectLimit); } - const content = projectList.map(i => ( + const content = projects.map(i => (
Building {i.building_id}
@@ -152,12 +152,12 @@ class HomePage extends Component { } renderViewedBuildings = () => { - const buildingListJSON = localStorage.activeBuildings; - let buildingList = []; - if (buildingListJSON !== null && buildingListJSON !== undefined) { - buildingList = JSON.parse(buildingListJSON).slice(0, HomePage.recentViewedBuildingLimit); + const buildingsJSON = localStorage.activeBuildings; + let buildings = []; + if (buildingsJSON !== null && buildingsJSON !== undefined) { + buildings = JSON.parse(buildingsJSON).slice(0, HomePage.recentViewedBuildingLimit); } - const content = buildingList.map(i => ( + const content = buildings.map(i => (
Building {i.building_id}
@@ -322,8 +322,8 @@ function mapDispatchToProps(dispatch) { }, dispatch); } -function mapStateToProps({ projectList }) { - return { recentProjects: projectList.recentProjects }; +function mapStateToProps({ projects }) { + return { recentProjects: projects.recentProjects }; } export default connect(mapStateToProps, mapDispatchToProps)(HomePage); diff --git a/src/screens/ProjectsHomePage/index.js b/src/screens/ProjectsHomePage/index.js index 6838ec04661fc804c0c7d4c7fa21c3a101e95b92..e594d8d91e2375dc5cf2df75a35d4389efeee1c3 100644 --- a/src/screens/ProjectsHomePage/index.js +++ b/src/screens/ProjectsHomePage/index.js @@ -29,25 +29,25 @@ class ProjectHomePage extends Component { displayAudit={false} SearchBar={ProjectSearchBar} logoOnClick={() => { - const projectList = localStorage.activeProjects; - if (projectList !== undefined) { - this.props.projectsLoaded({ data: JSON.parse(projectList) }); + const projects = localStorage.activeProjects; + if (projects !== undefined) { + this.props.projectsLoaded({ data: JSON.parse(projects) }); } }} />
- There was a problem retrieving the projects. | {this.props.projectList.error.message} + There was a problem retrieving the projects. | {this.props.projects.error.message}
@@ -56,15 +56,15 @@ class ProjectHomePage extends Component { } ProjectHomePage.propTypes = { - projectList: completeProjectPropTypes, + projects: completeProjectPropTypes, updateProjectSearchParams: PropTypes.func, loadProjects: PropTypes.func, projectsLoaded: PropTypes.func, user: userPropType, }; -function mapStateToProps({ projectList }) { - return { projectList }; +function mapStateToProps({ projects }) { + return { projects }; } function mapDispatchToProps(dispatch) { return bindActionCreators({