Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/app/ipo/place-bid/place-bid.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<ng-container *transloco="let t">
<div class="content_container">
<h1>{{ t("ipoComponent.place-bid.title") }}</h1>
<div *ngIf="balances.length <= 0">
<div *ngIf="!hasSeeds()">
{{ t("ipoComponent.place-bid.needBalance") }}
</div>
<div *ngIf="!ipoContract">
<div *ngIf="hasSeeds() && !ipoContract">
{{ t("ipoComponent.place-bid.noContract") }}<br><br>
<a [routerLink]="['/ipo']">{{ t("ipoComponent.place-bid.noContract.gotoIpoLabel") }}</a>
</div>
<div *ngIf="balances.length > 0 && ipoContract">
<div *ngIf="hasSeeds() && ipoContract">
<form [formGroup]="ipoForm" novalidate (ngSubmit)="onSubmit()">
<mat-card class="transfer-card">
<mat-card-content>
Expand Down
14 changes: 2 additions & 12 deletions src/app/ipo/place-bid/place-bid.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { WalletService } from '../../services/wallet.service';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { TranslocoService } from '@ngneat/transloco';
import { BalanceResponse, ContractDto, ProposalDto, Transaction } from '../../services/api.model';
import { ContractDto, Transaction } from '../../services/api.model';
import { FormBuilder, FormControl, Validators } from '@angular/forms';
import { UpdaterService } from '../../services/updater-service';
import { ActivatedRoute, Router } from '@angular/router';
Expand Down Expand Up @@ -36,7 +36,6 @@ export class PlaceBidComponent implements OnInit, OnDestroy {
public currentTick = 0;
public contractIndex: number | undefined;
private sub: any;
public balances: BalanceResponse[] = [];
public tickOverwrite = false;
public maxAmount: number = 0;
public ipoContract: ContractDto | undefined;
Expand Down Expand Up @@ -78,9 +77,6 @@ export class PlaceBidComponent implements OnInit, OnDestroy {
}

init(): void {
this.us.currentBalance.pipe(takeUntil(this.destroy$)).subscribe(s => {
this.balances = s;
});
this.us.currentTick.pipe(takeUntil(this.destroy$)).subscribe(tick => {
this.currentTick = tick;
this.ipoForm.controls.tick.addValidators(Validators.min(tick));
Expand Down Expand Up @@ -142,13 +138,7 @@ export class PlaceBidComponent implements OnInit, OnDestroy {
}

getMaxAmount(publicId: string) {
this.us.currentBalance.pipe(takeUntil(this.destroy$)).subscribe(s => {
if (s && s.length > 0 && s.find(f => f.publicId == publicId)) {
this.maxAmount = s.find(f => f.publicId == publicId)?.currentEstimatedAmount ?? s.find(f => f.publicId == publicId)?.epochBaseAmount ?? 0;
} else {
this.maxAmount = 0;
}
});
this.maxAmount = this.walletService.getSeed(publicId)?.balance ?? 0;
}

setAmounToMax(addAmount: number = 0) {
Expand Down