diff --git a/src/components/BuildingListTable/index.js b/src/components/BuildingListTable/index.js
index b1e684a788977c7449ef574b4905b7caffd24451..71366629b302c6faa644f56ae2fca3c6f7347c90 100644
--- a/src/components/BuildingListTable/index.js
+++ b/src/components/BuildingListTable/index.js
@@ -10,7 +10,6 @@ import Loading from '../../components/Loading';
export default function BuildingListTable({
buildings,
loading,
- updateSearchParams,
loadBuildings,
error,
// Whether or not there should be special styling for the BBL section
@@ -52,20 +51,13 @@ export default function BuildingListTable({
const handleRowClick = (building) => {
const newPath = `/buildings/${building.building_id.toString()}/`;
const buildingId = building.building_id;
- const address = building.street_address;
+ const address = building.place_name;
ReactGA.event({ category: 'Navigation', action: 'Click', label: `Building with id: ${buildingId}, address: ${address}` });
browserHistory.push(newPath);
};
const handleLotClick = (bbl) => {
ReactGA.event({ category: 'Navigation', action: 'Click', label: `BBL: ${bbl}` });
- updateSearchParams(
- `${bbl}`,
- 'bbl',
- '',
- '',
- 'NYC',
- );
loadBuildings({ bbl });
};
@@ -138,9 +130,10 @@ export default function BuildingListTable({
);
delete lotGrouping[building.bbl];
}
+ const placeName = building.placeName ? building.placeName : building.street_address;
return (
| handleRowClick(building)}>
- {building.street_address}, {building.borough}, {building.zipcode}
+ {placeName}
|
handleRowClick(building)}>
{building.bin}
@@ -177,7 +170,6 @@ BuildingListTable.propTypes = {
buildings: buildingList,
loading: PropTypes.bool,
error: loadErrorPropTypes.error,
- updateSearchParams: PropTypes.func,
loadBuildings: PropTypes.func,
bblDisplay: PropTypes.bool,
};
diff --git a/src/containers/SearchBar/actions.js b/src/containers/SearchBar/actions.js
index 2db65a2ab7053390e1be125799dac87e84831784..623714c82f02a98eca78aee661e7f07ec46d7cdf 100644
--- a/src/containers/SearchBar/actions.js
+++ b/src/containers/SearchBar/actions.js
@@ -1,30 +1,11 @@
import ReactGA from 'react-ga';
import {
- UPDATE_BUILDING_SEARCH_PARAMS,
SEARCH_BUILDINGS,
SEARCH_BUILDINGS_SUCCESS,
SEARCH_BUILDINGS_ERROR,
} from './constants';
-/**
- * Update search term with new term
- *
- * @param {string} term The new search term
- * @returns {object} An action object with a type of SEARCH_TERM
- * and the term
- */
-export function updateBuildingSearchParams(term, type, borough, zipcode, city) {
- return {
- type: UPDATE_BUILDING_SEARCH_PARAMS,
- term,
- sType: type,
- borough,
- zipcode,
- city,
- };
-}
-
/**
* Load the list of buildings, this action starts the request saga
*
@@ -32,10 +13,10 @@ export function updateBuildingSearchParams(term, type, borough, zipcode, city) {
* @returns {object} An action object with a type of LOAD_BUILDINGS
* and filterName and value
*/
-export function searchBuildings(args) {
+export function searchBuildings(address) {
return {
type: SEARCH_BUILDINGS,
- args,
+ address,
};
}
diff --git a/src/containers/SearchBar/index.js b/src/containers/SearchBar/index.js
index 0401db031bac09b8ae2364c2118931a758b2e482..f7ed9138ccdbb52cfb915857b4a4382f7528c353 100644
--- a/src/containers/SearchBar/index.js
+++ b/src/containers/SearchBar/index.js
@@ -7,7 +7,6 @@ import {
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import {
- updateBuildingSearchParams,
searchBuildings,
buildingsSearched,
} from './actions';
@@ -19,10 +18,6 @@ const mapAccess = {
mapboxApiAccessToken: process.env.REACT_APP_MAPBOX_TOKEN,
};
-const queryParams = {
- country: 'us',
-};
-
class SearchBar extends Component {
constructor(props) {
super(props);
@@ -54,15 +49,13 @@ class SearchBar extends Component {
}
}
- getBuildings = (stateSource) => {
- this.props.searchBuildings(stateSource);
- }
-
handleOnSelected = (viewport, item) => {
this.setState({
viewport,
address: item.place_name,
addressFound: true,
+ }, () => {
+ this.props.searchBuildings(this.state.address);
});
}
@@ -84,7 +77,6 @@ class SearchBar extends Component {
hideOnSelect
onChange={this.handleOnChange}
viewport={viewport}
- queryParams={queryParams}
placeholder="Enter building address ..."
/>
);
@@ -125,15 +117,12 @@ class SearchBar extends Component {
SearchBar.propTypes = {
buildingList: buildingListPropTypes,
- updateBuildingSearchParams: PropTypes.func,
searchBuildings: PropTypes.func,
buildingsSearched: PropTypes.func,
- setNavbar: PropTypes.func,
};
function mapDispatchToProps(dispatch) {
return bindActionCreators({
- updateBuildingSearchParams,
searchBuildings,
buildingsSearched,
}, dispatch);
diff --git a/src/containers/SearchBar/reducer.js b/src/containers/SearchBar/reducer.js
index dc5aebc2313ea4870de6d9c9d7073a4730b9b0a7..2ebaffd796a900764f45d065a821d08e7d93c177 100644
--- a/src/containers/SearchBar/reducer.js
+++ b/src/containers/SearchBar/reducer.js
@@ -1,16 +1,10 @@
import {
- UPDATE_BUILDING_SEARCH_PARAMS,
SEARCH_BUILDINGS,
SEARCH_BUILDINGS_SUCCESS,
SEARCH_BUILDINGS_ERROR,
} from './constants';
const initState = {
- type: 'address',
- term: '',
- city: 'NYC',
- borough: '',
- zipcode: '',
buildings: [],
loading: false,
error: false,
@@ -18,15 +12,6 @@ const initState = {
export default function (state = initState, action) {
switch (action.type) {
- case UPDATE_BUILDING_SEARCH_PARAMS:
- return {
- ...state,
- term: action.term,
- type: action.sType,
- borough: action.borough,
- zipcode: action.zipcode,
- city: action.city,
- };
case SEARCH_BUILDINGS:
return {
...state,
diff --git a/src/containers/SearchBar/sagas.js b/src/containers/SearchBar/sagas.js
index 2b9a5c3b9d96d2ccb110920b276cda99a2d234eb..d74337fe0c31af29fd5888ebf7342c73b07004de 100644
--- a/src/containers/SearchBar/sagas.js
+++ b/src/containers/SearchBar/sagas.js
@@ -1,6 +1,6 @@
-import { call, put, takeLatest } from 'redux-saga/effects';
-import request from '../../utils/request';
-import { getHeaders, buildingsURL } from '../../utils/restServices';
+import { put, takeLatest } from 'redux-saga/effects';
+// import request from '../../utils/request';
+// import { getHeaders, buildingsURL } from '../../utils/restServices';
import {
SEARCH_BUILDINGS,
@@ -15,22 +15,36 @@ import {
* TODO: doctring
*/
function* getBuildingsByFilter(action) {
- const filterString = Object.keys(action.args).reduce((acc, val) => (
- `${acc}${val}=${action.args[val]}&`
- ), '');
- console.log(filterString); // eslint-disable-line
- const res = yield call(
- request,
- `${buildingsURL}?${filterString}limit=300`, {
- method: 'GET',
- headers: getHeaders(),
- }
- );
- console.log(res); // eslint-disable-line
+ const placeName = action.address;
+ // const res = yield call(
+ // request,
+ // `${buildingsURL}?$place_name=${placeName}limit=300`, {
+ // method: 'GET',
+ // headers: getHeaders(),
+ // }
+ // );
+
+ // For now, we commented out http call and hard coded the response data
+ const res = {
+ data: [
+ {
+ bbl: 3012410005,
+ bin: 3031524,
+ borough: 'BROOKLYN',
+ building_id: 181794,
+ lot_id: 759242,
+ street_address: '838 PARK PLACE',
+ targeting_score: 73.9496248660236,
+ zipcode: '11216',
+ placeName,
+ },
+ ],
+ };
+
if (!res.err) {
- yield put(buildingsSearched(res.data, action.args));
+ yield put(buildingsSearched(res.data, placeName));
} else {
- yield put(buildingsSearchingError(res.err, action.args));
+ yield put(buildingsSearchingError(res.err, placeName));
}
}
diff --git a/src/screens/BuildingsHomePage/index.js b/src/screens/BuildingsHomePage/index.js
index 9e4b4eae85acd5e2f1cc35c26367f542f5a48e58..66e2e412cb16b814ac50add607baa21676aa4b2f 100644
--- a/src/screens/BuildingsHomePage/index.js
+++ b/src/screens/BuildingsHomePage/index.js
@@ -8,13 +8,13 @@ import SearchBar from '../../containers/SearchBar';
import BuildingListTable from '../../components/BuildingListTable';
import { buildingListPropTypes } from '../../containers/SearchBar/propTypes';
import {
- updateBuildingSearchParams,
searchBuildings,
buildingsSearched,
} from '../../containers/SearchBar/actions';
import userPropType from '../../containers/User/propTypes';
import NotAuthorized from '../../components/NotAuthorized';
+
/* eslint-disable react/prefer-stateless-function */
class BuildingsHomePage extends Component {
@@ -44,7 +44,6 @@ class BuildingsHomePage extends Component {
@@ -56,7 +55,6 @@ class BuildingsHomePage extends Component {
BuildingsHomePage.propTypes = {
buildingList: buildingListPropTypes,
- updateBuildingSearchParams: PropTypes.func,
searchBuildings: PropTypes.func,
buildingsSearched: PropTypes.func,
user: userPropType,
@@ -67,7 +65,6 @@ function mapStateToProps({ buildingList }) {
}
function mapDispatchToProps(dispatch) {
return bindActionCreators({
- updateBuildingSearchParams,
searchBuildings,
buildingsSearched,
}, dispatch);
|