From 9d5dd05bb62b84a4324e846ee8da14caabeb0394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Wed, 6 Dec 2023 16:33:51 +0100 Subject: [PATCH] refactor: remove nullish coalecing pipe --- .../page/grid/schedule-card.component.ts | 7 ---- .../schedule/page/grid/schedule-card.html | 6 ++-- .../src/app/util/nullish-coalecing.pipe.ts | 34 ------------------- frontend/app/src/app/util/util.module.ts | 3 -- 4 files changed, 2 insertions(+), 48 deletions(-) delete mode 100644 frontend/app/src/app/util/nullish-coalecing.pipe.ts diff --git a/frontend/app/src/app/modules/schedule/page/grid/schedule-card.component.ts b/frontend/app/src/app/modules/schedule/page/grid/schedule-card.component.ts index 41ae4ef6..2e29a827 100644 --- a/frontend/app/src/app/modules/schedule/page/grid/schedule-card.component.ts +++ b/frontend/app/src/app/modules/schedule/page/grid/schedule-card.component.ts @@ -74,13 +74,6 @@ export class ScheduleCardComponent implements OnInit { constructor(private readonly scheduleProvider: ScheduleProvider) {} - /** - * Get the note text - */ - getNote(): string | undefined { - return this.scheduleEvent?.dateSeries?.name ?? undefined; - } - /** * Initializer */ diff --git a/frontend/app/src/app/modules/schedule/page/grid/schedule-card.html b/frontend/app/src/app/modules/schedule/page/grid/schedule-card.html index 362d25b7..f1fd0188 100644 --- a/frontend/app/src/app/modules/schedule/page/grid/schedule-card.html +++ b/frontend/app/src/app/modules/schedule/page/grid/schedule-card.html @@ -24,12 +24,10 @@ class="clickable" > - - {{ this.scheduleEvent.dateSeries.event.name | nullishCoalesce : this.scheduleEvent.dateSeries.name }} - + {{ scheduleEvent.dateSeries.event.name }} - {{ getNote() }} + {{ scheduleEvent.dateSeries.name }} {{ scheduleEvent.dateSeries.inPlace?.name }} diff --git a/frontend/app/src/app/util/nullish-coalecing.pipe.ts b/frontend/app/src/app/util/nullish-coalecing.pipe.ts deleted file mode 100644 index 064ae803..00000000 --- a/frontend/app/src/app/util/nullish-coalecing.pipe.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -import {Injectable, Pipe, PipeTransform} from '@angular/core'; - -/** - * Get the last value of an array - */ -@Injectable() -@Pipe({ - name: 'nullishCoalesce', - pure: true, -}) -export class NullishCoalescingPipe implements PipeTransform { - /** - * Transform - */ - // tslint:disable-next-line:prefer-function-over-method - transform(value: T, fallback: G): T | G { - return value ?? fallback; - } -} diff --git a/frontend/app/src/app/util/util.module.ts b/frontend/app/src/app/util/util.module.ts index 60cc603f..aec72aaf 100644 --- a/frontend/app/src/app/util/util.module.ts +++ b/frontend/app/src/app/util/util.module.ts @@ -15,7 +15,6 @@ import {NgModule} from '@angular/core'; import {ArrayLastPipe} from './array-last.pipe'; import {DateIsThisPipe} from './date-is-today.pipe'; -import {NullishCoalescingPipe} from './nullish-coalecing.pipe'; import {DateFromIndexPipe} from './date-from-index.pipe'; import {DaytimeKeyPipe} from './daytime-key.pipe'; import {LazyPipe} from './lazy.pipe'; @@ -49,7 +48,6 @@ import {CommonModule} from '@angular/common'; ElementSizeChangeDirective, ArrayLastPipe, DateIsThisPipe, - NullishCoalescingPipe, LazyPipe, SectionComponent, DateFromIndexPipe, @@ -65,7 +63,6 @@ import {CommonModule} from '@angular/common'; ElementSizeChangeDirective, ArrayLastPipe, DateIsThisPipe, - NullishCoalescingPipe, LazyPipe, DateFromIndexPipe, DaytimeKeyPipe,