Removing sponsors code.

Support new sponsor confirmation polling.
fixes #319
This commit is contained in:
softsimon
2021-02-07 02:20:07 +07:00
parent c733497e52
commit eb0c20dd92
14 changed files with 107 additions and 430 deletions

View File

@@ -173,10 +173,9 @@
<div *ngIf="donationStatus === 4" class="text-center">
<h2><span i18n="about.sponsor.donation-confirmed">Donation confirmed!</span><br><span i18n="about.sponsor.thank-you">Thank you!</span></h2>
<p i18n="about.sponsor.sponsor-completed">If you specified a Twitter handle, the profile photo should now be visible on this page when you reload.</p>
</div>
<br><br><br><br>
<br><br><br>
<a target="_blank" class="m-2 fw6 mb3 mt2 truncate black-80 f4 link" href="https://github.com/mempool/mempool">
<span class="dib v-mid">

View File

@@ -1,19 +1,19 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { WebsocketService } from '../../services/websocket.service';
import { SeoService } from 'src/app/services/seo.service';
import { StateService } from 'src/app/services/state.service';
import { Observable } from 'rxjs';
import { Observable, Subscription } from 'rxjs';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ApiService } from 'src/app/services/api.service';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { map } from 'rxjs/operators';
import { delay, map, retryWhen, switchMap, tap } from 'rxjs/operators';
@Component({
selector: 'app-about',
templateUrl: './about.component.html',
styleUrls: ['./about.component.scss'],
})
export class AboutComponent implements OnInit {
export class AboutComponent implements OnInit, OnDestroy {
gitCommit$: Observable<string>;
donationForm: FormGroup;
paymentForm: FormGroup;
@@ -22,6 +22,7 @@ export class AboutComponent implements OnInit {
donationObj: any;
sponsorsEnabled = this.stateService.env.SPONSORS_ENABLED;
sponsors = null;
requestSubscription: Subscription | undefined;
constructor(
private websocketService: WebsocketService,
@@ -50,23 +51,37 @@ export class AboutComponent implements OnInit {
.subscribe((sponsors) => {
this.sponsors = sponsors;
});
}
this.apiService.getDonation$()
this.stateService.donationConfirmed$.subscribe(() => this.donationStatus = 4);
ngOnDestroy() {
if (this.requestSubscription) {
this.requestSubscription.unsubscribe();
}
}
submitDonation() {
if (this.donationForm.invalid) {
return;
}
this.apiService.requestDonation$(
this.requestSubscription = this.apiService.requestDonation$(
this.donationForm.get('amount').value,
this.donationForm.get('handle').value
)
.subscribe((response) => {
this.websocketService.trackDonation(response.id);
this.donationObj = response;
this.donationStatus = 3;
.pipe(
tap((response) => {
this.donationObj = response;
this.donationStatus = 3;
}),
switchMap(() => this.apiService.checkDonation$(this.donationObj.id)
.pipe(
retryWhen((errors) => errors.pipe(delay(2000)))
)
)
).subscribe(() => {
this.donationStatus = 4;
if (this.donationForm.get('handle').value) {
this.sponsors.unshift({ handle: this.donationForm.get('handle').value });
}
});
}

View File

@@ -15,13 +15,11 @@ export interface WebsocketResponse {
tx?: Transaction;
rbfTransaction?: Transaction;
transactions?: TransactionStripped[];
donationConfirmed?: boolean;
loadingIndicators?: ILoadingIndicators;
'track-tx'?: string;
'track-address'?: string;
'track-asset'?: string;
'watch-mempool'?: boolean;
'track-donation'?: string;
}
export interface MempoolBlock {

View File

@@ -77,6 +77,10 @@ export class ApiService {
return this.httpClient.get<any[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/donations');
}
checkDonation$(orderId: string): Observable<any[]> {
return this.httpClient.get<any[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/donations/check?order_id=' + orderId);
}
getInitData$(): Observable<WebsocketResponse> {
return this.httpClient.get<WebsocketResponse>(this.apiBaseUrl + this.apiBasePath + '/api/v1/init-data');
}

View File

@@ -64,7 +64,6 @@ export class StateService {
vbytesPerSecond$ = new ReplaySubject<number>(1);
lastDifficultyAdjustment$ = new ReplaySubject<number>(1);
gitCommit$ = new ReplaySubject<string>(1);
donationConfirmed$ = new Subject();
loadingIndicators$ = new ReplaySubject<ILoadingIndicators>(1);
live2Chart$ = new Subject<OptimizedMempoolStats>();

View File

@@ -126,10 +126,6 @@ export class WebsocketService {
this.isTrackingTx = true;
}
trackDonation(id: string) {
this.websocketSubject.next({ 'track-donation': id });
}
stopTrackingTransaction() {
if (!this.isTrackingTx) {
return;
@@ -289,9 +285,5 @@ export class WebsocketService {
if (response['git-commit']) {
this.stateService.gitCommit$.next(response['git-commit']);
}
if (response.donationConfirmed) {
this.stateService.donationConfirmed$.next(true);
}
}
}

View File

@@ -46,7 +46,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">205</context>
<context context-type="linenumber">208</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/bisq-transfers/bisq-transfers.component.html</context>
@@ -67,7 +67,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">206</context>
<context context-type="linenumber">209</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/bisq-transfers/bisq-transfers.component.html</context>
@@ -88,7 +88,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">209</context>
<context context-type="linenumber">212</context>
</context-group>
<note priority="1" from="description">Transaction unconfirmed state</note>
<note priority="1" from="meaning">transaction.unconfirmed</note>
@@ -242,7 +242,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">198</context>
<context context-type="linenumber">201</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/block/block.component.html</context>
@@ -468,7 +468,7 @@
<source>nSequence</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">92</context>
<context context-type="linenumber">95</context>
</context-group>
<note priority="1" from="description">transactions-list.nsequence</note>
</trans-unit>
@@ -476,7 +476,7 @@
<source>ScriptSig (ASM)</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">71</context>
<context context-type="linenumber">74</context>
</context-group>
<note priority="1" from="description">ScriptSig (ASM)</note>
<note priority="1" from="meaning">transactions-list.scriptsig.asm</note>
@@ -485,7 +485,7 @@
<source>ScriptSig (HEX)</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">75</context>
<context context-type="linenumber">78</context>
</context-group>
<note priority="1" from="description">ScriptSig (HEX)</note>
<note priority="1" from="meaning">transactions-list.scriptsig.hex</note>
@@ -494,7 +494,7 @@
<source>Witness</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">80</context>
<context context-type="linenumber">83</context>
</context-group>
<note priority="1" from="description">transactions-list.witness</note>
</trans-unit>
@@ -502,7 +502,7 @@
<source>P2SH redeem script</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">84</context>
<context context-type="linenumber">87</context>
</context-group>
<note priority="1" from="description">transactions-list.p2sh-redeem-script</note>
</trans-unit>
@@ -510,7 +510,7 @@
<source>P2WSH witness script</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">88</context>
<context context-type="linenumber">91</context>
</context-group>
<note priority="1" from="description">transactions-list.p2wsh-witness-script</note>
</trans-unit>
@@ -518,7 +518,7 @@
<source>Previous output script</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">96</context>
<context context-type="linenumber">99</context>
</context-group>
<note priority="1" from="description">transactions-list.previous-output-script</note>
</trans-unit>
@@ -526,11 +526,11 @@
<source>Load all</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">106</context>
<context context-type="linenumber">109</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">188</context>
<context context-type="linenumber">191</context>
</context-group>
<note priority="1" from="description">transactions-list.load-all</note>
</trans-unit>
@@ -538,7 +538,7 @@
<source>Peg-out to <x id="START_TAG_NG_CONTAINER" ctype="x-ng_container" equiv-text="&lt;ng-container *ngTemplateOutlet=&quot;pegOutLink&quot;&gt;"/><x id="CLOSE_TAG_NG_CONTAINER" ctype="x-ng_container" equiv-text="&lt;/ng-container&gt;"/></source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">125</context>
<context context-type="linenumber">128</context>
</context-group>
<note priority="1" from="description">transactions-list.peg-out-to</note>
</trans-unit>
@@ -546,7 +546,7 @@
<source>ScriptPubKey (ASM)</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">170</context>
<context context-type="linenumber">173</context>
</context-group>
<note priority="1" from="description">ScriptPubKey (ASM)</note>
<note priority="1" from="meaning">transactions-list.scriptpubkey.asm</note>
@@ -555,7 +555,7 @@
<source>ScriptPubKey (HEX)</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">174</context>
<context context-type="linenumber">177</context>
</context-group>
<note priority="1" from="description">ScriptPubKey (HEX)</note>
<note priority="1" from="meaning">transactions-list.scriptpubkey.hex</note>
@@ -564,7 +564,7 @@
<source>Type</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">166</context>
<context context-type="linenumber">169</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/bisq-transaction-details/bisq-transaction-details.component.html</context>
@@ -580,7 +580,7 @@
<source>data</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">178</context>
<context context-type="linenumber">181</context>
</context-group>
<note priority="1" from="description">transactions-list.vout.scriptpubkey-type.data</note>
</trans-unit>
@@ -588,7 +588,7 @@
<source>sat</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">198</context>
<context context-type="linenumber">201</context>
</context-group>
<note priority="1" from="description">sat</note>
<note priority="1" from="meaning">shared.sat</note>
@@ -597,7 +597,7 @@
<source>Confidential</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/transactions-list/transactions-list.component.html</context>
<context context-type="linenumber">214</context>
<context context-type="linenumber">217</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/amount/amount.component.html</context>
@@ -605,7 +605,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address/address.component.html</context>
<context context-type="linenumber">132</context>
<context context-type="linenumber">134</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/asset/asset.component.html</context>
@@ -841,11 +841,23 @@
</context-group>
<note priority="1" from="description">shared.address</note>
</trans-unit>
<trans-unit id="7e69426bd97a606d8ae6026762858e6e7c86a1fd" datatype="html">
<source>Balance</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address/address.component.html</context>
<context context-type="linenumber">30</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/bisq-address/bisq-address.component.html</context>
<context context-type="linenumber">28</context>
</context-group>
<note priority="1" from="description">address.balance</note>
</trans-unit>
<trans-unit id="a9b87c3aa4731edee661c8287ef3aab71799c0b8" datatype="html">
<source>Total received</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address/address.component.html</context>
<context context-type="linenumber">20</context>
<context context-type="linenumber">21</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/bisq-address/bisq-address.component.html</context>
@@ -857,7 +869,7 @@
<source>Total sent</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address/address.component.html</context>
<context context-type="linenumber">24</context>
<context context-type="linenumber">25</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/bisq-address/bisq-address.component.html</context>
@@ -869,23 +881,11 @@
</context-group>
<note priority="1" from="description">address.total-sent</note>
</trans-unit>
<trans-unit id="7e69426bd97a606d8ae6026762858e6e7c86a1fd" datatype="html">
<source>Balance</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address/address.component.html</context>
<context context-type="linenumber">28</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/bisq-address/bisq-address.component.html</context>
<context context-type="linenumber">28</context>
</context-group>
<note priority="1" from="description">address.balance</note>
</trans-unit>
<trans-unit id="714e34125b3343df73f19ec800b43be95217d5d4" datatype="html">
<source><x id="INTERPOLATION" equiv-text="{{ (transactions?.length | number) || &apos;?&apos; }}"/> of <x id="INTERPOLATION_1" equiv-text="{{ txCount | number }}"/> transaction</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address/address.component.html</context>
<context context-type="linenumber">48</context>
<context context-type="linenumber">50</context>
</context-group>
<note priority="1" from="description">X of X Address Transaction</note>
</trans-unit>
@@ -893,7 +893,7 @@
<source><x id="INTERPOLATION" equiv-text="{{ (transactions?.length | number) || &apos;?&apos; }}"/> of <x id="INTERPOLATION_1" equiv-text="{{ txCount | number }}"/> transactions</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address/address.component.html</context>
<context context-type="linenumber">49</context>
<context context-type="linenumber">51</context>
</context-group>
<note priority="1" from="description">X of X Address Transactions (Plural)</note>
</trans-unit>
@@ -901,7 +901,7 @@
<source>Error loading address data.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address/address.component.html</context>
<context context-type="linenumber">113</context>
<context context-type="linenumber">115</context>
</context-group>
<note priority="1" from="description">address.error.loading-address-data</note>
</trans-unit>
@@ -1020,15 +1020,23 @@
<source>multisig <x id="INTERPOLATION" equiv-text="{{ multisigM }}"/> of <x id="INTERPOLATION_1" equiv-text="{{ multisigN }}"/></source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address-labels/address-labels.component.html</context>
<context context-type="linenumber">1</context>
<context context-type="linenumber">5</context>
</context-group>
<note priority="1" from="description">address-labels.multisig</note>
</trans-unit>
<trans-unit id="aae004b987aaf258dea1829618651427b68283db" datatype="html">
<source>Layer<x id="INTERPOLATION" equiv-text="{{ network === &apos;liquid&apos; ? &apos;3&apos; : &apos;2&apos; }}"/> Peg-out</source>
<trans-unit id="31c09dcc0ab351767631539b208d5f7de4005473" datatype="html">
<source>Lightning <x id="INTERPOLATION" equiv-text="{{ lightning }}"/></source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address-labels/address-labels.component.html</context>
<context context-type="linenumber">2</context>
<context context-type="linenumber">11</context>
</context-group>
<note priority="1" from="description">address-labels.upper-layer-peg-out</note>
</trans-unit>
<trans-unit id="696ade981a05c12e10df38ba6218c76e318813b3" datatype="html">
<source>Liquid <x id="INTERPOLATION" equiv-text="{{ liquid }}"/></source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/address-labels/address-labels.component.html</context>
<context context-type="linenumber">17</context>
</context-group>
<note priority="1" from="description">address-labels.upper-layer-peg-out</note>
</trans-unit>
@@ -1052,7 +1060,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/about/about.component.ts</context>
<context context-type="linenumber">37</context>
<context context-type="linenumber">38</context>
</context-group>
<note priority="1" from="description">master-page.about</note>
</trans-unit>
@@ -1199,7 +1207,7 @@
<source>Terms of Service</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/about/about.component.html</context>
<context context-type="linenumber">206</context>
<context context-type="linenumber">205</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/dashboard/dashboard.component.html</context>
@@ -1268,14 +1276,6 @@
</context-group>
<note priority="1" from="description">about.sponsor.thank-you</note>
</trans-unit>
<trans-unit id="981a90db6601297002689e5fae09d38b9e374b05" datatype="html">
<source>If you specified a Twitter handle, the profile photo should now be visible on this page when you reload.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/about/about.component.html</context>
<context context-type="linenumber">176</context>
</context-group>
<note priority="1" from="description">about.sponsor.sponsor-completed</note>
</trans-unit>
<trans-unit id="ff4b7f4070be9e876c7610d99b9dbd53ff19dceb" datatype="html">
<source>Loading graphs...</source>
<context-group purpose="location">