-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(trip-planner): Allow to select different route profile
- Loading branch information
Showing
9 changed files
with
92 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
projects/hslayers/components/trip-planner/ors-profiles.const.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export const profiles = [ | ||
'driving-car', | ||
'driving-hgv', | ||
'cycling-regular', | ||
'cycling-road', | ||
'cycling-mountain', | ||
'cycling-electric', | ||
'foot-walking', | ||
'foot-hiking', | ||
'wheelchair', | ||
] as const; | ||
|
||
export type RouteProfile = (typeof profiles)[number]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export * from './layer-selector.component'; | ||
export * from './ors-profiles.const'; | ||
export * from './route-profile-selector.component'; | ||
export * from './trip-planner.component'; | ||
export * from './trip-planner.module'; | ||
export * from './trip-planner.service'; |
21 changes: 21 additions & 0 deletions
21
projects/hslayers/components/trip-planner/route-profile-selector.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="flex-row w-100 m-auto justify-content-center align-items-center" style="display: flex"> | ||
<p class="m-0 p-0 flex-fill text-primary">{{'TRIP_PLANNER.selectProfile' | translateHs}}:</p> | ||
<div ngbDropdown placement="bottom" style="max-width: 50%"> | ||
<button type="button" ngbDropdownToggle | ||
class="btn btn-sm rounded-0 hs-toolbar-button d-flex align-items-center mw-100" aria-haspopup="true" | ||
(click)="profilesExpanded = !profilesExpanded" | ||
[attr.aria-expanded]="profilesExpanded"> | ||
<div class="text-truncate" *ngIf="selectedProfile !== undefined"> | ||
{{selectedProfile | translateHs : {module: 'TRIP_PLANNER.profiles'} }} | ||
</div> | ||
</button> | ||
<div ngbDropdownMenu [ngClass]="{'show': profilesExpanded}" style="transform: translateX(25%); width: 15em"> | ||
<div class="d-flex align-items-center w-100 flex-column"> | ||
<a class="dropdown-item text-truncate" *ngFor="let profile of hsTripPlannerService.orsProfiles" | ||
data-toggle="tooltip" [title]="profile | translateHs : {module: 'TRIP_PLANNER.profiles'}" | ||
(click)="hsTripPlannerService.selectProfile(profile); profilesExpanded = false">{{profile | | ||
translateHs : {module: 'TRIP_PLANNER.profiles'} }}</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
15 changes: 15 additions & 0 deletions
15
projects/hslayers/components/trip-planner/route-profile-selector.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Component, Input} from '@angular/core'; | ||
|
||
import {HsTripPlannerService} from './trip-planner.service'; | ||
import {RouteProfile} from './ors-profiles.const'; | ||
|
||
@Component({ | ||
selector: 'hs-trip-planner-profile-selector', | ||
templateUrl: './route-profile-selector.component.html', | ||
}) | ||
export class HsTripPlannerProfileSelectorComponent { | ||
@Input() selectedProfile: RouteProfile; | ||
profilesExpanded: boolean; | ||
|
||
constructor(public hsTripPlannerService: HsTripPlannerService) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters