Skip to content
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

Merged
merged 15 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ testem.log
# System Files
.DS_Store
Thumbs.db
/src/assets/config.json
46 changes: 16 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@angular/platform-browser": "~7.1.0",
"@angular/platform-browser-dynamic": "~7.1.0",
"@angular/router": "~7.1.0",
"@ngrx/effects": "^8.2.0",
"@ngrx/store": "^8.1.0",
"@turf/turf": "^5.1.6",
"angular-cesium": "0.0.56",
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<mat-sidenav-container class="search-sidenav-container">
<mat-sidenav-content>
<div class="app-container">
<div class="instructions-container">
<app-instructions-display></app-instructions-display>
<app-instructions-voice></app-instructions-voice>
</div>
<app-search-page></app-search-page>
<div class="map-container">
<app-map></app-map>
Expand Down
21 changes: 17 additions & 4 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,31 @@
}

.app-container {
display: flex;
//display: flex;
height: 100%;
flex-direction: column;
justify-content: space-between;

}

.map-container {
flex-grow: 1;
//flex-grow: 1;
//flex: 1 1 auto;
height: calc(100% - 100px);
}

.controlBarContainer {
//margin: 10px;
//flex-basis: 30px;
//flex-shrink: 0;
//flex: 0 0 auto;
height: 50px;

}

.controlBarContainer {
margin: 10px;
.instructions-container {
//margin: 10px;
//flex: 0 0 auto;
height: 50px;
}

5 changes: 5 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component } from '@angular/core';
import { GeolocationService } from './modules/service-providers/services/position/geolocation.service';
import { NavigationService } from './modules/service-providers/services/navigation/navigation.service';

@Component({
selector: 'app-root',
Expand All @@ -7,4 +9,7 @@ import { Component } from '@angular/core';
})
export class AppComponent {
title = 'Phraze';

constructor(private geolocationService: GeolocationService,
private navigationService: NavigationService) {}
}
6 changes: 6 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ import { StoreModule } from '@ngrx/store';
import { navFeatureKey } from './store/nav.selectors';
import { navReducer } from './store/nav.reducer';
import { FormsModule } from '@angular/forms';
import { InstructionsDisplayComponent } from './components/instructions-display/instructions-display.component';
import { InstructionsVoiceComponent } from './components/instructions-voice/instructions-voice.component';
import { EffectsModule } from '@ngrx/effects';


@NgModule({
declarations: [
AppComponent,
ControlBarComponent,
SearchPageComponent,
InstructionsDisplayComponent,
InstructionsVoiceComponent,

],
imports: [
Expand All @@ -36,6 +41,7 @@ import { FormsModule } from '@angular/forms';
ServiceProvidersModule,
StoreModule.forRoot({}),
StoreModule.forFeature(navFeatureKey, navReducer),
EffectsModule.forRoot([]),
MatToolbarModule,
MatSidenavModule,
FormsModule,
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/control-bar/control-bar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
<div class="settingsButtonContainer">
<button mat-raised-button (click)="startNavigation()">Start</button>
</div>
<div class="remaining-distance-display-container">
<span class="remain-span">{{distanceToEndpoint$ | async}} </span>
Copy link
Member

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

Copy link
Contributor Author

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.

</div>

</div>
12 changes: 11 additions & 1 deletion src/app/components/control-bar/control-bar.component.scss
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%;
}
15 changes: 10 additions & 5 deletions src/app/components/control-bar/control-bar.component.ts
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',
Expand All @@ -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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason to be on init.
Can be in constructor or before on the variables

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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}));
Copy link
Member

Choose a reason for hiding this comment

The 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
Also order matters, next should be before state

this.store.pipe(
select(routePointSelector),
select(routePointsSelector),
tap(route => {
const from = <any>route[0];
const to = <any>route[route.length - 1];
Expand All @@ -44,7 +49,7 @@ export class ControlBarComponent implements OnInit {
window.removeEventListener('message', handleGetRouteCallback);
window.postMessage({
type: 'playRoute',
playbackRate: 1.5
playbackRate: 0.28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be from configuration

},
'*');
}
Expand Down
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}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark of how to display km/m in proper quantizations.
Maneuver should be shown as image or at least separated to words

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#34

</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();
});
});
Loading