Skip to content

Commit e15aca9

Browse files
author
Pietro Grandi
committed
add CI with travis
1 parent 98e7040 commit e15aca9

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: node_js
2+
node_js:
3+
- "4.2"
4+
before_script:
5+
- npm install
6+
script: npm run tsc

app/app.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import {Component, OnInit} from '@angular/core';
22
import {SearchBox} from "./components/search-box/search-box.component";
3-
import {CurrentSearch, searchReducer} from "./components/reducers/search.reducer";
3+
import {searchReducer} from "./components/reducers/search.reducer";
44
import {Store, provideStore, combineReducers} from "@ngrx/store";
55
import {Observable} from "rxjs/Rx";
66
import {locationReducer} from "./components/reducers/location.reducer";
77
import {ProximitySelector} from "./components/location/proximity-selector.component";
8+
import {CurrentSearch} from "./components/reducers/current-search.model";
89

910
const mainReducer = combineReducers({
1011
searchByName: searchReducer,

app/components/reducers/location.reducer.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,23 @@ import {CurrentSearch} from "./current-search.model";
33
import {ProximitySelector} from "../location/proximity-selector.component";
44

55
export const locationReducer: ActionReducer<CurrentSearch> = (state: CurrentSearch, action: Action) => {
6-
console.log(`reduce 2 -> ${action.type}`);
76
switch (action.type) {
87
case ProximitySelector.StoreEvents.position:
9-
const update = {
8+
return Object.assign({}, state, {
109
position: {
1110
latitude: action.payload.position.latitude,
1211
longitude: action.payload.position.longitude
1312
}
14-
};
15-
return Object.assign({}, state, update);
13+
});
1614
case ProximitySelector.StoreEvents.off:
17-
const update = {
15+
return Object.assign({}, state, {
1816
position: null,
1917
radius: null
20-
};
21-
return Object.assign({}, state, update);
18+
});
2219
case ProximitySelector.StoreEvents.radius:
23-
const update = { radius: action.payload.radius };
24-
return Object.assign({}, state, update);
20+
return Object.assign({}, state, {
21+
radius: action.payload.radius
22+
});
2523
default:
2624
return state;
2725
}

app/components/reducers/search.reducer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import {CurrentSearch} from "./current-search.model";
44

55

66
export const searchReducer: ActionReducer<CurrentSearch> = (state: CurrentSearch, action: Action) => {
7-
console.log(`reduce 1 -> ${action.type}`);
87
switch (action.type) {
98
case SearchBox.StoreEvents.text:
10-
const update = { text: action.payload.text };
11-
return Object.assign({}, state, update);
9+
return Object.assign({}, state, {
10+
text: action.payload.text
11+
});
1212
default:
1313
return state;
1414
}

app/components/search-box/search-box.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Observable} from "rxjs/Rx";
22
import {ElementRef, OnInit, Component, Input} from "@angular/core";
3-
import {CurrentSearch} from "../reducers/search.reducer";
43
import {Store} from "@ngrx/store";
54

65
@Component({

0 commit comments

Comments
 (0)