Added pages
This commit is contained in:
		
							
								
								
									
										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 {GeolocationService} from "./geolocation/geolocation.service";
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'app-root',
 | 
			
		||||
  template: `
 | 
			
		||||
    <!--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: []
 | 
			
		||||
  templateUrl: 'app.component.html'
 | 
			
		||||
})
 | 
			
		||||
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 {NgModule} from '@angular/core';
 | 
			
		||||
 | 
			
		||||
import {AppRoutingModule} from './app-routing.module';
 | 
			
		||||
import {AppRouting} from './app.routing';
 | 
			
		||||
import {AppComponent} from './app.component';
 | 
			
		||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
 | 
			
		||||
import {ServiceWorkerModule} from '@angular/service-worker';
 | 
			
		||||
import {environment} from '../environments/environment';
 | 
			
		||||
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({
 | 
			
		||||
    declarations: [
 | 
			
		||||
        AppComponent
 | 
			
		||||
        AppComponent,
 | 
			
		||||
        HomeComponent,
 | 
			
		||||
        MapComponent,
 | 
			
		||||
        NotFoundComponent,
 | 
			
		||||
    ],
 | 
			
		||||
    imports: [
 | 
			
		||||
        BrowserModule,
 | 
			
		||||
        AppRoutingModule,
 | 
			
		||||
        AppRouting,
 | 
			
		||||
        BrowserAnimationsModule,
 | 
			
		||||
        FormsModule,
 | 
			
		||||
        MatSnackBarModule,
 | 
			
		||||
        ServiceWorkerModule.register('ngsw-worker.js', {enabled: environment.production})
 | 
			
		||||
        ServiceWorkerModule.register('ngsw-worker.js', {enabled: environment.production}),
 | 
			
		||||
        MatToolbarModule
 | 
			
		||||
    ],
 | 
			
		||||
    providers: [],
 | 
			
		||||
    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 {MatSnackBar} from "@angular/material";
 | 
			
		||||
 | 
			
		||||
@Injectable({
 | 
			
		||||
    providedIn: 'root'
 | 
			
		||||
})
 | 
			
		||||
export class GeolocationService {
 | 
			
		||||
    location = new BehaviorSubject(null);
 | 
			
		||||
export class GeolocationService implements OnDestroy {
 | 
			
		||||
    readonly watchRegistrationID;
 | 
			
		||||
 | 
			
		||||
    constructor(private snackBar: MatSnackBar) {
 | 
			
		||||
    location = new BehaviorSubject<Coordinates>(null);
 | 
			
		||||
 | 
			
		||||
    constructor(snackBar: MatSnackBar) {
 | 
			
		||||
        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 {
 | 
			
		||||
            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) {
 | 
			
		||||
        this.location.next(position);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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;
 | 
			
		||||
        }
 | 
			
		||||
    ngOnDestroy() {
 | 
			
		||||
        if(this.watchRegistrationID) navigator.geolocation.clearWatch(this.watchRegistrationID);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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%; }
 | 
			
		||||
body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user