Browse Source

refactor(ui): apply review feedback for form control disabled logic and isNil

Signed-off-by: Sigmabrogz <sigmabrogz@gmail.com>
pull/6495/head
Sigmabrogz 2 weeks ago
parent
commit
268d3c7b19
  1. 5
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts
  2. 6
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html

5
libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.component.ts

@ -24,6 +24,7 @@ import { MatInputModule } from '@angular/material/input';
import { IonIcon } from '@ionic/angular/standalone';
import { addIcons } from 'ionicons';
import { calendarClearOutline, refreshOutline } from 'ionicons/icons';
import { isNil } from 'lodash';
import { HistoricalMarketDataEditorDialogParams } from './interfaces/interfaces';
@ -95,7 +96,7 @@ export class GfHistoricalMarketDataEditorDialogComponent implements OnInit {
public onUpdate() {
const marketPrice = this.form.controls.marketPrice.value;
if (marketPrice === undefined || marketPrice === null) {
if (isNil(marketPrice)) {
return;
}
@ -106,7 +107,7 @@ export class GfHistoricalMarketDataEditorDialogComponent implements OnInit {
marketData: [
{
date: this.data.dateString,
marketPrice: marketPrice
marketPrice
}
]
},

6
libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor-dialog/historical-market-data-editor-dialog.html

@ -6,10 +6,10 @@
<mat-label i18n>Date</mat-label>
<input
disabled
formControlName="dateString"
matInput
name="date"
[matDatepicker]="date"
formControlName="dateString"
/>
<mat-datepicker-toggle class="mr-2" matSuffix [for]="date">
<ion-icon
@ -25,10 +25,10 @@
<mat-form-field appearance="outline" class="w-100">
<mat-label i18n>Market Price</mat-label>
<input
formControlName="marketPrice"
matInput
name="marketPrice"
type="number"
formControlName="marketPrice"
/>
<span class="ml-2" matTextSuffix>{{ data.currency }}</span>
</mat-form-field>
@ -47,7 +47,7 @@
<button
color="primary"
mat-flat-button
[disabled]="!form.dirty"
[disabled]="!(form.dirty && form.valid)"
(click)="onUpdate()"
>
<ng-container i18n>Save</ng-container>

Loading…
Cancel
Save