From 6ea9c978169304990af9e265023860955b74a5d3 Mon Sep 17 00:00:00 2001 From: Brendan Sudol Date: Mon, 8 May 2017 13:39:28 -0400 Subject: [PATCH 1/2] violent crime as default --- src/reducers/filters.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/reducers/filters.js b/src/reducers/filters.js index 9c43bdf3..fc6b0128 100644 --- a/src/reducers/filters.js +++ b/src/reducers/filters.js @@ -2,6 +2,7 @@ import { FILTER_RESET, FILTERS_UPDATE } from '../actions/constants' const initialState = { + crime: 'violent-crime', since: 2004, until: 2014, } From cef6af4159244254ff64f4c1575ceee237d1c945 Mon Sep 17 00:00:00 2001 From: Brendan Sudol Date: Mon, 8 May 2017 13:49:27 -0400 Subject: [PATCH 2/2] clickable home map --- src/components/Home.js | 5 ++++- test/reducers/filters.test.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/Home.js b/src/components/Home.js index 227fb2e6..f661f7a5 100644 --- a/src/components/Home.js +++ b/src/components/Home.js @@ -18,7 +18,10 @@ const Home = ({ appState, dispatch, router }) => { const handleMapClick = e => { const id = e.target.getAttribute('id') if (!id) return - dispatch(updateFilters({ place: slugify(stateLookup(id)) })) + + const placeNew = { place: slugify(stateLookup(id)) } + dispatch(updateFilters(placeNew)) + dispatch(updateApp({ crime, ...placeNew }, router)) } const handleSearchClick = () => { diff --git a/test/reducers/filters.test.js b/test/reducers/filters.test.js index 88a1fad0..d6191c4e 100644 --- a/test/reducers/filters.test.js +++ b/test/reducers/filters.test.js @@ -7,7 +7,7 @@ describe('filters', () => { describe('initial state', () => { it('should return a small object with time values', () => { const initialState = reducer(undefined, { type: 'fake' }) - expect(Object.keys(initialState).length).toEqual(2) + expect(Object.keys(initialState).length).toEqual(3) }) })