1 import { Component } from 'inferno';
2 import { Helmet } from 'inferno-helmet';
3 import { Subscription } from 'rxjs';
4 import { retryWhen, delay, take } from 'rxjs/operators';
5 import { WebSocketService } from '../services';
11 } from 'lemmy-js-client';
12 import { i18n } from '../i18next';
13 import { T } from 'inferno-i18next';
14 import { repoUrl, wsJsonToRes, toast } from '../utils';
16 interface SilverUser {
39 let highlighted = ['DQW', 'DiscountFuneral', 'Oskenso Kashi', 'Alex Benishek'];
40 let silver: SilverUser[] = [
43 link: 'https://iww.org',
49 interface SponsorsState {
53 export class Sponsors extends Component<any, SponsorsState> {
54 private subscription: Subscription;
55 private emptyState: SponsorsState = {
58 constructor(props: any, context: any) {
59 super(props, context);
60 this.state = this.emptyState;
61 this.subscription = WebSocketService.Instance.subject
62 .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
64 msg => this.parseMessage(msg),
65 err => console.error(err),
66 () => console.log('complete')
69 WebSocketService.Instance.getSite();
73 window.scrollTo(0, 0);
76 componentWillUnmount() {
77 this.subscription.unsubscribe();
80 get documentTitle(): string {
81 if (this.state.site) {
82 return `${i18n.t('sponsors')} - ${this.state.site.name}`;
90 <div class="container text-center">
91 <Helmet title={this.documentTitle} />
104 <h5>{i18n.t('donate_to_lemmy')}</h5>
106 <T i18nKey="sponsor_message">
107 #<a href={repoUrl}>#</a>
110 <a class="btn btn-secondary" href="https://liberapay.com/Lemmy/">
111 {i18n.t('support_on_liberapay')}
114 class="btn btn-secondary ml-2"
115 href="https://www.patreon.com/dessalines"
117 {i18n.t('support_on_patreon')}
120 class="btn btn-secondary ml-2"
121 href="https://opencollective.com/lemmy"
123 {i18n.t('support_on_open_collective')}
130 <div class="container">
131 <h5>{i18n.t('sponsors')}</h5>
132 <p>{i18n.t('silver_sponsors')}</p>
133 <div class="row justify-content-md-center card-columns">
135 <div class="card col-12 col-md-2">
138 <a href={s.link} target="_blank" rel="noopener">
142 <div>💎 {s.name}</div>
148 <p>{i18n.t('general_sponsors')}</p>
149 <div class="row justify-content-md-center card-columns">
150 {highlighted.map(s => (
151 <div class="card bg-primary col-12 col-md-2 font-weight-bold">
156 <div class="card col-12 col-md-2">
168 <h5>{i18n.t('crypto')}</h5>
169 <div class="table-responsive">
170 <table class="table table-hover text-center">
173 <td>{i18n.t('bitcoin')}</td>
175 <code>1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK</code>
179 <td>{i18n.t('ethereum')}</td>
181 <code>0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01</code>
185 <td>{i18n.t('monero')}</td>
188 41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV
199 parseMessage(msg: WebSocketJsonResponse) {
201 let res = wsJsonToRes(msg);
203 toast(i18n.t(msg.error), 'danger');
205 } else if (res.op == UserOperation.GetSite) {
206 let data = res.data as GetSiteResponse;
207 this.state.site = data.site;
208 this.setState(this.state);