Skip to content

Commit

Permalink
update: disabled delegate for evm-account (#3679)
Browse files Browse the repository at this point in the history
  • Loading branch information
TranTrungTien authored Aug 19, 2024
1 parent 6ea27a7 commit 43cb468
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ <h6 class="mb-0">
<button
class="button button-outline button--sm button-pill button-flat d-flex text--black"
type="button"
[disabled]="isDisableClaim || isLoading"
(click)="viewDialog(true)">
(click)="viewDialog(true)"
[appTooltip]="isEvmAccount ? 'Using cosmos account. Please!': ''"
[disabled]="isEvmAccount || isDisableClaim || isLoading">
<img
[src]="'assets/icons/icons-svg/color/spinner.svg' | imageS3"
alt=""
Expand Down Expand Up @@ -85,8 +86,9 @@ <h6 class="mb-0">
<div *ngSwitchCase="'action'" class="py-4">
<button
type="button"
[appTooltip]="isEvmAccount ? 'Using cosmos account. Please!': ''"
class="button button--sm button-pill button-outline button-outline__in-card ml-auto"
[disabled]="clicked"
[disabled]="isEvmAccount || clicked"
(click)="clicked = true; viewDialog(false, modalManage, data['validator_address'])">
<span class="body-02 text--gray-1">Manage</span>
</button>
Expand Down Expand Up @@ -244,4 +246,4 @@ <h6 class="mb-0">
</div>
</div>
</div>
</ng-container>
</ng-container>
10 changes: 9 additions & 1 deletion src/app/pages/validators/staking-info/staking-info.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { MatLegacyTableDataSource as MatTableDataSource } from '@angular/material/legacy-table';
import { TableTemplate } from 'src/app/core/models/common.model';
import { WalletService } from 'src/app/core/services/wallet.service';

@Component({
selector: 'app-staking-info',
Expand Down Expand Up @@ -30,8 +31,15 @@ export class StakingInfoComponent implements OnChanges {
displayedColumnsWallet: string[] = this.templatesWallet.map((dta) => dta.matColumnDef);
clicked = false;
isDisableClaim = true;
isEvmAccount = false;

constructor() {}
constructor(private walletService: WalletService) {
this.walletService.walletAccount$.subscribe({
next: (wallet) => {
this.isEvmAccount = !!wallet.evmAccount;
},
});
}

ngOnChanges(changes: SimpleChanges): void {
this.dataSourceWallet = new MatTableDataSource(this.dataUserDelegate?.delegations);
Expand Down
20 changes: 11 additions & 9 deletions src/app/pages/validators/validators.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,16 @@ <h2 class="h3-mob mb-0 text--white">Validators</h2>
</div>
</div>
<div *ngSwitchCase="'action'">
<button
type="button"
class="button button--sm button-pill button-outline button-outline__in-card ml-auto"
[disabled]="clicked"
*ngIf="!data['jailed']"
(click)="viewPopupDetail(modalManage, data.operator_address, dialogMode.Delegate, true)">
<span class="body-02 text--gray-1">Delegate</span>
</button>
<div *ngSwitchCase="'action'">
<button
type="button"
[appTooltip]="isEvmAccount ? 'Using cosmos account. Please!': ''"
class="button button--sm button-pill button-outline button-outline__in-card ml-auto"
[disabled]="clicked || isEvmAccount" *ngIf="!data['jailed']"
(click)="viewPopupDetail(modalManage, data.operator_address, dialogMode.Delegate, true)">
<span class="body-02 text--gray-1">Delegate</span>
</button>
</div>
</div>
<div *ngSwitchDefault class="text-center">{{ data[template.matColumnDef] }}</div>
</ng-container>
Expand Down Expand Up @@ -656,4 +658,4 @@ <h5 class="mb-1 text--gray-1">

<div *ngIf="loadingData" class="mt-20">
<app-loading-sprint></app-loading-sprint>
</div>
</div>
9 changes: 8 additions & 1 deletion src/app/pages/validators/validators.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export class ValidatorsComponent implements OnInit, OnDestroy {
coinMinimalDenom = this.chainInfo.currencies[0].coinMinimalDenom;
stakeContractAddr = this.environmentService.evmChainInfo.stakeContract;
claimContractAddr = this.environmentService.evmChainInfo.claimContract;
isEvmAccount = false;

constructor(
private validatorService: ValidatorService,
Expand All @@ -133,7 +134,13 @@ export class ValidatorsComponent implements OnInit, OnDestroy {
private environmentService: EnvironmentService,
private proposalService: ProposalService,
private transactionService: TransactionService,
) {}
) {
this.walletService.walletAccount$.subscribe({
next: (wallet) => {
this.isEvmAccount = !!wallet.evmAccount;
},
});
}

async ngOnInit() {
this.getCountProposal();
Expand Down

0 comments on commit 43cb468

Please sign in to comment.