mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: remove nullish coalecing pipe
This commit is contained in:
@@ -74,13 +74,6 @@ export class ScheduleCardComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private readonly scheduleProvider: ScheduleProvider) {}
|
constructor(private readonly scheduleProvider: ScheduleProvider) {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the note text
|
|
||||||
*/
|
|
||||||
getNote(): string | undefined {
|
|
||||||
return this.scheduleEvent?.dateSeries?.name ?? undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializer
|
* Initializer
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,12 +24,10 @@
|
|||||||
class="clickable"
|
class="clickable"
|
||||||
>
|
>
|
||||||
<ion-card-header mode="md">
|
<ion-card-header mode="md">
|
||||||
<ion-card-title>
|
<ion-card-title>{{ scheduleEvent.dateSeries.event.name }}</ion-card-title>
|
||||||
{{ this.scheduleEvent.dateSeries.event.name | nullishCoalesce : this.scheduleEvent.dateSeries.name }}
|
|
||||||
</ion-card-title>
|
|
||||||
</ion-card-header>
|
</ion-card-header>
|
||||||
<ion-card-content>
|
<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-text *ngIf="showPlaceName" class="place-name">{{ scheduleEvent.dateSeries.inPlace?.name }}</ion-text>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {ArrayLastPipe} from './array-last.pipe';
|
import {ArrayLastPipe} from './array-last.pipe';
|
||||||
import {DateIsThisPipe} from './date-is-today.pipe';
|
import {DateIsThisPipe} from './date-is-today.pipe';
|
||||||
import {NullishCoalescingPipe} from './nullish-coalecing.pipe';
|
|
||||||
import {DateFromIndexPipe} from './date-from-index.pipe';
|
import {DateFromIndexPipe} from './date-from-index.pipe';
|
||||||
import {DaytimeKeyPipe} from './daytime-key.pipe';
|
import {DaytimeKeyPipe} from './daytime-key.pipe';
|
||||||
import {LazyPipe} from './lazy.pipe';
|
import {LazyPipe} from './lazy.pipe';
|
||||||
@@ -49,7 +48,6 @@ import {CommonModule} from '@angular/common';
|
|||||||
ElementSizeChangeDirective,
|
ElementSizeChangeDirective,
|
||||||
ArrayLastPipe,
|
ArrayLastPipe,
|
||||||
DateIsThisPipe,
|
DateIsThisPipe,
|
||||||
NullishCoalescingPipe,
|
|
||||||
LazyPipe,
|
LazyPipe,
|
||||||
SectionComponent,
|
SectionComponent,
|
||||||
DateFromIndexPipe,
|
DateFromIndexPipe,
|
||||||
@@ -65,7 +63,6 @@ import {CommonModule} from '@angular/common';
|
|||||||
ElementSizeChangeDirective,
|
ElementSizeChangeDirective,
|
||||||
ArrayLastPipe,
|
ArrayLastPipe,
|
||||||
DateIsThisPipe,
|
DateIsThisPipe,
|
||||||
NullishCoalescingPipe,
|
|
||||||
LazyPipe,
|
LazyPipe,
|
||||||
DateFromIndexPipe,
|
DateFromIndexPipe,
|
||||||
DaytimeKeyPipe,
|
DaytimeKeyPipe,
|
||||||
|
|||||||
Reference in New Issue
Block a user