diff --git a/src/app/pages/account/ref-system/ref-system.component.html b/src/app/pages/account/ref-system/ref-system.component.html index 348a72c..98a48e4 100644 --- a/src/app/pages/account/ref-system/ref-system.component.html +++ b/src/app/pages/account/ref-system/ref-system.component.html @@ -11,11 +11,15 @@ strokeWidth="2" styleClass="angular-spinner" > - + > --> +
+
Скопировать ссылку
+
share
+
diff --git a/src/app/pages/account/ref-system/ref-system.component.scss b/src/app/pages/account/ref-system/ref-system.component.scss index 3c6294c..58dcb42 100644 --- a/src/app/pages/account/ref-system/ref-system.component.scss +++ b/src/app/pages/account/ref-system/ref-system.component.scss @@ -1,5 +1,29 @@ :host { .ref-system { - + .share-container { + display: flex; + justify-content: space-between; + height: 50px; + .share { + width: 50px; + background-color: #09467f; + border-radius: 8px; + display: flex; + justify-content: center; + align-items: center; + img { + height: 26px; + } + } + .copy { + background-color: #09467f; + color: #fff; + border-radius: 8px; + width: calc(100% - 66px); + display: flex; + justify-content: center; + align-items: center; + } + } } } \ No newline at end of file diff --git a/src/app/pages/account/ref-system/ref-system.component.ts b/src/app/pages/account/ref-system/ref-system.component.ts index e27da82..db6bd73 100644 --- a/src/app/pages/account/ref-system/ref-system.component.ts +++ b/src/app/pages/account/ref-system/ref-system.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import * as barcode from 'jsbarcode'; +import { MessageService } from 'primeng/api'; import { lastValueFrom } from 'rxjs'; import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service'; import { environment } from 'src/environments/environment'; @@ -15,6 +16,7 @@ export class RefSystemComponent implements OnInit { constructor( private jsonrpc: JsonrpcService, + private messageService: MessageService ) { } async ngOnInit() { @@ -25,8 +27,42 @@ export class RefSystemComponent implements OnInit { }, RpcService.bonusService )))['Cards'][0] + this.refUrl += accountData.CardNumber this.loading = false - this.refUrl += accountData.CardNumber + } + + share() { + if (navigator.share) { + navigator.share({ + title: document.title, + text: "Fashion Logica", + url: this.refUrl + }) + .then(() => console.log('Successful share')) + .catch((error) => { + this.messageService.add({ + severity: 'error', + summary: 'Произошла ошибка!', + }); + console.log('Error sharing:', error) + }); + } + } + + copyUrl() { + navigator.clipboard.writeText(this.refUrl) + .then(() => { + this.messageService.add({ + severity: 'custom', + summary: 'Ссылка скопирована!', + }); + }) + .catch(err => { + this.messageService.add({ + severity: 'error', + summary: 'Произошла ошибка!', + }); + }); } } diff --git a/src/app/pages/main/main.component.ts b/src/app/pages/main/main.component.ts index 60b07d7..d846c97 100644 --- a/src/app/pages/main/main.component.ts +++ b/src/app/pages/main/main.component.ts @@ -45,7 +45,6 @@ export class MainComponent implements OnInit { this.deferredPrompt = e; }); route.queryParams.subscribe((params) => { - console.log('####: ', params); if (params['token']) this.token = params['token']; }); } @@ -67,7 +66,7 @@ export class MainComponent implements OnInit { this.deferredPrompt.userChoice.then((res: any) => { if (res.outcome === 'accepted') { this.messageService.add({ - severity: 'success', + severity: 'custom', summary: 'Спасибо за установку!', }); console.log('User Accepted!!!'); diff --git a/src/app/services/messaging.service.ts b/src/app/services/messaging.service.ts index 3aef5cf..6c5edea 100644 --- a/src/app/services/messaging.service.ts +++ b/src/app/services/messaging.service.ts @@ -53,18 +53,9 @@ export class MessagingService { requestPermission() { try { - console.log('1'); - - this.angularFireMessaging.getToken.subscribe({ - next: (val) => { - console.log('VAL: ', val) - } - }) this.angularFireMessaging.requestToken.subscribe({ next: (token) => { - console.log('#: ') this.updateToken(token); - console.log('####TOKEN: ', token); }, error: (e) => console.error(e), }); @@ -77,7 +68,6 @@ export class MessagingService { * hook method when new notification received in foreground */ receiveMessage() { - console.log('#REC') this.angularFireMessaging.messages.subscribe((payload: any) => { console.log('new message received. ', payload); this.currentMessage.next(payload); diff --git a/src/assets/share.svg b/src/assets/share.svg new file mode 100644 index 0000000..5bbc70b --- /dev/null +++ b/src/assets/share.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/styles.scss b/src/styles.scss index 47a02e5..edb2a38 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -60,3 +60,7 @@ button { justify-content: space-between; max-width: 400px; } + +input::-webkit-date-and-time-value { + text-align: left; +}