diff --git a/frontend/app/src/app/modules/catalog/catalog.component.html b/frontend/app/src/app/modules/catalog/catalog.component.html index 64200f07..6e12debe 100644 --- a/frontend/app/src/app/modules/catalog/catalog.component.html +++ b/frontend/app/src/app/modules/catalog/catalog.component.html @@ -23,7 +23,7 @@ - @for (semester of availableSemesters; track semester) { + @for (semester of availableSemesters; track semester.uid) { {{ semester.acronym }} @@ -35,7 +35,7 @@ @if (catalogs && catalogs.length > 0) { - @for (catalog of catalogs; track catalog) { + @for (catalog of catalogs; track catalog.uid) {

{{ catalog.name }}

@@ -46,7 +46,7 @@ } @if (!catalogs) { - @for (skeleton of [].constructor(10); track skeleton) { + @for (skeleton of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; track skeleton) { } diff --git a/frontend/app/src/app/modules/dashboard/sections/favorites-section/favorites-section.component.html b/frontend/app/src/app/modules/dashboard/sections/favorites-section/favorites-section.component.html index ec5ce638..166687a5 100644 --- a/frontend/app/src/app/modules/dashboard/sections/favorites-section/favorites-section.component.html +++ b/frontend/app/src/app/modules/dashboard/sections/favorites-section/favorites-section.component.html @@ -19,7 +19,7 @@ @if (items | async; as items) { - @for (item of items; track item) { + @for (item of items; track item.uid) { @if (jobs | async; as jobs) { - @for (item of jobs; track item) { + @for (item of jobs; track item.uid) { 0) { - @for (dish of dishes; track dish) { + @for (dish of dishes; track dish.uid) { diff --git a/frontend/app/src/app/modules/data/elements/simple-card.html b/frontend/app/src/app/modules/data/elements/simple-card.html index 5fb56edc..9b62f499 100644 --- a/frontend/app/src/app/modules/data/elements/simple-card.html +++ b/frontend/app/src/app/modules/data/elements/simple-card.html @@ -24,7 +24,7 @@ } } @else { @if (content && isThing(content[0])) { - @for (thing of $any(content); track thing) { + @for (thing of $any(content); track thing.uid) {

{{ 'name' | thingTranslate: thing }}

diff --git a/frontend/app/src/app/modules/data/list/data-list.html b/frontend/app/src/app/modules/data/list/data-list.html index 29ef6841..6795fac6 100644 --- a/frontend/app/src/app/modules/data/list/data-list.html +++ b/frontend/app/src/app/modules/data/list/data-list.html @@ -16,7 +16,7 @@ @if (itemStream | async; as items) { - @for (item of items; track item) { + @for (item of items; track item.uid) { diff --git a/frontend/app/src/app/modules/data/list/simple-data-list.html b/frontend/app/src/app/modules/data/list/simple-data-list.html index d556a392..1677d727 100644 --- a/frontend/app/src/app/modules/data/list/simple-data-list.html +++ b/frontend/app/src/app/modules/data/list/simple-data-list.html @@ -23,7 +23,7 @@ } - @for (item of items; track item) { + @for (item of items; track item.uid) { @@ -34,7 +34,7 @@ } } @else { - @for (skeleton of [].constructor(skeletonItems); track skeleton) { + @for (skeleton of [1, 2, 3, 4, 5, 6]; track skeleton) { } diff --git a/frontend/app/src/app/modules/data/list/tree-list-fragment.html b/frontend/app/src/app/modules/data/list/tree-list-fragment.html index c1fe1899..82bfbf68 100644 --- a/frontend/app/src/app/modules/data/list/tree-list-fragment.html +++ b/frontend/app/src/app/modules/data/list/tree-list-fragment.html @@ -25,7 +25,7 @@ } - @for (item of entry[1]._ || []; track item) { + @for (item of entry[1]._ || []; track item.uid) {
{{ 'superCatalogs' | propertyNameTranslate: 'catalog' | titlecase }} - @for (item of item.catalogs; track item) { + @for (item of item.catalogs; track item.uid) { @if (item.workLocations) { - @for (contactPoint of contactPoints; track contactPoint; let i = $index) { + @for (contactPoint of contactPoints; track contactPoint.uid; let i = $index) { @if (item.workLocations.length > 1) { diff --git a/frontend/app/src/app/modules/map/controls/compass-control.component.ts b/frontend/app/src/app/modules/map/controls/compass-control.component.ts index c55d9915..0fe581c9 100644 --- a/frontend/app/src/app/modules/map/controls/compass-control.component.ts +++ b/frontend/app/src/app/modules/map/controls/compass-control.component.ts @@ -4,14 +4,13 @@ import {IonFabButton} from '@ionic/angular/standalone'; import {MapService} from '@maplibre/ngx-maplibre-gl'; import {MapEventType} from 'maplibre-gl'; import {map, mergeMap, fromEventPattern, merge} from 'rxjs'; -import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive'; @Component({ selector: 'stapps-compass-control', templateUrl: './compass-control.html', styleUrl: './compass-control.scss', changeDetection: ChangeDetectionStrategy.OnPush, - imports: [AsyncPipe, IonIconDirective, IonFabButton], + imports: [AsyncPipe, IonFabButton], }) export class CompassControlComponent { transform = this.mapService.mapCreated$.pipe( diff --git a/frontend/app/src/app/modules/map/elements/poi-markers.component.ts b/frontend/app/src/app/modules/map/elements/poi-markers.component.ts index 78e2e342..5937e897 100644 --- a/frontend/app/src/app/modules/map/elements/poi-markers.component.ts +++ b/frontend/app/src/app/modules/map/elements/poi-markers.component.ts @@ -1,5 +1,4 @@ import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; -import {MapIconDirective} from '../map-icon.directive'; import {FeatureCollection, Point} from 'geojson'; import {SCFeatureProperties} from '../feature-collection.pipe'; import {animate, style, transition, trigger} from '@angular/animations'; @@ -19,7 +18,6 @@ import {PoiMarkerComponent} from './poi-marker.component'; styleUrl: './poi-markers.scss', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ - MapIconDirective, MglClusterLeavesPipe, GeoJSONSourceComponent, MarkersForClustersComponent, diff --git a/frontend/app/src/app/modules/map/map-page.component.ts b/frontend/app/src/app/modules/map/map-page.component.ts index 1394df1b..628f354b 100644 --- a/frontend/app/src/app/modules/map/map-page.component.ts +++ b/frontend/app/src/app/modules/map/map-page.component.ts @@ -14,21 +14,15 @@ */ import {ChangeDetectionStrategy, Component} from '@angular/core'; import {LngLatBoundsLike, MapLibreEvent} from 'maplibre-gl'; -import { - ControlComponent, - GeolocateControlDirective, - MapComponent, - ScaleControlDirective, -} from '@maplibre/ngx-maplibre-gl'; +import {ControlComponent, MapComponent, ScaleControlDirective} from '@maplibre/ngx-maplibre-gl'; import {TranslateModule} from '@ngx-translate/core'; -import {ActivatedRoute, RouterLink} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import {MapAuto3dDirective} from './map-auto-3d.directive'; import {MediaQueryPipe} from '../../util/media-query.pipe'; import {DataProvider} from '../data/data.provider'; import {SCSearchFilter, SCThingType} from '@openstapps/core'; import {DataModule} from '../data/data.module'; import {AsyncPipe} from '@angular/common'; -import {GeolocateControlComponent} from './controls/geolocate-control.component'; import {CompassControlComponent} from './controls/compass-control.component'; import {MapSizeFixDirective} from './map-size-fix.directive'; import {MapDataProvider} from './map-data.provider'; @@ -38,8 +32,7 @@ import {BuildingMarkersComponent} from './elements/building-markers.component'; import {PoiMarkersComponent} from './elements/poi-markers.component'; import {AttributionComponent} from './controls/attribution.component'; import {filter, map} from 'rxjs'; -import {IonButton, IonContent, IonLabel, IonRouterLink} from '@ionic/angular/standalone'; -import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive'; +import {IonContent} from '@ionic/angular/standalone'; /** * The main page of the map @@ -62,24 +55,17 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive'; CompassControlComponent, ControlComponent, DataModule, - GeolocateControlComponent, - GeolocateControlDirective, - IonIconDirective, MapAuto3dDirective, MapComponent, MapSizeFixDirective, MapStylePipe, MediaQueryPipe, PoiMarkersComponent, - RouterLink, ScaleControlDirective, ThingPoiFeatureCollectionPipe, ThingPolygonFeatureCollectionPipe, TranslateModule, IonContent, - IonLabel, - IonRouterLink, - IonButton, ], }) export class MapPageComponent { diff --git a/frontend/app/src/app/modules/map/map-widget.component.ts b/frontend/app/src/app/modules/map/map-widget.component.ts index b76a0ed0..935e8b33 100644 --- a/frontend/app/src/app/modules/map/map-widget.component.ts +++ b/frontend/app/src/app/modules/map/map-widget.component.ts @@ -14,7 +14,7 @@ */ import {ChangeDetectionStrategy, Component, HostBinding, Input, inject} from '@angular/core'; import {RouterLink} from '@angular/router'; -import {ControlComponent, MapComponent, MarkerComponent} from '@maplibre/ngx-maplibre-gl'; +import {ControlComponent, MapComponent} from '@maplibre/ngx-maplibre-gl'; import {AnimationController, IonRouterLink} from '@ionic/angular/standalone'; import {GeoNavigationDirective} from './geo-navigation.directive'; import {TranslateModule} from '@ngx-translate/core'; @@ -51,7 +51,6 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive'; MapComponent, MapSizeFixDirective, MapStylePipe, - MarkerComponent, MediaQueryPipe, PoiMarkersComponent, RouterLink, diff --git a/frontend/app/src/app/modules/news/page/news-page.html b/frontend/app/src/app/modules/news/page/news-page.html index 5f7d1214..8274a975 100644 --- a/frontend/app/src/app/modules/news/page/news-page.html +++ b/frontend/app/src/app/modules/news/page/news-page.html @@ -51,7 +51,7 @@ } } @if (news.length > 0) { - @for (item of news; track item) { + @for (item of news; track item.uid) { } } diff --git a/frontend/app/src/app/modules/profile/id-cards.component.ts b/frontend/app/src/app/modules/profile/id-cards.component.ts index 742dd9d0..6e514491 100644 --- a/frontend/app/src/app/modules/profile/id-cards.component.ts +++ b/frontend/app/src/app/modules/profile/id-cards.component.ts @@ -15,7 +15,7 @@ import {ChangeDetectionStrategy, Component} from '@angular/core'; import {IdCardsProvider} from './id-cards.provider'; import {SCIdCard} from '@openstapps/core'; -import {AsyncPipe, TitleCasePipe} from '@angular/common'; +import {AsyncPipe} from '@angular/common'; import {ThingTranslateModule} from '../../translation/thing-translate.module'; import {UtilModule} from '../../util/util.module'; import {IdCardComponent} from './id-card.component'; @@ -29,15 +29,7 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive'; styleUrls: ['id-cards.scss'], providers: [IdCardsProvider], changeDetection: ChangeDetectionStrategy.OnPush, - imports: [ - AsyncPipe, - ThingTranslateModule, - UtilModule, - IdCardComponent, - TranslateModule, - TitleCasePipe, - IonIconDirective, - ], + imports: [AsyncPipe, ThingTranslateModule, UtilModule, IdCardComponent, TranslateModule, IonIconDirective], }) export class IdCardsComponent { idCards: Observable = this.idCardsProvider.getIdCards(); diff --git a/frontend/app/src/app/translation/common-string-pipes.ts b/frontend/app/src/app/translation/common-string-pipes.ts index cbbb2cf9..9af908ee 100644 --- a/frontend/app/src/app/translation/common-string-pipes.ts +++ b/frontend/app/src/app/translation/common-string-pipes.ts @@ -33,7 +33,8 @@ export class ArrayJoinPipe implements PipeTransform { } if (!Array.isArray(anArray)) { - throw new SyntaxError(`Wrong parameter in ArrayJoinPipe. Expected a valid Array, received: ${anArray}`); + logger.warn(`Wrong parameter in ArrayJoinPipe. Expected a valid Array, received: ${anArray}`); + return ''; } this.value = anArray.join(separator); @@ -77,9 +78,10 @@ export class SentenceCasePipe implements PipeTransform { transform(aString: string | unknown): string { if (typeof aString !== 'string') { - throw new SyntaxError( - `Wrong parameter in StringSplitPipe. Expected a valid String, received: ${aString}`, - ); + if (aString !== undefined) { + logger.warn(`Wrong parameter in SentenceCasePipe. Expected a valid String, received: ${aString}`); + } + return ''; } this.value = aString.slice(0, 1).toUpperCase() + aString.slice(1); @@ -103,9 +105,8 @@ export class StringSplitPipe implements PipeTransform { } if (typeof aString !== 'string') { - throw new SyntaxError( - `Wrong parameter in StringSplitPipe. Expected a valid String, received: ${aString}`, - ); + logger.warn(`Wrong parameter in StringSplitPipe. Expected a valid String, received: ${aString}`); + return []; } this.value = aString.split(splitter); diff --git a/frontend/app/src/app/translation/property-name-translate.pipe.ts b/frontend/app/src/app/translation/property-name-translate.pipe.ts index b286b2bc..e454a249 100644 --- a/frontend/app/src/app/translation/property-name-translate.pipe.ts +++ b/frontend/app/src/app/translation/property-name-translate.pipe.ts @@ -17,6 +17,7 @@ import {Subscription} from 'rxjs'; import {TranslateService} from '@ngx-translate/core'; import {ThingTranslateService} from './thing-translate.service'; import {isThing, SCThings, SCThingType} from '@openstapps/core'; +import {logger} from '../_helpers/ts-logger.js'; @Injectable() @Pipe({ @@ -51,9 +52,10 @@ export class PropertyNameTranslatePipe implements PipeTransform, OnDestroy { } if (!isThing(thingOrType) && typeof thingOrType !== 'string') { - throw new SyntaxError( + logger.warn( `Wrong parameter in ThingTranslatePipe. Expected a valid SCThing or String, received: ${thingOrType}`, ); + return ''; } // store the params, in case they change diff --git a/frontend/app/src/app/translation/thing-translate.pipe.ts b/frontend/app/src/app/translation/thing-translate.pipe.ts index 469359d3..f5a781b0 100644 --- a/frontend/app/src/app/translation/thing-translate.pipe.ts +++ b/frontend/app/src/app/translation/thing-translate.pipe.ts @@ -17,6 +17,7 @@ import {TranslateService} from '@ngx-translate/core'; import {isThing, SCThings, SCThingWithoutReferences} from '@openstapps/core'; import {Subscription} from 'rxjs'; import {ThingTranslateService} from './thing-translate.service'; +import {logger} from '../_helpers/ts-logger.js'; @Injectable() @Pipe({ @@ -52,9 +53,8 @@ export class ThingTranslatePipe implements PipeTransform, OnDestroy { } if (!isThing(thing)) { - throw new SyntaxError( - `Wrong parameter in ThingTranslatePipe. Expected a valid SCThing, received: ${thing}`, - ); + logger.warn(`Wrong parameter in ThingTranslatePipe. Expected a valid SCThing, received: ${thing}`); + return {} as never; } // store the params, in case they change