feat: receive screen qr code
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, inject, TemplateRef } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { QrCodeComponent } from 'ng-qrcode';
|
||||
|
||||
@Component({
|
||||
selector: 'app-screen-receive',
|
||||
imports: [FormsModule],
|
||||
imports: [FormsModule, QrCodeComponent],
|
||||
templateUrl: './screen-receive.html',
|
||||
styleUrl: './screen-receive.less',
|
||||
})
|
||||
export class ScreenReceive {
|
||||
me = 'DemoUser';
|
||||
private modalService = inject(NgbModal);
|
||||
|
||||
user = 'DemoUser';
|
||||
amount: number = 0;
|
||||
shareableLink: string = 'https://yourapp.com/receive?amount=0';
|
||||
get shareableLink(): string {
|
||||
const currentDomain = window.location.origin;
|
||||
return `${currentDomain}/send/${this.user}?amount=${this.amount}`;
|
||||
}
|
||||
|
||||
copyLink() {
|
||||
navigator.clipboard.writeText(this.shareableLink);
|
||||
alert('Link copied to clipboard!');
|
||||
}
|
||||
|
||||
shareViaEmail() {
|
||||
const email = `mailto:?subject=Request Money&body=Please send me $${this.amount} via ${this.shareableLink}`;
|
||||
window.location.href = email;
|
||||
}
|
||||
|
||||
shareViaLink() {
|
||||
this.copyLink();
|
||||
open(content: TemplateRef<any>) {
|
||||
this.modalService.open(content)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user