diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e5b548b..90954381 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,13 @@ - **New**: Display specific Note icons when "skIcon" property matches a POI type. - **Fixed**: Notes popover and dialog formatting. (#214, #223) - **Fixed**: Navigation data panel alignment on smaller screens. (#212) +- **Fixed**: Update TTG display format based on magnitude of value. (#226) - **Updated**: Resource Set feature popover formatting. (#213) - **Updated**: Show more / less ui icons in AIS properties. (#217) - **Updated**: Relocated close button on resource lists. (#218) - **Updated**: Additional aisCogLine length options. (#209) - **Added**: %map:zoom% token for use in Notes fetch filter (#222) - ### v2.12.2 - **Fixed**: Issue applying URL query parameters. (#201) - **Fixed**: S57 symbol display issue. (#202) diff --git a/src/app/app.component.html b/src/app/app.component.html index 07c5296d..bbebafdd 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1032,16 +1032,15 @@ > } @if(app.data.navData.ttg) { - - + } @if(app.data.navData.xte) { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index e57d13be..b9edb250 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -613,8 +613,19 @@ export class AppComponent { .get(this.app.skApiVersion, 'vessels/self/steering/autopilot') .subscribe( () => { + const sap = this.app.data.autopilot.hasApi; this.app.data.autopilot.hasApi = true; this.app.data.autopilot.isLocal = true; + if (sap && this.app.data.autopilot.isLocal) { + setTimeout(() => + this.app.showMessage( + 'Built-in PyPilot support is deprecated! See Help for more.', + true, + 5000 + ) + ), + 10000; + } }, () => { this.app.debug('No local AP API found.'); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 433c65d6..87d3f488 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -34,6 +34,7 @@ import { import { TextDialComponent, + TTGDialComponent, FileInputComponent, PiPVideoComponent, WakeLockComponent, @@ -56,6 +57,7 @@ import { BrowserAnimationsModule, FBMapComponent, TextDialComponent, + TTGDialComponent, FileInputComponent, PiPVideoComponent, WakeLockComponent, diff --git a/src/app/lib/components/dial-text.ts b/src/app/lib/components/dial-text.ts index ee8f40e3..96a63e11 100644 --- a/src/app/lib/components/dial-text.ts +++ b/src/app/lib/components/dial-text.ts @@ -1,7 +1,12 @@ /** Text Dial Component ** ************************/ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + Input, + SimpleChanges +} from '@angular/core'; /*********** Text Dial *************** title: "" title text, @@ -27,3 +32,50 @@ export class TextDialComponent { @Input() value: string; @Input() units: string; } + +/*********** TTG Text Dial *************** +value: "" TTG value in minutes +***********************************/ +@Component({ + standalone: true, + changeDetection: ChangeDetectionStrategy.OnPush, + selector: 'ap-dial-ttg', + imports: [], + template: ` +
+
TTG
+
{{ ttg }}
+
{{ units }}
+
+ `, + styleUrls: ['./dial-text.css'] +}) +export class TTGDialComponent { + @Input() value: number; + protected ttg: string = '--'; + protected units: string = 'min'; + + ngOnChanges(changes: SimpleChanges) { + const cv = changes.value.currentValue; + if (typeof cv !== 'number') { + this.ttg = '--'; + this.units = 'min'; + } else if (cv < 60) { + this.ttg = Math.floor(cv).toString(); + this.units = 'min'; + } else if (cv < 60 * 24) { + this.ttg = `${Math.floor(cv / 60)}:${(cv % 60).toFixed(0)}`; + this.units = 'hr:min'; + } else { + const minPerDay = 60 * 24; + const days = Math.floor(cv / minPerDay); + const dm = days * minPerDay; + const rhm = cv - dm; + const hours = Math.floor(rhm / 60); + const minutes = Math.floor(rhm - hours * 60); + + this.ttg = `${days}:${hours}:${minutes}`; + this.units = 'day:hr:min'; + } + } +}