From 067c290f313839e73a909e1e123311dd00871eb7 Mon Sep 17 00:00:00 2001 From: jannisvisser Date: Tue, 26 Nov 2024 13:10:18 +0100 Subject: [PATCH] fix: only show RP if > 0 + linting fixes --- interfaces/IBF-dashboard/eslint.config.js | 2 +- .../glofas-station-popup-content.component.html | 2 +- .../glofas-station-popup-content.component.ts | 8 ++++---- interfaces/IBF-dashboard/src/app/models/poi.model.ts | 10 ++++++++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/interfaces/IBF-dashboard/eslint.config.js b/interfaces/IBF-dashboard/eslint.config.js index b050c5ccd..189d54547 100644 --- a/interfaces/IBF-dashboard/eslint.config.js +++ b/interfaces/IBF-dashboard/eslint.config.js @@ -155,7 +155,7 @@ module.exports = tseslint.config( '@angular-eslint/template/mouse-events-have-key-events': 'warn', '@angular-eslint/template/alt-text': 'warn', '@angular-eslint/template/elements-content': 'warn', - '@angular-eslint/template/i18n': 'warn', + '@angular-eslint/template/i18n': 'off', // 'warn' caused automatic changes that broke the code //'@angular-eslint/template/i18n': [ // 'error', diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.html b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.html index 71452eea8..6484ef651 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.html +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.html @@ -12,7 +12,7 @@ style="cursor: default" > - @if (data?.station?.dynamicData?.forecastReturnPeriod) { + @if (data?.station?.dynamicData?.forecastReturnPeriod > 0) {
{{ 'map-popups.glofas-station.forecast-return' diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts index 372014af3..abaf5801f 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnInit } from '@angular/core'; -import { EapAlertClass, EapAlertClasses } from '../../../models/country.model'; -import { Station } from '../../../models/poi.model'; -import { LeadTime } from '../../../types/lead-time'; +import { EapAlertClass, EapAlertClasses } from 'src/app/models/country.model'; +import { Station } from 'src/app/models/poi.model'; +import { LeadTime } from 'src/app/types/lead-time'; @Component({ selector: 'app-glofas-station-popup-content', @@ -73,7 +73,7 @@ export class GlofasStationPopupContentComponent implements OnInit { public addComma = (n) => Math.round(n).toLocaleString('en-US'); public getLeadTimeString(): string { - if (!this.data || !this.data?.leadTime) { + if (!this.data?.leadTime) { return ''; } diff --git a/interfaces/IBF-dashboard/src/app/models/poi.model.ts b/interfaces/IBF-dashboard/src/app/models/poi.model.ts index 38e3fa285..3f8dc5205 100644 --- a/interfaces/IBF-dashboard/src/app/models/poi.model.ts +++ b/interfaces/IBF-dashboard/src/app/models/poi.model.ts @@ -2,8 +2,14 @@ export class Station { stationName: string; stationCode: string; - /* eslint-disable @typescript-eslint/no-explicit-any */ - dynamicData?: any; + dynamicData?: StationDynamicData; +} + +export class StationDynamicData { + forecastLevel: number; + triggerLevel: number; + forecastReturnPeriod: number; + eapAlertClass: string; } export class TyphoonTrackPoint {