forked from lthn/blockchain
copy indication
This commit is contained in:
parent
97667068a5
commit
4ae216b143
8 changed files with 73 additions and 12 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -2,6 +2,6 @@
|
|||
<img src="{{qrImageSrc}}" alt="qr-code">
|
||||
<div class="wrap-address">
|
||||
<div class="address">{{variablesService.currentWallet.address}}</div>
|
||||
<button type="button" class="btn-copy-address" (click)="copyAddress()"></button>
|
||||
<button #copyButton type="button" class="btn-copy-address copy" (click)="copyAddress()"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -18,10 +18,21 @@
|
|||
line-height: 2.7rem;
|
||||
|
||||
.btn-copy-address {
|
||||
mask: url(../../assets/icons/copy.svg) no-repeat center;
|
||||
margin-left: 1.2rem;
|
||||
width: 1.7rem;
|
||||
height: 1.7rem;
|
||||
|
||||
&.copy {
|
||||
mask: url(../../assets/icons/copy.svg) no-repeat center;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
&.copied {
|
||||
mask: url(../../assets/icons/complete-testwallet.svg) no-repeat center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, OnInit, OnDestroy} from '@angular/core';
|
||||
import {Component, OnInit, OnDestroy, ViewChild, ElementRef, Renderer2} from '@angular/core';
|
||||
import QRCode from 'qrcode';
|
||||
import {BackendService} from '../_helpers/services/backend.service';
|
||||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
|
|
@ -12,9 +12,11 @@ import {ActivatedRoute} from '@angular/router';
|
|||
export class ReceiveComponent implements OnInit, OnDestroy {
|
||||
qrImageSrc: string;
|
||||
parentRouting;
|
||||
@ViewChild('copyButton') copy: ElementRef;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private renderer: Renderer2,
|
||||
private backend: BackendService,
|
||||
private variablesService: VariablesService
|
||||
) {
|
||||
|
|
@ -35,6 +37,12 @@ export class ReceiveComponent implements OnInit, OnDestroy {
|
|||
|
||||
public copyAddress() {
|
||||
this.backend.setClipboard(this.variablesService.currentWallet.address);
|
||||
this.renderer.removeClass(this.copy.nativeElement, 'copy');
|
||||
this.renderer.addClass(this.copy.nativeElement, 'copied');
|
||||
window.setTimeout(() => {
|
||||
this.renderer.removeClass(this.copy.nativeElement, 'copied');
|
||||
this.renderer.addClass(this.copy.nativeElement, 'copy');
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
<div class="address">
|
||||
<span>{{variablesService.currentWallet.address}}</span>
|
||||
<i class="icon copy" (click)="copyAddress()"></i>
|
||||
<i #copyIcon class="icon copy" (click)="copyAddress()"></i>
|
||||
</div>
|
||||
<div class="balance">
|
||||
<span [tooltip]="getTooltip()" [placement]="'bottom'" [tooltipClass]="'balance-tooltip'" [delay]="500" [timeout]="1000">{{variablesService.currentWallet.balance | intToMoney : '3'}} {{variablesService.defaultCurrency}}</span>
|
||||
|
|
|
|||
|
|
@ -74,6 +74,14 @@
|
|||
|
||||
&.copy {
|
||||
mask: url(../../assets/icons/copy.svg) no-repeat center;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.75;
|
||||
}
|
||||
}
|
||||
|
||||
&.copied {
|
||||
mask: url(../../assets/icons/complete-testwallet.svg) no-repeat center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Component, OnInit, OnDestroy, NgZone} from '@angular/core';
|
||||
import {Component, OnInit, OnDestroy, NgZone, ViewChild, ElementRef, Renderer2} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
import {BackendService} from '../_helpers/services/backend.service';
|
||||
|
|
@ -14,6 +14,7 @@ import {BigNumber} from 'bignumber.js';
|
|||
export class WalletComponent implements OnInit, OnDestroy {
|
||||
subRouting;
|
||||
walletID;
|
||||
@ViewChild('copyIcon') copy: ElementRef;
|
||||
tabs = [
|
||||
{
|
||||
title: 'WALLET.TABS.HISTORY',
|
||||
|
|
@ -62,6 +63,7 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private renderer: Renderer2,
|
||||
private backend: BackendService,
|
||||
private variablesService: VariablesService,
|
||||
private ngZone: NgZone,
|
||||
|
|
@ -93,6 +95,12 @@ export class WalletComponent implements OnInit, OnDestroy {
|
|||
|
||||
copyAddress() {
|
||||
this.backend.setClipboard(this.variablesService.currentWallet.address);
|
||||
this.renderer.removeClass(this.copy.nativeElement, 'copy');
|
||||
this.renderer.addClass(this.copy.nativeElement, 'copied');
|
||||
window.setTimeout(() => {
|
||||
this.renderer.removeClass(this.copy.nativeElement, 'copied');
|
||||
this.renderer.addClass(this.copy.nativeElement, 'copy');
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
getTooltip() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue