-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nav visual instructions base ready #25
Changes from 13 commits
35ef4d8
1185e3b
be07e3a
1c23df5
5257b70
a3d1e35
4b15cb3
f7bc32f
e8c0009
f7b56c7
260d911
6a7feb4
e8a48cd
51cdb58
d168bc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,4 @@ testem.log | |
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
/src/assets/config.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
.controlBarContainer { | ||
height: 30px; | ||
display: flex; | ||
} | ||
.remaining-distance-display-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-content: space-around; | ||
position: relative; | ||
} | ||
|
||
.remain-span { | ||
position: absolute; | ||
top: 50%; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { select, Store } from '@ngrx/store'; | ||
import { SetActiveNavAction, SetShowSearchAction } from '../../store/nav.actions'; | ||
import { routePointSelector, routeSelector } from '../../store/nav.selectors'; | ||
import { SetNextWaypointIndexAction, SetPhrazeStateAction, SetShowSearchAction } from '../../store/nav.actions'; | ||
import { distanceToEndpointSelector, routePointsSelector } from '../../store/nav.selectors'; | ||
import { tap } from 'rxjs/operators'; | ||
import { PhrazeState } from '../../interface/nav.interface'; | ||
|
||
@Component({ | ||
selector: 'app-control-bar', | ||
|
@@ -11,19 +12,23 @@ import { tap } from 'rxjs/operators'; | |
}) | ||
export class ControlBarComponent implements OnInit { | ||
|
||
distanceToEndpoint$; | ||
|
||
constructor(private store: Store<any>) { } | ||
|
||
ngOnInit() { | ||
this.distanceToEndpoint$ = this.store.pipe(select(distanceToEndpointSelector)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No reason to be on init. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved. |
||
} | ||
|
||
openSearchPage() { | ||
this.store.dispatch(new SetShowSearchAction({isShowSearch: true})); | ||
} | ||
|
||
startNavigation() { | ||
this.store.dispatch(new SetActiveNavAction({isActiveNav: true})); | ||
this.store.dispatch(new SetPhrazeStateAction({phrazeState: PhrazeState.NAVIGATION})); | ||
this.store.dispatch(new SetNextWaypointIndexAction({nextWaypointIndex: 1})); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe should be part of set state reducer in order to avoid two actions |
||
this.store.pipe( | ||
select(routePointSelector), | ||
select(routePointsSelector), | ||
tap(route => { | ||
const from = <any>route[0]; | ||
const to = <any>route[route.length - 1]; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="instructions-container"> | ||
in {{distanceToNextWaypoint$ | async}} {{nextWaypointManeuver$ | async}} to {{nextWaypointName$ | async}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same remark of how to display km/m in proper quantizations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { InstructionsDisplayComponent } from './instructions-display.component'; | ||
|
||
describe('InstructionsDisplayComponent', () => { | ||
let component: InstructionsDisplayComponent; | ||
let fixture: ComponentFixture<InstructionsDisplayComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ InstructionsDisplayComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(InstructionsDisplayComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { select, Store } from '@ngrx/store'; | ||
import { | ||
nextWaypointDistanceSelector, | ||
nextWaypointIndexSelector, | ||
phrazeStateSelector, | ||
routeDetailsSelector | ||
} from '../../store/nav.selectors'; | ||
import { filter, map, withLatestFrom } from 'rxjs/operators'; | ||
import { PhrazeState } from '../../interface/nav.interface'; | ||
|
||
@Component({ | ||
selector: 'app-instructions-display', | ||
templateUrl: './instructions-display.component.html', | ||
styleUrls: ['./instructions-display.component.scss'] | ||
}) | ||
export class InstructionsDisplayComponent implements OnInit { | ||
distanceToNextWaypoint$; | ||
nextWaypoint$; | ||
nextWaypointManeuver$; | ||
nextWaypointName$; | ||
|
||
constructor(private store: Store<any>) { | ||
} | ||
|
||
ngOnInit() { | ||
|
||
this.distanceToNextWaypoint$ = this.store.pipe(select(nextWaypointDistanceSelector)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should also be shown only on navigation and otherwise hidden/some value |
||
|
||
this.nextWaypoint$ = this.store.pipe(select(nextWaypointIndexSelector), | ||
withLatestFrom(this.store.pipe(select(routeDetailsSelector)), this.store.pipe(select(phrazeStateSelector))), | ||
filter(([nextWpIndex, routeDetails, navState]) => navState === PhrazeState.NAVIGATION)); | ||
|
||
this.nextWaypointManeuver$ = this.nextWaypoint$.pipe( | ||
map(([nextWpIndex, routeDetails, navState]) => routeDetails.routeLegs[nextWpIndex].maneuverType) | ||
); | ||
|
||
this.nextWaypointName$ = this.nextWaypoint$.pipe( | ||
map(([nextWpIndex, routeDetails, navState]) => routeDetails.routeLegs[nextWpIndex].name) | ||
); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p> | ||
instructions-voice works! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Voice component shouldn't have an UI |
||
</p> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { InstructionsVoiceComponent } from './instructions-voice.component'; | ||
|
||
describe('InstructionsVoiceComponent', () => { | ||
let component: InstructionsVoiceComponent; | ||
let fixture: ComponentFixture<InstructionsVoiceComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ InstructionsVoiceComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(InstructionsVoiceComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-instructions-voice', | ||
templateUrl: './instructions-voice.component.html', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Voice component shouldn't have an UI |
||
styleUrls: ['./instructions-voice.component.scss'] | ||
}) | ||
export class InstructionsVoiceComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { GeocodingService } from '../../modules/service-providers/services/geocoding/geocoding.service'; | ||
import { RoutesService } from '../../modules/service-providers/services/routes/routes.service'; | ||
import { GeolocationService } from '../../modules/service-providers/services/position/geolocation.service'; | ||
import { select, Store } from '@ngrx/store'; | ||
import { SetActiveNavAction, SetRouteAction, SetShowSearchAction } from '../../store/nav.actions'; | ||
import { routeSelector, getShowSearchSelector, routePointSelector } from '../../store/nav.selectors'; | ||
import { SetPhrazeStateAction, SetRouteAction, SetShowSearchAction } from '../../store/nav.actions'; | ||
import { currentPositionSelector, getShowSearchSelector, routePointsSelector } from '../../store/nav.selectors'; | ||
import { PhrazeState } from '../../interface/nav.interface'; | ||
import { take, tap } from 'rxjs/operators'; | ||
|
||
@Component({ | ||
selector: 'app-search-page', | ||
|
@@ -15,17 +16,15 @@ export class SearchPageComponent implements OnInit { | |
|
||
searchResults; | ||
routePoints$; | ||
currentPosition; | ||
isShowSearch$; | ||
searchAddress = 'בן יהודה 5 '; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default should be from configuration and empty of production |
||
|
||
|
||
constructor(private store: Store<any>, | ||
private geocodingService: GeocodingService, | ||
private routesService: RoutesService, | ||
private geolocationService: GeolocationService) { | ||
private routesService: RoutesService) { | ||
this.routePoints$ = this.store.pipe( | ||
select(routePointSelector) | ||
select(routePointsSelector) | ||
); | ||
this.isShowSearch$ = this.store.pipe( | ||
select(getShowSearchSelector) | ||
|
@@ -43,15 +42,19 @@ export class SearchPageComponent implements OnInit { | |
} | ||
|
||
selectDestination(entry) { | ||
this.currentPosition = this.geolocationService.lastPos.coords; | ||
this.calcRoute(this.currentPosition, entry.coords); | ||
this.closeSearchPage(); | ||
this.store.dispatch(new SetActiveNavAction({isActiveNav: false})); | ||
this.store.pipe( | ||
select(currentPositionSelector), | ||
take(1), | ||
tap(currentPosition => { | ||
this.calcRoute(currentPosition, entry.coords); | ||
this.closeSearchPage(); | ||
this.store.dispatch(new SetPhrazeStateAction({phrazeState: PhrazeState.PREVIEW})); | ||
}) | ||
).subscribe(); | ||
} | ||
|
||
calcRoute(from, to) { | ||
this.routesService.getRoute(from, to).subscribe(data => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be via action and effect not directly via service. |
||
console.log(data); | ||
this.store.dispatch(new SetRouteAction(data)); | ||
}); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
|
||
export interface NavInterface { | ||
routeDetails: RouteDetails; | ||
isActiveNav: boolean; | ||
phrazeState: PhrazeState; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. store should be split (refactored) into domains. |
||
isShowSearch: boolean; | ||
currentPosition: GeoPosition; | ||
nextWaypointIndex: number; | ||
nextWaypointDistance: number; | ||
isNextWpNotified: boolean; | ||
distanceToEndpoint: number; | ||
previousPosition: GeoPosition; | ||
previousPositionTimeStamp: number; | ||
currentPositionTimeStamp: number; | ||
} | ||
|
||
export interface RouteDetails { | ||
|
@@ -14,7 +22,21 @@ export interface RouteDetails { | |
|
||
export interface LegDetails { | ||
index: number; | ||
coords: []; | ||
coords: Array<number>; | ||
text: string; | ||
maneuverType: string; | ||
name: string; | ||
} | ||
|
||
export enum PhrazeState { | ||
IDLE = 'IDLE', | ||
PREVIEW = 'PREVIEW', | ||
NAVIGATION = 'NAVIGATION' | ||
} | ||
|
||
export interface GeoPosition { | ||
latitude: number; | ||
longitude: number; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<ac-layer acFor="let nextWp of nextWpUpdate$" [context]="this"> | ||
<ac-billboard-primitive-desc props="{ | ||
position: nextWp.position, | ||
image: './assets/images/jeep.svg', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be a pin. |
||
scale: 1.5 | ||
}"> | ||
</ac-billboard-primitive-desc> | ||
</ac-layer> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be displayed as integer and in quantizations (for distance of 10-100km should update every 10km, for 1-10km show update every 1km, for 100-1000m show update every 100m an so on).
Also, the display unit should be shown (km/m)
Please add an issue for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#33
please advise - this is not the way to our main competitor works.