import { Component } from 'inferno'; import { Subscription } from 'rxjs'; import { retryWhen, delay, take } from 'rxjs/operators'; import { WebSocketService } from '../services'; import { GetSiteResponse, WebSocketJsonResponse, UserOperation, } from '../interfaces'; import { i18n } from '../i18next'; import { T } from 'inferno-i18next'; import { repoUrl, wsJsonToRes, toast } from '../utils'; interface SilverUser { name: string; link?: string; } let general = [ 'William Moore', 'Rachel Schmitz', 'comradeda', 'ybaumy', 'dude in phx', 'twilight loki', 'Andrew Plaza', 'Jonathan Cremin', 'Arthur Nieuwland', 'Ernest Wiśniewski', 'HN', 'Forrest Weghorst', 'Andre Vallestero', 'NotTooHighToHack', ]; let highlighted = ['DiscountFuneral', 'Oskenso Kashi', 'Alex Benishek']; let silver: Array = [ { name: 'Redjoker', link: 'https://iww.org', }, ]; // let gold = []; // let latinum = []; export class Sponsors extends Component { private subscription: Subscription; constructor(props: any, context: any) { super(props, context); this.subscription = WebSocketService.Instance.subject .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10)))) .subscribe( msg => this.parseMessage(msg), err => console.error(err), () => console.log('complete') ); WebSocketService.Instance.getSite(); } componentDidMount() { window.scrollTo(0, 0); } componentWillUnmount() { this.subscription.unsubscribe(); } render() { return (
{this.topMessage()}
{this.sponsors()}
{this.bitcoin()}
); } topMessage() { return (
{i18n.t('donate_to_lemmy')}

##

{i18n.t('support_on_liberapay')} {i18n.t('support_on_patreon')} {i18n.t('support_on_open_collective')}
); } sponsors() { return (
{i18n.t('sponsors')}

{i18n.t('silver_sponsors')}

{silver.map(s => (
{s.link ? ( 💎 {s.name} ) : (
💎 {s.name}
)}
))}

{i18n.t('general_sponsors')}

{highlighted.map(s => (
{s}
))} {general.map(s => (
{s}
))}
); } bitcoin() { return (
{i18n.t('crypto')}
{i18n.t('bitcoin')} 1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK
{i18n.t('ethereum')} 0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01
{i18n.t('monero')} 41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV
); } parseMessage(msg: WebSocketJsonResponse) { console.log(msg); let res = wsJsonToRes(msg); if (msg.error) { toast(i18n.t(msg.error), 'danger'); return; } else if (res.op == UserOperation.GetSite) { let data = res.data as GetSiteResponse; document.title = `${i18n.t('sponsors')} - ${data.site.name}`; } } }