Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
panaaj committed Feb 12, 2025
1 parent 5e1cb96 commit afae521
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 137 deletions.
15 changes: 7 additions & 8 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -898,21 +898,19 @@
<!-- *** Alarm / Mode panel ***-->
@if(!app.data.kioskMode) {
<div class="alarmPanel">
<span
*ngFor="let a of alarmsFacade.alarms | keyvalue"
style="margin-bottom: 5px"
>
@for(a of alarmsFacade.alarms; track a[0]) {
<span style="margin-bottom: 5px">
<ap-alarm
[alarm]="a"
[alarm]="{ key: a[0], value: a[1] }"
[audioContext]="app.audio.context"
[audioStatus]="display.audio.state"
[hasSound]="a.value.sound"
[hasSound]="a[1].sound"
[soundFile]="
['nominal', 'warn'].includes(a.value.state)
['nominal', 'warn'].includes(a[1].state)
? './assets/sound/ding.mp3'
: './assets/sound/woop.mp3'
"
[mute]="a.value.muted || a.value.acknowledged"
[mute]="a[1].muted || a[1].acknowledged"
(muted)="alarmsFacade.muteAlarm($event); focusMap()"
(acknowledge)="
alarmsFacade.acknowledgeAlarm($event); focusMap()
Expand All @@ -928,6 +926,7 @@
>
</ap-alarm>
</span>
}
</div>
}

Expand Down
7 changes: 6 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,12 @@ export class AppComponent {
// buddy list
if (p.id === 'signalk-buddylist-plugin') {
this.app.debug('*** found buddylist plugin');
this.app.data.buddyList.hasApi = semver.satisfies(p.version, '>1.2.0') ? true : false
this.app.data.buddyList.hasApi = semver.satisfies(
p.version,
'>1.2.0'
)
? true
: false;
}
// charts v2 api support
if (p.id === 'charts') {
Expand Down
14 changes: 8 additions & 6 deletions src/app/modules/map/fb-map.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,22 @@
}

<!-- Resource Sets -->
<div *ngFor="let resSet of app.data.resourceSets | keyvalue; let idx = index">
@if(resSet.key !== 'tracks') {
@for(resSet of dfeat.resourceSets; track resSet[0]; let idx = $index) {
<div>
@if(resSet[0] !== 'tracks') {
<fb-resource-sets
[darkMode]="app.config.map.invertColor"
[collection]="resSet.key"
[resourceSets]="resSet.value"
[selected]="app.config.selections.resourceSets[resSet.key]"
[labelMinZoom]="this.app.config.selections.labelsMinZoom"
[collection]="resSet[0]"
[resourceSets]="resSet[1]"
[selected]="app.config.selections.resourceSets[resSet[0]]"
[labelMinZoom]="app.config.selections.labelsMinZoom"
[mapZoom]="fbMap.zoomLevel"
[zIndex]="52 + idx"
>
</fb-resource-sets>
}
</div>
}

<!-- Routes -->
<fb-routes
Expand Down
14 changes: 10 additions & 4 deletions src/app/modules/map/fb-map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ import { Feature as GeoJsonFeature } from 'geojson';

import { Convert } from 'src/app/lib/convert';
import { GeoUtils, Angle } from 'src/app/lib/geoutils';
import { FBChart, FBRoute, FBWaypoint, Position } from 'src/app/types';
import {
FBChart,
FBRoute,
FBWaypoint,
Position,
ResourceSet
} from 'src/app/types';

import { AppInfo } from 'src/app/app.info';
import { SettingsMessage } from 'src/app/lib/services';
Expand Down Expand Up @@ -137,7 +143,7 @@ interface IFeatureData {
active: SKVessel; // focussed vessel
navData: { position: Position; startPosition: Position };
closest: { id: string; position: Position };
resourceSets: ResourceSets;
resourceSets: Array<[string, ResourceSet]>;
}

interface IDrawInfo {
Expand Down Expand Up @@ -329,7 +335,7 @@ export class FBMapComponent implements OnInit, OnDestroy {
active: new SKVessel(), // focussed vessel
navData: { position: null, startPosition: null },
closest: { id: null, position: [0, 0] },
resourceSets: {}
resourceSets: []
};

// ** AIS target management
Expand Down Expand Up @@ -609,7 +615,7 @@ export class FBMapComponent implements OnInit, OnDestroy {
}
}
if (value.mode === 'resource-set') {
this.dfeat.resourceSets = Object.assign({}, this.app.data.resourceSets);
this.dfeat.resourceSets = Object.entries(this.app.data.resourceSets);
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/app/modules/map/popovers/vessel-popover.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ isSelf: boolean - true if vessel 'self'
{{ isFlagged ? 'UN-FLAG' : 'FLAG' }}
</button>
@if(!isSelf && app.data.buddyList.hasApi) {
@if(!isSelf && app.data.buddyList.hasApi) {
<button mat-button (click)="toggleBuddy()" matTooltip="Is Buddy">
<mat-icon>{{
vessel.buddy ? 'group_remove' : 'group_add'
Expand Down Expand Up @@ -269,9 +269,10 @@ export class VesselPopoverComponent {
this.buddies.remove(urn).subscribe(
() => {
//console.log('buddy revedmo:', urn);
this.app.showMessage(`Buddy successfully removed.`, false, 3000);
},
(err: HttpErrorResponse) => {
//console.log('Error removing buddy!', err);
this.app.showMessage(`Error removing buddy!`, false, 3000);
}
);
} else {
Expand All @@ -282,10 +283,10 @@ export class VesselPopoverComponent {
urn.slice(-5);
this.buddies.add(urn, name).subscribe(
() => {
//console.log('buddy added:', name);
this.app.showMessage(`Buddy added (${name})`, false, 3000);
},
(err: HttpErrorResponse) => {
//console.log('Error adding buddy!', err);
this.app.showMessage(`Error adding buddy!(${name})`, false, 5000);
}
);
}
Expand Down
Loading

0 comments on commit afae521

Please sign in to comment.