Browse Source

Add platform logo to account selectors

pull/7554/head
Thomas Kaul 4 weeks ago
parent
commit
3b885c656e
  1. 22
      apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts
  2. 28
      apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.html

22
apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.component.ts

@ -61,12 +61,22 @@ export class GfTransferBalanceDialogComponent {
private readonly dialogRef = private readonly dialogRef =
inject<MatDialogRef<GfTransferBalanceDialogComponent>>(MatDialogRef); inject<MatDialogRef<GfTransferBalanceDialogComponent>>(MatDialogRef);
protected get selectedFromAccount() {
return this.getAccountById(
this.transferBalanceForm.controls.fromAccount.value
);
}
protected get selectedToAccount() {
return this.getAccountById(
this.transferBalanceForm.controls.toAccount.value
);
}
public ngOnInit() { public ngOnInit() {
this.transferBalanceForm.controls.fromAccount.valueChanges.subscribe( this.transferBalanceForm.controls.fromAccount.valueChanges.subscribe(
(id) => { (id) => {
const currency = this.accounts.find((account) => { const currency = this.getAccountById(id)?.currency;
return account.id === id;
})?.currency;
if (currency) { if (currency) {
this.currency = currency; this.currency = currency;
@ -101,4 +111,10 @@ export class GfTransferBalanceDialogComponent {
return null; return null;
} }
private getAccountById(aId: string | null) {
return this.accounts.find(({ id }) => {
return id === aId;
});
}
} }

28
apps/client/src/app/pages/accounts/transfer-balance/transfer-balance-dialog.html

@ -10,6 +10,20 @@
<mat-form-field appearance="outline" class="w-100"> <mat-form-field appearance="outline" class="w-100">
<mat-label i18n>From</mat-label> <mat-label i18n>From</mat-label>
<mat-select formControlName="fromAccount"> <mat-select formControlName="fromAccount">
<mat-select-trigger>
<div class="d-flex">
@if (selectedFromAccount) {
<gf-entity-logo
class="mr-1"
[hasPlaceholder]="true"
[tooltip]="selectedFromAccount?.platform?.name"
[url]="selectedFromAccount?.platform?.url"
/>
}
<span>{{ selectedFromAccount?.name }}</span>
</div>
</mat-select-trigger>
@for (account of accounts; track account) { @for (account of accounts; track account) {
<mat-option [value]="account.id"> <mat-option [value]="account.id">
<div class="d-flex"> <div class="d-flex">
@ -30,6 +44,20 @@
<mat-form-field appearance="outline" class="w-100"> <mat-form-field appearance="outline" class="w-100">
<mat-label i18n>To</mat-label> <mat-label i18n>To</mat-label>
<mat-select formControlName="toAccount"> <mat-select formControlName="toAccount">
<mat-select-trigger>
<div class="d-flex">
@if (selectedToAccount) {
<gf-entity-logo
class="mr-1"
[hasPlaceholder]="true"
[tooltip]="selectedToAccount?.platform?.name"
[url]="selectedToAccount?.platform?.url"
/>
}
<span>{{ selectedToAccount?.name }}</span>
</div>
</mat-select-trigger>
@for (account of accounts; track account) { @for (account of accounts; track account) {
<mat-option [value]="account.id"> <mat-option [value]="account.id">
<div class="d-flex"> <div class="d-flex">

Loading…
Cancel
Save