refactor: remove nullish coalecing pipe

This commit is contained in:
2023-12-06 16:33:51 +01:00
parent 288a49113f
commit 9d5dd05bb6
4 changed files with 2 additions and 48 deletions

View File

@@ -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
*/

View File

@@ -24,12 +24,10 @@
class="clickable"
>
<ion-card-header mode="md">
<ion-card-title>
{{ this.scheduleEvent.dateSeries.event.name | nullishCoalesce : this.scheduleEvent.dateSeries.name }}
</ion-card-title>
<ion-card-title>{{ scheduleEvent.dateSeries.event.name }}</ion-card-title>
</ion-card-header>
<ion-card-content>
<ion-note> {{ getNote() }} </ion-note>
<ion-note>{{ scheduleEvent.dateSeries.name }}</ion-note>
<ion-text *ngIf="showPlaceName" class="place-name">{{ scheduleEvent.dateSeries.inPlace?.name }}</ion-text>
</ion-card-content>
</ion-card>

View File

@@ -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 <https://www.gnu.org/licenses/>.
*/
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<T, G>(value: T, fallback: G): T | G {
return value ?? fallback;
}
}

View File

@@ -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,