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 '../interfaces';
12 import { i18n } from '../i18next';
13 import { T } from 'inferno-i18next';
14 import { repoUrl, wsJsonToRes, toast } from '../utils';
16 interface SilverUser {
37 let highlighted = ['DQW', 'DiscountFuneral', 'Oskenso Kashi', 'Alex Benishek'];
38 let silver: Array<SilverUser> = [
41 link: 'https://iww.org',
47 interface SponsorsState {
51 export class Sponsors extends Component<any, SponsorsState> {
52 private subscription: Subscription;
53 private emptyState: SponsorsState = {
56 constructor(props: any, context: any) {
57 super(props, context);
58 this.state = this.emptyState;
59 this.subscription = WebSocketService.Instance.subject
60 .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10))))
62 msg => this.parseMessage(msg),
63 err => console.error(err),
64 () => console.log('complete')
67 WebSocketService.Instance.getSite();
71 window.scrollTo(0, 0);
74 componentWillUnmount() {
75 this.subscription.unsubscribe();
78 get documentTitle(): string {
79 if (this.state.site) {
80 return `${i18n.t('sponsors')} - ${this.state.site.name}`;
88 <div class="container text-center">
89 <Helmet title={this.documentTitle} />
102 <h5>{i18n.t('donate_to_lemmy')}</h5>
104 <T i18nKey="sponsor_message">
105 #<a href={repoUrl}>#</a>
108 <a class="btn btn-secondary" href="https://liberapay.com/Lemmy/">
109 {i18n.t('support_on_liberapay')}
112 class="btn btn-secondary ml-2"
113 href="https://www.patreon.com/dessalines"
115 {i18n.t('support_on_patreon')}
118 class="btn btn-secondary ml-2"
119 href="https://opencollective.com/lemmy"
121 {i18n.t('support_on_open_collective')}
128 <div class="container">
129 <h5>{i18n.t('sponsors')}</h5>
130 <p>{i18n.t('silver_sponsors')}</p>
131 <div class="row justify-content-md-center card-columns">
133 <div class="card col-12 col-md-2">
136 <a href={s.link} target="_blank" rel="noopener">
140 <div>💎 {s.name}</div>
146 <p>{i18n.t('general_sponsors')}</p>
147 <div class="row justify-content-md-center card-columns">
148 {highlighted.map(s => (
149 <div class="card bg-primary col-12 col-md-2 font-weight-bold">
154 <div class="card col-12 col-md-2">
166 <h5>{i18n.t('crypto')}</h5>
167 <div class="table-responsive">
168 <table class="table table-hover text-center">
171 <td>{i18n.t('bitcoin')}</td>
173 <code>1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK</code>
177 <td>{i18n.t('ethereum')}</td>
179 <code>0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01</code>
183 <td>{i18n.t('monero')}</td>
186 41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV
197 parseMessage(msg: WebSocketJsonResponse) {
199 let res = wsJsonToRes(msg);
201 toast(i18n.t(msg.error), 'danger');
203 } else if (res.op == UserOperation.GetSite) {
204 let data = res.data as GetSiteResponse;
205 this.state.site = data.site;
206 this.setState(this.state);