Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added question mark with tooltip for blind balance and also done some… #634

Merged
merged 3 commits into from
Jan 12, 2018
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
2 changes: 1 addition & 1 deletion src/app/core-ui/main/main-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export class MainViewComponent implements OnInit {
if (sec === 59) {
min = min - 1;
}
this.time = min + ':' + ('0' + sec).slice(-2);
if (min >= 0 && sec >= 0) {
this.time = min + ':' + ('0' + sec).slice(-2);
this.unSubscribeTimer = Observable.timer(1000).
subscribe(() => this.startTimer(min, sec));
} else {
Expand Down
11 changes: 7 additions & 4 deletions src/app/wallet/wallet/send/send.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@
<mat-radio-group class="from-balance-type block-radio" name="sendInput" [(ngModel)]="send.input" fxLayout="column" fxLayoutGap="10px" (change)="updateAmount()">
<mat-radio-button class="balance" value="balance" checked="checked" (click)="send.output = 'blind_balance'" fxFlex>
<div class="name">Public</div>
<div class="amount"><span class="desc">Available balance:</span> {{ getBalance('balance') }}</div>
<div class="desc">Available balance: <span class="amount">{{ getBalance('balance') }}</span></div>
</mat-radio-button>
<mat-radio-button class="balance" value="blind_balance" fxFlex (click)="send.output = 'balance'">
<div class="name">Blind</div>
<div class="amount"><span class="desc">Available balance:</span> {{ getBalance('blind_balance') }}</div>
<div class="desc">Available balance:<span *ngIf="!checkBalance('blind_balance')" class="amount">{{ getBalance('blind_balance') }}</span>
<mat-icon *ngIf="checkBalance('blind_balance')" fontSet="partIcon" fontIcon="part-circle-question" class="help-icon" matTooltip="It is normal to have a very small balance in Blind even after transferring out everything. This is due to the way CT works and part of the privacy platform."></mat-icon></div>
</mat-radio-button>
<mat-radio-button class="balance" value="anon_balance" fxFlex [disabled]="type === 'balanceTransfer'">
<div class="name">Anon</div>
<div class="amount"><span class="desc">Available balance:</span> {{ getBalance('anon_balance') }}</div>
<div class="desc">Available balance:<span class="amount">{{ getBalance('anon_balance') }}</span></div>
</mat-radio-button>
</mat-radio-group><!-- .from-balance-type -->

Expand Down Expand Up @@ -97,7 +98,9 @@
</mat-radio-button>
<mat-radio-button class="balance" value="blind_balance" (click)="send.input = 'balance'" fxFlex>
<div class="name">Blind</div>
<div class="desc">Balance:<span class="amount">{{ getBalance('blind_balance') }}</span></div>
<div class="desc">Balance:<span *ngIf="!checkBalance('blind_balance')" class="amount">{{ getBalance('blind_balance') }}</span>
<mat-icon *ngIf="checkBalance('blind_balance')" fontSet="partIcon" fontIcon="part-circle-question" class="help-icon" matTooltip="It is normal to have a very small balance in Blind even after transferring out everything. This is due to the way CT works and part of the privacy platform."></mat-icon>
</div>
</mat-radio-button>
<mat-radio-button class="balance" value="anon_balance" disabled fxFlex>
<div class="name">Anon</div>
Expand Down
8 changes: 8 additions & 0 deletions src/app/wallet/wallet/send/send.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
font-weight: 600;
margin-left: 5px;
}
.help-icon { // explanation of "1e-8" at blind balances (after sending all blind)
margin-left: 3px;
font-size: 14px;
color: $color-info;
line-height: 0;
position: relative;
top: 2px;
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/app/wallet/wallet/send/send.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class SendComponent {
advanced: boolean = false;
progress: number = 10;
advancedText: string = 'Advanced options'
isBlind: boolean = false;
// TODO: Create proper Interface / type
send: any = {
input: 'balance',
Expand Down Expand Up @@ -85,6 +86,12 @@ export class SendComponent {
return this._rpc.state.get(account) || 0;
}

checkBalance(account: string): boolean {
if (account === 'blind_balance') {
return parseFloat(this._rpc.state.get(account)) < 0.0001 && parseFloat(this._rpc.state.get(account)) > 0;
}
}

/** Get the send address */
getAddress(): string {
if (this.type === 'sendPayment') {
Expand Down
2 changes: 1 addition & 1 deletion src/app/wallet/wallet/shared/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class TransactionService {
this.rpc.state.observe('txcount')
.subscribe(
txcount => {
if (txcount > this.txCount || txcount === 1) {
if (txcount > this.txCount || (txcount === 1 && this.txCount === 0)) {
this.txCount = txcount;
this.newTransaction();
} else {
Expand Down