Added pages
This commit is contained in:
parent
372f35c510
commit
bac2aa915e
10
package-lock.json
generated
10
package-lock.json
generated
@ -4,6 +4,11 @@
|
|||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@agm/core": {
|
||||||
|
"version": "1.0.0-beta.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@agm/core/-/core-1.0.0-beta.6.tgz",
|
||||||
|
"integrity": "sha512-Bf6azUVIZYwgUWUNISaENh38D17XJxgKU7m1TNTrP+sIgYjPrjEON8mxoGnYI8B7PBbdaWl6RPV/FcrEfSG9Ng=="
|
||||||
|
},
|
||||||
"@angular-devkit/architect": {
|
"@angular-devkit/architect": {
|
||||||
"version": "0.800.4",
|
"version": "0.800.4",
|
||||||
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.800.4.tgz",
|
"resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.800.4.tgz",
|
||||||
@ -1310,6 +1315,11 @@
|
|||||||
"multicast-dns-service-types": "^1.1.0"
|
"multicast-dns-service-types": "^1.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"bootstrap-scss": {
|
||||||
|
"version": "4.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/bootstrap-scss/-/bootstrap-scss-4.3.1.tgz",
|
||||||
|
"integrity": "sha512-9S2yVFoiCALs8nIBR9Tljdh9zDaBODZwVWajTgGuzONUxotDj44/SgW8s5Z3siJSyT4mye9PDbs0OPMmOfwoyg=="
|
||||||
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@agm/core": "^1.0.0-beta.6",
|
||||||
"@angular/animations": "~8.0.1",
|
"@angular/animations": "~8.0.1",
|
||||||
"@angular/cdk": "~8.0.1",
|
"@angular/cdk": "~8.0.1",
|
||||||
"@angular/common": "~8.0.1",
|
"@angular/common": "~8.0.1",
|
||||||
@ -23,6 +24,7 @@
|
|||||||
"@angular/pwa": "^0.800.4",
|
"@angular/pwa": "^0.800.4",
|
||||||
"@angular/router": "~8.0.1",
|
"@angular/router": "~8.0.1",
|
||||||
"@angular/service-worker": "~8.0.1",
|
"@angular/service-worker": "~8.0.1",
|
||||||
|
"bootstrap-scss": "^4.3.1",
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"rxjs": "~6.4.0",
|
"rxjs": "~6.4.0",
|
||||||
"tslib": "^1.9.0",
|
"tslib": "^1.9.0",
|
||||||
|
1
src/app/404/404.component.html
Normal file
1
src/app/404/404.component.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<h1>404</h1>
|
9
src/app/404/404.component.ts
Normal file
9
src/app/404/404.component.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import {Component} from "@angular/core";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'not-found',
|
||||||
|
templateUrl: '404.component.html'
|
||||||
|
})
|
||||||
|
export class NotFoundComponent {
|
||||||
|
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
|
||||||
|
|
||||||
const routes: Routes = [];
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [RouterModule.forRoot(routes)],
|
|
||||||
exports: [RouterModule]
|
|
||||||
})
|
|
||||||
export class AppRoutingModule { }
|
|
4
src/app/app.component.html
Normal file
4
src/app/app.component.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<mat-toolbar>
|
||||||
|
Map Alliance
|
||||||
|
</mat-toolbar>
|
||||||
|
<router-outlet></router-outlet>
|
@ -1,31 +1,12 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
import {GeolocationService} from "./geolocation/geolocation.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
template: `
|
templateUrl: 'app.component.html'
|
||||||
<!--The content below is only a placeholder and can be replaced.-->
|
|
||||||
<div style="text-align:center">
|
|
||||||
<h1>
|
|
||||||
Welcome to {{title}}!
|
|
||||||
</h1>
|
|
||||||
<img width="300" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
|
|
||||||
</div>
|
|
||||||
<h2>Here are some links to help you start: </h2>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<h2><a target="_blank" rel="noopener" href="https://angular.io/cli">CLI Documentation</a></h2>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<router-outlet></router-outlet>
|
|
||||||
`,
|
|
||||||
styles: []
|
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
title = 'MapAlliance';
|
constructor(private geolocation: GeolocationService) {
|
||||||
|
geolocation.location.subscribe(pos => console.log(pos));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,32 @@
|
|||||||
import {BrowserModule} from '@angular/platform-browser';
|
import {BrowserModule} from '@angular/platform-browser';
|
||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
|
|
||||||
import {AppRoutingModule} from './app-routing.module';
|
import {AppRouting} from './app.routing';
|
||||||
import {AppComponent} from './app.component';
|
import {AppComponent} from './app.component';
|
||||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
import {ServiceWorkerModule} from '@angular/service-worker';
|
import {ServiceWorkerModule} from '@angular/service-worker';
|
||||||
import {environment} from '../environments/environment';
|
import {environment} from '../environments/environment';
|
||||||
import {FormsModule} from "@angular/forms";
|
import {FormsModule} from "@angular/forms";
|
||||||
import {MatSnackBarModule} from "@angular/material";
|
import {MatSnackBarModule, MatToolbarModule} from "@angular/material";
|
||||||
|
import {MapComponent} from "./map/map.component";
|
||||||
|
import {NotFoundComponent} from "./404/404.component";
|
||||||
|
import {HomeComponent} from "./home/home.component";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent
|
AppComponent,
|
||||||
|
HomeComponent,
|
||||||
|
MapComponent,
|
||||||
|
NotFoundComponent,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
AppRoutingModule,
|
AppRouting,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
MatSnackBarModule,
|
MatSnackBarModule,
|
||||||
ServiceWorkerModule.register('ngsw-worker.js', {enabled: environment.production})
|
ServiceWorkerModule.register('ngsw-worker.js', {enabled: environment.production}),
|
||||||
|
MatToolbarModule
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
|
17
src/app/app.routing.ts
Normal file
17
src/app/app.routing.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
import {NotFoundComponent} from "./404/404.component";
|
||||||
|
import {MapComponent} from "./map/map.component";
|
||||||
|
import {HomeComponent} from "./home/home.component";
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{path: '', pathMatch: 'full', component: HomeComponent},
|
||||||
|
{path: '404', component: NotFoundComponent},
|
||||||
|
{path: '**', component: MapComponent}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forRoot(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class AppRouting { }
|
@ -1,39 +1,38 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {Injectable, OnDestroy} from '@angular/core';
|
||||||
import {BehaviorSubject} from "rxjs";
|
import {BehaviorSubject} from "rxjs";
|
||||||
import {MatSnackBar} from "@angular/material";
|
import {MatSnackBar} from "@angular/material";
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class GeolocationService {
|
export class GeolocationService implements OnDestroy {
|
||||||
location = new BehaviorSubject(null);
|
readonly watchRegistrationID;
|
||||||
|
|
||||||
constructor(private snackBar: MatSnackBar) {
|
location = new BehaviorSubject<Coordinates>(null);
|
||||||
|
|
||||||
|
constructor(snackBar: MatSnackBar) {
|
||||||
if(navigator.geolocation) {
|
if(navigator.geolocation) {
|
||||||
navigator.geolocation.getCurrentPosition(this.updatePosition, this.errorHandler);
|
this.watchRegistrationID = navigator.geolocation.watchPosition(pos => this.location.next(pos.coords), (error) => {
|
||||||
|
switch(error.code) {
|
||||||
|
case error.PERMISSION_DENIED:
|
||||||
|
snackBar.open('Geolocation permission denied', null, {horizontalPosition: 'right', panelClass: ['bg-warning', 'text-white']});
|
||||||
|
break;
|
||||||
|
case error.POSITION_UNAVAILABLE:
|
||||||
|
snackBar.open('Geolocation unavailable', null, {horizontalPosition: 'right', panelClass: ['bg-warning', 'text-white']});
|
||||||
|
break;
|
||||||
|
case error.TIMEOUT:
|
||||||
|
snackBar.open('Geolocation timeout', null, {horizontalPosition: 'right', panelClass: ['bg-warning', 'text-white']});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
snackBar.open('Geolocation experienced an unknown error', null, {horizontalPosition: 'right', panelClass: ['bg-warning', 'text-white']});
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
snackBar.open('Geolocation is not supported', null, {horizontalPosition: 'right', panelClass: 'bg-warn'});
|
snackBar.open('Geolocation is not supported', null, {horizontalPosition: 'right', panelClass: ['bg-warning', 'text-white']});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePosition(position) {
|
ngOnDestroy() {
|
||||||
this.location.next(position);
|
if(this.watchRegistrationID) navigator.geolocation.clearWatch(this.watchRegistrationID);
|
||||||
}
|
|
||||||
|
|
||||||
errorHandler(error) {
|
|
||||||
switch(error.code) {
|
|
||||||
case error.PERMISSION_DENIED:
|
|
||||||
this.snackBar.open('Geolocation permission denied', null, {horizontalPosition: 'right', panelClass: 'bg-warn'});
|
|
||||||
break;
|
|
||||||
case error.POSITION_UNAVAILABLE:
|
|
||||||
this.snackBar.open('Geolocation unavailable', null, {horizontalPosition: 'right', panelClass: 'bg-warn'});
|
|
||||||
break;
|
|
||||||
case error.TIMEOUT:
|
|
||||||
this.snackBar.open('Geolocation timeout', null, {horizontalPosition: 'right', panelClass: 'bg-warn'});
|
|
||||||
break;
|
|
||||||
case error.UNKNOWN_ERROR:
|
|
||||||
this.snackBar.open('Geolocation experienced an unknown error', null, {horizontalPosition: 'right', panelClass: 'bg-warn'});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1
src/app/home/home.component.html
Normal file
1
src/app/home/home.component.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<h1>Home</h1>
|
9
src/app/home/home.component.ts
Normal file
9
src/app/home/home.component.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import {Component} from "@angular/core";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'home',
|
||||||
|
templateUrl: 'home.component.html',
|
||||||
|
})
|
||||||
|
export class HomeComponent {
|
||||||
|
|
||||||
|
}
|
1
src/app/map/map.component.html
Normal file
1
src/app/map/map.component.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<h1>Map</h1>
|
9
src/app/map/map.component.ts
Normal file
9
src/app/map/map.component.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import {Component} from "@angular/core";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'map',
|
||||||
|
templateUrl: 'map.component.html'
|
||||||
|
})
|
||||||
|
export class MapComponent {
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
/* You can add global styles to this file, and also import other style files */
|
@import '~bootstrap-scss/bootstrap.scss';
|
||||||
|
|
||||||
html, body { height: 100%; }
|
html, body { height: 100%; }
|
||||||
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
|
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
|
||||||
|
Loading…
Reference in New Issue
Block a user