Skip to content

Commit

Permalink
more regression bashing
Browse files Browse the repository at this point in the history
  • Loading branch information
runette committed Feb 16, 2024
1 parent fec242a commit fadbeff
Show file tree
Hide file tree
Showing 14 changed files with 562 additions and 452 deletions.
3 changes: 2 additions & 1 deletion bcp/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { ScrollingModule } from '@angular/cdk/scrolling';
import { MatCardModule } from '@angular/material/card';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatDialogModule } from '@angular/material/dialog';

import { MatProgressSpinner, MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { BcpHomeComponent } from './bcp-home/bcp-home.component';
import { BcpDatabaseComponent } from './bcp-database/bcp-database.component';
import { BcpNewRecordComponent } from './bcp-new-record/bcp-new-record.component';
Expand Down Expand Up @@ -130,6 +130,7 @@ import { MapMarkerClusterer} from './google-maps-clusterer/map-marker-clusterer'
MatCardModule,
MatSnackBarModule,
MatDialogModule,
MatProgressSpinner,
],
providers: [
],
Expand Down
2 changes: 1 addition & 1 deletion bcp/src/app/bcp-data-card/bcp-data-card.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{site.display_name | truncate:20}}
</ng-container>
<ng-container *ngIf="! site && record.description ">
{{ record.description | truncate:35}}
{{ record.description | truncate:20}}
</ng-container>
</mat-card-title>
</mat-card-header>
Expand Down
2 changes: 1 addition & 1 deletion bcp/src/app/bcp-database/bcp-database.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
position:absolute;
top: 70px;
left: 65%;
right: 5%;
width: 375px;
bottom:15px;
}

Expand Down
2 changes: 1 addition & 1 deletion bcp/src/app/bcp-database/bcp-database.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class BcpDatabaseComponent implements OnInit, AfterViewInit, OnDestroy {
}

infoOptions = {
minWidth: 550,
minWidth: 375,
}

invisMarker: google.maps.MarkerOptions = {visible: false, opacity: 0};
Expand Down
98 changes: 53 additions & 45 deletions bcp/src/app/bcp-gmap/bcp-gmap.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<mat-card>
<mat-card-content>
<div id="map_canvas" class="map-container-inline" >
Expand All @@ -20,48 +21,55 @@
</mat-card-content>
</mat-card>
<mat-card>
<div class="fxRow " >
<button mat-raised-button
type="button"
style="width:auto;"
color="primary"
(click)="getLocation()"
matTooltip="Set the Gun location to your current Device Location"
>
Set to Your Current Location
</button>
</div>
<div class="fxRow " >
<mat-form-field appearance="fill" class="m-1">
<mat-label>
Lat
</mat-label>
<input matInput
class="form-control"
type="text"
id="lat"
name="lat"
[(ngModel)]="displayLoc.lat"
(input)="set()"
/>
</mat-form-field>
<mat-form-field appearance="fill" class="m-1">
<mat-label>
Lng
</mat-label>
<input matInput
class="form-control"
type="text"
id="lon"
name="lon"
[(ngModel)]="displayLoc.lng"
(input)="set()"
/>
</mat-form-field>
</div>
<div class="fxRow m-1" >
<p class="mat-caption">
All Lat/lon coordinates must be in WGS84/Geographic
</p>
</div>
</mat-card>
@if (locationWaiting) {
<div class="fxRow " >
<mat-spinner></mat-spinner>
</div>
}
@else {
<div class="fxRow " >
<button mat-raised-button
type="button"
style="width:auto;"
color="primary"
(click)="getLocation()"
matTooltip="Set the Gun location to your current Device Location"
>
Set to Your Current Location
</button>
</div>
<div class="fxRow " >
<mat-form-field appearance="fill" class="m-1">
<mat-label>
Lat
</mat-label>
<input matInput
class="form-control"
type="text"
id="lat"
name="lat"
[(ngModel)]="displayLoc.lat"
(input)="set()"
/>
</mat-form-field>
<mat-form-field appearance="fill" class="m-1">
<mat-label>
Lng
</mat-label>
<input matInput
class="form-control"
type="text"
id="lon"
name="lon"
[(ngModel)]="displayLoc.lng"
(input)="set()"
/>
</mat-form-field>
</div>
<div class="fxRow m-1" >
<p class="mat-caption">
All Lat/lon coordinates must be in WGS84/Geographic
</p>
</div>
}
</mat-card>
35 changes: 16 additions & 19 deletions bcp/src/app/bcp-gmap/bcp-gmap.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { BcpFilterValuesService } from '../bcp-filter-values.service';
import { GoogleMap } from '@angular/google-maps';
import { DataItem } from '../bcp-map-data.service';



@Component({
selector: 'app-bcp-gmap',
templateUrl: './bcp-gmap.component.html',
Expand All @@ -21,13 +19,16 @@ export class BcpGmapComponent implements OnInit {
draggable: true,
};
markerIcon: google.maps.Icon = {'url':'../assets/cannon_bronze.png'};

locationWaiting: boolean = false;

private _loc: google.maps.LatLngLiteral
private _viewport: google.maps.LatLngBoundsLiteral;
private _quality: string;

@Input()
set location(loc: google.maps.LatLngLiteral){
this._loc = loc
this.newLocation$.next(loc);
this.displayLoc.lat = loc.lat.toLocaleString();
this.displayLoc.lng = loc.lng.toLocaleString();
}
Expand All @@ -39,9 +40,6 @@ export class BcpGmapComponent implements OnInit {
@Input()
options: google.maps.MapOptions;


_viewport: google.maps.LatLngBoundsLiteral;

@Input()
set viewport(vp: google.maps.LatLngBoundsLiteral){
this._viewport = vp;
Expand All @@ -52,29 +50,27 @@ export class BcpGmapComponent implements OnInit {
return this._viewport;
}

private quality: string;

@Input()
set gun(gun: DataItem) {
this.quality = gun.quality;
this._quality = gun.quality;
if (this.map) this.makeMap();
}


@Output()
newLocation$: EventEmitter<google.maps.LatLngLiteral> = new EventEmitter<google.maps.LatLngLiteral>();

@Output()
newBounds$: EventEmitter<google.maps.LatLngBounds> = new EventEmitter<google.maps.LatLngBounds>();

constructor(public DATA_VALUES: BcpFilterValuesService) {
this.quality = this.DATA_VALUES.RECORD_QUALITIES[1];
this._quality = this.DATA_VALUES.RECORD_QUALITIES[1];
}

ngOnInit(): void {
}

loaded($event) {
loaded(_: any) {
this.newLocation$.next(this.location);
if (!this.map) {
this.map = this.my_map.googleMap;
this.makeMap();
Expand All @@ -93,20 +89,23 @@ export class BcpGmapComponent implements OnInit {
this.map.setCenter(this.location);
this.map.setZoom(1);
}
if (this.quality == this.DATA_VALUES.RECORD_QUALITIES[1]) this.markerIcon.url = '../assets/cannon_bronze.png';
else if (this.quality == this.DATA_VALUES.RECORD_QUALITIES[2]) this.markerIcon.url = '../assets/cannon_silver.png';
else if (this.quality == this.DATA_VALUES.RECORD_QUALITIES[3]) this.markerIcon.url = '../assets/cannon_gold.png';
if (this._quality == this.DATA_VALUES.RECORD_QUALITIES[1]) this.markerIcon.url = '../assets/cannon_bronze.png';
else if (this._quality == this.DATA_VALUES.RECORD_QUALITIES[2]) this.markerIcon.url = '../assets/cannon_silver.png';
else if (this._quality == this.DATA_VALUES.RECORD_QUALITIES[3]) this.markerIcon.url = '../assets/cannon_gold.png';
this.marker = this.location;
}

markerDragged($event: { latLng: google.maps.LatLngLiteral; }){
this.location = $event.latLng;
this.newLocation$.next(this.location);
}

getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(position => this.showPosition(position), this.showError);
this.locationWaiting = true;
navigator.geolocation.getCurrentPosition(position => {
this.showPosition(position), this.showError;
this.locationWaiting = false
});
this.map.setZoom(17);
} else {
alert("Geolocation is not supported by this browser.");
Expand All @@ -117,7 +116,6 @@ export class BcpGmapComponent implements OnInit {
this.location = new google.maps.LatLng(position.coords.latitude,position.coords.longitude ).toJSON();
this.map.setCenter(this.location);
this.marker = this.location;
this.newLocation$.next(this.location);
}

private showError(error) {
Expand All @@ -141,7 +139,6 @@ export class BcpGmapComponent implements OnInit {
this.location = new google.maps.LatLng(parseFloat(this.displayLoc.lat), parseFloat(this.displayLoc.lng)).toJSON();
this.map.setCenter(this.location);
this.marker = this.location;
this.newLocation$.next(this.location);
}
}

Expand Down
18 changes: 13 additions & 5 deletions bcp/src/app/bcp-login/bcp-login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { Auth,
sendEmailVerification
} from '@angular/fire/auth';
import { Subscription } from 'rxjs';
import { ActivatedRoute } from '@angular/router';
import {Location} from '@angular/common';

@Component({
selector: 'app-bcp-login',
Expand All @@ -26,35 +28,41 @@ export class BcpLoginComponent implements OnInit, OnDestroy {
hide: boolean = true;

loggedOut: boolean = true;
private subscriptions: Subscription[] = [];
private _subscriptions: Subscription[] = [];
private _back: boolean = false;

constructor(
@Optional() private auth: Auth,
@Optional() private auth: Auth,
private _request: ActivatedRoute,
private _location: Location,
) {
if (auth) {
this.subscriptions.push(authState(this.auth).subscribe(user => {
this._subscriptions.push(authState(this.auth).subscribe(user => {
if (user) {
this.loggedOut = false;
this.currentUser = user;
this.displayName = user.providerData[0].displayName ?
user.providerData[0].displayName :
user.providerData[0].email
? user.providerData[0].email : "";

if (this._back) this._location.back();
} else {
this.currentUser = undefined;
this.displayName = "";
this.loggedOut = true;
}
}));
}
this._subscriptions.push( this._request.queryParamMap.subscribe(pmap => {
this._back = pmap.get('back')? true : false;
}));
}

ngOnInit(): void {
}

ngOnDestroy(): void {
this.subscriptions.forEach( sub => sub.unsubscribe());
this._subscriptions.forEach( sub => sub.unsubscribe());
}

async loginGoogle() {
Expand Down
Loading

0 comments on commit fadbeff

Please sign in to comment.