1 import { Component } from 'inferno';
2 import { Subscription } from 'rxjs';
3 import { retryWhen, delay, take } from 'rxjs/operators';
4 import { WebSocketService } from '../services';
9 } from '../interfaces';
10 import { i18n } from '../i18next';
11 import { T } from 'inferno-i18next';
12 import { repoUrl, wsJsonToRes, toast } from '../utils';
14 interface SilverUser {
35 let highlighted = ['DQW', 'DiscountFuneral', 'Oskenso Kashi', 'Alex Benishek'];
36 let silver: Array<SilverUser> = [
39 link: 'https://iww.org',
45 export class Sponsors extends Component<any, any> {
46 private subscription: Subscription;
47 constructor(props: any, context: any) {
48 super(props, context);
49 this.subscription = WebSocketService.Instance.subject
50 .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
52 msg => this.parseMessage(msg),
53 err => console.error(err),
54 () => console.log('complete')
57 WebSocketService.Instance.getSite();
61 window.scrollTo(0, 0);
64 componentWillUnmount() {
65 this.subscription.unsubscribe();
70 <div class="container text-center">
83 <h5>{i18n.t('donate_to_lemmy')}</h5>
85 <T i18nKey="sponsor_message">
86 #<a href={repoUrl}>#</a>
89 <a class="btn btn-secondary" href="https://liberapay.com/Lemmy/">
90 {i18n.t('support_on_liberapay')}
93 class="btn btn-secondary ml-2"
94 href="https://www.patreon.com/dessalines"
96 {i18n.t('support_on_patreon')}
99 class="btn btn-secondary ml-2"
100 href="https://opencollective.com/lemmy"
102 {i18n.t('support_on_open_collective')}
109 <div class="container">
110 <h5>{i18n.t('sponsors')}</h5>
111 <p>{i18n.t('silver_sponsors')}</p>
112 <div class="row justify-content-md-center card-columns">
114 <div class="card col-12 col-md-2">
117 <a href={s.link} target="_blank" rel="noopener">
121 <div>💎 {s.name}</div>
127 <p>{i18n.t('general_sponsors')}</p>
128 <div class="row justify-content-md-center card-columns">
129 {highlighted.map(s => (
130 <div class="card bg-primary col-12 col-md-2 font-weight-bold">
135 <div class="card col-12 col-md-2">
147 <h5>{i18n.t('crypto')}</h5>
148 <div class="table-responsive">
149 <table class="table table-hover text-center">
152 <td>{i18n.t('bitcoin')}</td>
154 <code>1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK</code>
158 <td>{i18n.t('ethereum')}</td>
160 <code>0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01</code>
164 <td>{i18n.t('monero')}</td>
167 41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV
178 parseMessage(msg: WebSocketJsonResponse) {
180 let res = wsJsonToRes(msg);
182 toast(i18n.t(msg.error), 'danger');
184 } else if (res.op == UserOperation.GetSite) {
185 let data = res.data as GetSiteResponse;
186 document.title = `${i18n.t('sponsors')} - ${data.site.name}`;