Merge pull request #1132 from mempool/simon/translators
Adding translators to About page
This commit is contained in:
commit
80ec15193c
@ -221,6 +221,24 @@ class Server {
|
|||||||
res.status(500).end();
|
res.status(500).end();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.get(config.MEMPOOL.API_URL_PREFIX + 'translators', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const response = await axios.get('https://mempool.space/api/v1/translators', { responseType: 'stream', timeout: 10000 });
|
||||||
|
response.data.pipe(res);
|
||||||
|
} catch (e) {
|
||||||
|
res.status(500).end();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.get(config.MEMPOOL.API_URL_PREFIX + 'translators/images/:id', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const response = await axios.get('https://mempool.space/api/v1/translators/images/' + req.params.id, {
|
||||||
|
responseType: 'stream', timeout: 10000
|
||||||
|
});
|
||||||
|
response.data.pipe(res);
|
||||||
|
} catch (e) {
|
||||||
|
res.status(500).end();
|
||||||
|
}
|
||||||
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED) {
|
if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED) {
|
||||||
|
@ -164,6 +164,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<ng-container *ngIf="translators$ | async | keyvalue as translators else loadingSponsors">
|
||||||
|
<div class="community-sponsor">
|
||||||
|
<h3 i18n="about.translators">Project Translators</h3>
|
||||||
|
<div class="wrapper">
|
||||||
|
<ng-template ngFor let-translator [ngForOf]="translators">
|
||||||
|
<a [href]="'https://twitter.com/' + translator.value" target="_blank" [title]="translator.key">
|
||||||
|
<img class="image" [src]="'/api/v1/translators/images/' + translator.value" />
|
||||||
|
</a>
|
||||||
|
</ng-template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
<ng-container *ngIf="allContributors$ | async as contributors else loadingSponsors">
|
<ng-container *ngIf="allContributors$ | async as contributors else loadingSponsors">
|
||||||
<div class="contributors">
|
<div class="contributors">
|
||||||
<h3 i18n="about.contributors">Project Contributors</h3>
|
<h3 i18n="about.contributors">Project Contributors</h3>
|
||||||
|
@ -7,6 +7,7 @@ import { ApiService } from 'src/app/services/api.service';
|
|||||||
import { IBackendInfo } from 'src/app/interfaces/websocket.interface';
|
import { IBackendInfo } from 'src/app/interfaces/websocket.interface';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
import { ITranslators } from 'src/app/interfaces/node-api.interface';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-about',
|
selector: 'app-about',
|
||||||
@ -17,6 +18,7 @@ import { map } from 'rxjs/operators';
|
|||||||
export class AboutComponent implements OnInit {
|
export class AboutComponent implements OnInit {
|
||||||
backendInfo$: Observable<IBackendInfo>;
|
backendInfo$: Observable<IBackendInfo>;
|
||||||
sponsors$: Observable<any>;
|
sponsors$: Observable<any>;
|
||||||
|
translators$: Observable<ITranslators>;
|
||||||
allContributors$: Observable<any>;
|
allContributors$: Observable<any>;
|
||||||
frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH;
|
frontendGitCommitHash = this.stateService.env.GIT_COMMIT_HASH;
|
||||||
packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
|
packetJsonVersion = this.stateService.env.PACKAGE_JSON_VERSION;
|
||||||
@ -38,6 +40,17 @@ export class AboutComponent implements OnInit {
|
|||||||
this.websocketService.want(['blocks']);
|
this.websocketService.want(['blocks']);
|
||||||
|
|
||||||
this.sponsors$ = this.apiService.getDonation$();
|
this.sponsors$ = this.apiService.getDonation$();
|
||||||
|
this.translators$ = this.apiService.getTranslators$()
|
||||||
|
.pipe(
|
||||||
|
map((translators) => {
|
||||||
|
for (const t in translators) {
|
||||||
|
if (translators[t] === '') {
|
||||||
|
delete translators[t]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return translators;
|
||||||
|
})
|
||||||
|
);
|
||||||
this.allContributors$ = this.apiService.getContributor$().pipe(
|
this.allContributors$ = this.apiService.getContributor$().pipe(
|
||||||
map((contributors) => {
|
map((contributors) => {
|
||||||
return {
|
return {
|
||||||
|
@ -49,3 +49,5 @@ export interface LiquidPegs {
|
|||||||
amount: string;
|
amount: string;
|
||||||
date: string;
|
date: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ITranslators { [language: string]: string; }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { CpfpInfo, OptimizedMempoolStats, DifficultyAdjustment, AddressInformation, LiquidPegs } from '../interfaces/node-api.interface';
|
import { CpfpInfo, OptimizedMempoolStats, DifficultyAdjustment, AddressInformation, LiquidPegs, ITranslators } from '../interfaces/node-api.interface';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { StateService } from './state.service';
|
import { StateService } from './state.service';
|
||||||
import { WebsocketResponse } from '../interfaces/websocket.interface';
|
import { WebsocketResponse } from '../interfaces/websocket.interface';
|
||||||
@ -85,6 +85,10 @@ export class ApiService {
|
|||||||
return this.httpClient.get<any[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/donations');
|
return this.httpClient.get<any[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/donations');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTranslators$(): Observable<ITranslators> {
|
||||||
|
return this.httpClient.get<ITranslators>(this.apiBaseUrl + this.apiBasePath + '/api/v1/translators');
|
||||||
|
}
|
||||||
|
|
||||||
getContributor$(): Observable<any[]> {
|
getContributor$(): Observable<any[]> {
|
||||||
return this.httpClient.get<any[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/contributors');
|
return this.httpClient.get<any[]>(this.apiBaseUrl + this.apiBasePath + '/api/v1/contributors');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user