Addig fronend flag (SPONSORS_ENABLED) to enable Sponsors in the gui.

refs #122
This commit is contained in:
softsimon 2020-10-07 23:30:45 +07:00
parent b6738dd9e8
commit 5b8dbfca74
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
4 changed files with 46 additions and 37 deletions

View File

@ -4,5 +4,6 @@
"BISQ_ENABLED": false, "BISQ_ENABLED": false,
"BISQ_SEPARATE_BACKEND": false, "BISQ_SEPARATE_BACKEND": false,
"ELCTRS_ITEMS_PER_PAGE": 25, "ELCTRS_ITEMS_PER_PAGE": 25,
"KEEP_BLOCKS_AMOUNT": 8 "KEEP_BLOCKS_AMOUNT": 8,
"SPONSORS_ENABLED": false
} }

View File

@ -39,6 +39,7 @@ interface Env {
LIQUID_ENABLED: boolean; LIQUID_ENABLED: boolean;
BISQ_ENABLED: boolean; BISQ_ENABLED: boolean;
BISQ_SEPARATE_BACKEND: boolean; BISQ_SEPARATE_BACKEND: boolean;
SPONSORS_ENABLED: boolean;
ELCTRS_ITEMS_PER_PAGE: number; ELCTRS_ITEMS_PER_PAGE: number;
KEEP_BLOCKS_AMOUNT: number; KEEP_BLOCKS_AMOUNT: number;
} }
@ -48,6 +49,7 @@ const defaultEnv: Env = {
'LIQUID_ENABLED': false, 'LIQUID_ENABLED': false,
'BISQ_ENABLED': false, 'BISQ_ENABLED': false,
'BISQ_SEPARATE_BACKEND': false, 'BISQ_SEPARATE_BACKEND': false,
'SPONSORS_ENABLED': false,
'ELCTRS_ITEMS_PER_PAGE': 25, 'ELCTRS_ITEMS_PER_PAGE': 25,
'KEEP_BLOCKS_AMOUNT': 8 'KEEP_BLOCKS_AMOUNT': 8
}; };

View File

@ -12,49 +12,53 @@
<br><br> <br><br>
<h2>❤️ Sponsors</h2> <ng-template [ngIf]="sponsorsEnabled">
<div *ngFor="let sponsor of sponsors$ | async; let i = index" (click)="openTwitterProfile(sponsor.handle)" class="profile_photo d-inline-block" [class.ml-3]="i > 0" [ngStyle]="{'background-image': 'url(' + sponsor.imageUrl + ')'}" [title]="sponsor.handle"></div> <h2>❤️ Sponsors</h2>
<br><br>
<button type="button" class="btn btn-primary" (click)="donationStatus = 2" [hidden]="donationStatus !== 1">Become a sponsor</button> <div *ngFor="let sponsor of sponsors$ | async; let i = index" (click)="openTwitterProfile(sponsor.handle)" class="profile_photo d-inline-block" [class.ml-3]="i > 0" [ngStyle]="{'background-image': 'url(' + sponsor.imageUrl + ')'}" [title]="sponsor.handle"></div>
<br><br>
<div style="max-width: 300px;" class="mx-auto" [hidden]="donationStatus !== 2"> <button type="button" class="btn btn-primary" (click)="donationStatus = 2" [hidden]="donationStatus !== 1">Become a sponsor</button>
<form [formGroup]="donationForm" (submit)="submitDonation()" class="form">
<div class="input-group mb-2"> <div style="max-width: 300px;" class="mx-auto" [hidden]="donationStatus !== 2">
<div class="input-group-prepend" style="width: 42px;"> <form [formGroup]="donationForm" (submit)="submitDonation()" class="form">
<span class="input-group-text"></span> <div class="input-group mb-2">
<div class="input-group-prepend" style="width: 42px;">
<span class="input-group-text"></span>
</div>
<input formControlName="amount" class="form-control" type="number" min="0.01" step="1E-03">
</div> </div>
<input formControlName="amount" class="form-control" type="number" min="0.01" step="1E-03"> <div class="input-group mb-4">
</div> <div class="input-group-prepend" style="width: 42px;">
<div class="input-group mb-4"> <span class="input-group-text">@</span>
<div class="input-group-prepend" style="width: 42px;"> </div>
<span class="input-group-text">@</span> <input formControlName="handle" class="form-control" type="text" placeholder="Twitter handle (Optional)">
</div> </div>
<input formControlName="handle" class="form-control" type="text" placeholder="Twitter handle (Optional)"> <div class="input-group">
</div> <button class="btn btn-primary mx-auto" type="submit">Request invoice</button>
<div class="input-group"> </div>
<button class="btn btn-primary mx-auto" type="submit">Request invoice</button> </form>
</div>
</form>
</div>
<div *ngIf="donationStatus === 3" class="text-center">
<div class="qr-wrapper mt-4 mb-2">
<app-qrcode [data]="donationObj.address + '?amount=' + donationObj.amount"></app-qrcode>
</div> </div>
<br>
<p style="font-size: 10px;">{{ donationObj.address }}</p>
<p>Waiting for transaction... </p>
<div class="spinner-border text-light"></div>
</div>
<div *ngIf="donationStatus === 4" class="text-center"> <div *ngIf="donationStatus === 3" class="text-center">
<h2>Donation confirmed!<br>Thank you!</h2> <div class="qr-wrapper mt-4 mb-2">
<p>If you specified a Twitter handle, the profile photo should now be visible on this page when you reload.</p> <app-qrcode [data]="donationObj.address + '?amount=' + donationObj.amount"></app-qrcode>
</div> </div>
<br>
<p style="font-size: 10px;">{{ donationObj.address }}</p>
<p>Waiting for transaction... </p>
<div class="spinner-border text-light"></div>
</div>
<br><br> <div *ngIf="donationStatus === 4" class="text-center">
<h2>Donation confirmed!<br>Thank you!</h2>
<p>If you specified a Twitter handle, the profile photo should now be visible on this page when you reload.</p>
</div>
<br><br>
</ng-template>
<h2>Open source</h2> <h2>Open source</h2>

View File

@ -5,6 +5,7 @@ import { StateService } from 'src/app/services/state.service';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { ApiService } from 'src/app/services/api.service'; import { ApiService } from 'src/app/services/api.service';
import { env } from '../../app.constants';
@Component({ @Component({
selector: 'app-about', selector: 'app-about',
@ -17,6 +18,7 @@ export class AboutComponent implements OnInit {
donationStatus = 1; donationStatus = 1;
sponsors$: Observable<any>; sponsors$: Observable<any>;
donationObj: any; donationObj: any;
sponsorsEnabled = env.SPONSORS_ENABLED;
constructor( constructor(
private websocketService: WebsocketService, private websocketService: WebsocketService,