2019-04-24 03:17:02 +00:00
|
|
|
import { Component } from 'inferno';
|
2020-07-27 15:54:42 +00:00
|
|
|
import { Helmet } from 'inferno-helmet';
|
2020-07-08 05:02:14 +00:00
|
|
|
import { Subscription } from 'rxjs';
|
|
|
|
import { retryWhen, delay, take } from 'rxjs/operators';
|
2019-06-03 01:35:46 +00:00
|
|
|
import { WebSocketService } from '../services';
|
2020-07-08 05:02:14 +00:00
|
|
|
import {
|
|
|
|
GetSiteResponse,
|
2020-07-27 15:54:42 +00:00
|
|
|
Site,
|
2020-07-08 05:02:14 +00:00
|
|
|
WebSocketJsonResponse,
|
|
|
|
UserOperation,
|
|
|
|
} from '../interfaces';
|
2019-08-10 00:14:43 +00:00
|
|
|
import { i18n } from '../i18next';
|
|
|
|
import { T } from 'inferno-i18next';
|
2020-07-08 05:02:14 +00:00
|
|
|
import { repoUrl, wsJsonToRes, toast } from '../utils';
|
2019-04-24 03:17:02 +00:00
|
|
|
|
2020-05-17 20:49:34 +00:00
|
|
|
interface SilverUser {
|
|
|
|
name: string;
|
2020-07-02 02:50:55 +00:00
|
|
|
link?: string;
|
2020-05-17 20:49:34 +00:00
|
|
|
}
|
|
|
|
|
2020-02-03 23:01:14 +00:00
|
|
|
let general = [
|
2020-07-28 22:06:10 +00:00
|
|
|
'mexicanhalloween',
|
2020-07-23 18:40:05 +00:00
|
|
|
'William Moore',
|
2020-07-17 19:27:06 +00:00
|
|
|
'Rachel Schmitz',
|
|
|
|
'comradeda',
|
2020-07-05 20:01:41 +00:00
|
|
|
'ybaumy',
|
2020-07-03 21:56:50 +00:00
|
|
|
'dude in phx',
|
2020-07-02 02:50:55 +00:00
|
|
|
'twilight loki',
|
2020-06-29 13:38:50 +00:00
|
|
|
'Andrew Plaza',
|
|
|
|
'Jonathan Cremin',
|
|
|
|
'Arthur Nieuwland',
|
2020-06-07 01:22:39 +00:00
|
|
|
'Ernest Wiśniewski',
|
|
|
|
'HN',
|
2020-04-27 12:55:31 +00:00
|
|
|
'Forrest Weghorst',
|
2020-02-03 23:01:14 +00:00
|
|
|
'Andre Vallestero',
|
|
|
|
'NotTooHighToHack',
|
|
|
|
];
|
2020-07-26 21:46:27 +00:00
|
|
|
let highlighted = ['DQW', 'DiscountFuneral', 'Oskenso Kashi', 'Alex Benishek'];
|
2020-05-17 20:49:34 +00:00
|
|
|
let silver: Array<SilverUser> = [
|
|
|
|
{
|
|
|
|
name: 'Redjoker',
|
2020-05-22 01:15:39 +00:00
|
|
|
link: 'https://iww.org',
|
2020-05-17 20:49:34 +00:00
|
|
|
},
|
|
|
|
];
|
2019-04-24 03:17:02 +00:00
|
|
|
// let gold = [];
|
|
|
|
// let latinum = [];
|
|
|
|
|
2020-07-27 15:54:42 +00:00
|
|
|
interface SponsorsState {
|
|
|
|
site: Site;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class Sponsors extends Component<any, SponsorsState> {
|
2020-07-08 05:02:14 +00:00
|
|
|
private subscription: Subscription;
|
2020-07-27 15:54:42 +00:00
|
|
|
private emptyState: SponsorsState = {
|
|
|
|
site: undefined,
|
|
|
|
};
|
2019-04-24 03:17:02 +00:00
|
|
|
constructor(props: any, context: any) {
|
|
|
|
super(props, context);
|
2020-07-27 15:54:42 +00:00
|
|
|
this.state = this.emptyState;
|
2020-07-08 05:02:14 +00:00
|
|
|
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();
|
2019-04-24 03:17:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2020-01-19 21:28:29 +00:00
|
|
|
window.scrollTo(0, 0);
|
2019-04-24 03:17:02 +00:00
|
|
|
}
|
|
|
|
|
2020-07-08 05:02:14 +00:00
|
|
|
componentWillUnmount() {
|
|
|
|
this.subscription.unsubscribe();
|
|
|
|
}
|
|
|
|
|
2020-07-27 15:54:42 +00:00
|
|
|
get documentTitle(): string {
|
|
|
|
if (this.state.site) {
|
|
|
|
return `${i18n.t('sponsors')} - ${this.state.site.name}`;
|
|
|
|
} else {
|
|
|
|
return 'Lemmy';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-24 03:17:02 +00:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div class="container text-center">
|
2020-07-27 15:54:42 +00:00
|
|
|
<Helmet title={this.documentTitle} />
|
2019-04-24 03:17:02 +00:00
|
|
|
{this.topMessage()}
|
|
|
|
<hr />
|
|
|
|
{this.sponsors()}
|
|
|
|
<hr />
|
|
|
|
{this.bitcoin()}
|
|
|
|
</div>
|
2019-10-19 00:20:27 +00:00
|
|
|
);
|
2019-04-24 03:17:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
topMessage() {
|
|
|
|
return (
|
|
|
|
<div>
|
2020-02-02 19:37:19 +00:00
|
|
|
<h5>{i18n.t('donate_to_lemmy')}</h5>
|
2019-04-24 03:17:02 +00:00
|
|
|
<p>
|
2019-10-19 00:20:27 +00:00
|
|
|
<T i18nKey="sponsor_message">
|
2020-04-09 20:11:11 +00:00
|
|
|
#<a href={repoUrl}>#</a>
|
2019-10-19 00:20:27 +00:00
|
|
|
</T>
|
2019-04-24 03:17:02 +00:00
|
|
|
</p>
|
2020-02-05 19:14:05 +00:00
|
|
|
<a class="btn btn-secondary" href="https://liberapay.com/Lemmy/">
|
|
|
|
{i18n.t('support_on_liberapay')}
|
|
|
|
</a>
|
|
|
|
<a
|
|
|
|
class="btn btn-secondary ml-2"
|
|
|
|
href="https://www.patreon.com/dessalines"
|
|
|
|
>
|
2020-02-02 19:37:19 +00:00
|
|
|
{i18n.t('support_on_patreon')}
|
2019-10-19 00:20:27 +00:00
|
|
|
</a>
|
2020-04-12 16:54:49 +00:00
|
|
|
<a
|
|
|
|
class="btn btn-secondary ml-2"
|
|
|
|
href="https://opencollective.com/lemmy"
|
|
|
|
>
|
|
|
|
{i18n.t('support_on_open_collective')}
|
|
|
|
</a>
|
2019-04-24 03:17:02 +00:00
|
|
|
</div>
|
2019-10-19 00:20:27 +00:00
|
|
|
);
|
2019-04-24 03:17:02 +00:00
|
|
|
}
|
|
|
|
sponsors() {
|
|
|
|
return (
|
2019-04-26 01:42:21 +00:00
|
|
|
<div class="container">
|
2020-02-02 19:37:19 +00:00
|
|
|
<h5>{i18n.t('sponsors')}</h5>
|
2020-05-17 20:49:34 +00:00
|
|
|
<p>{i18n.t('silver_sponsors')}</p>
|
2020-07-23 18:40:05 +00:00
|
|
|
<div class="row justify-content-md-center card-columns">
|
2020-05-17 20:49:34 +00:00
|
|
|
{silver.map(s => (
|
|
|
|
<div class="card col-12 col-md-2">
|
|
|
|
<div>
|
2020-07-02 02:50:55 +00:00
|
|
|
{s.link ? (
|
|
|
|
<a href={s.link} target="_blank" rel="noopener">
|
|
|
|
💎 {s.name}
|
|
|
|
</a>
|
|
|
|
) : (
|
|
|
|
<div>💎 {s.name}</div>
|
|
|
|
)}
|
2020-05-17 20:49:34 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</div>
|
2020-02-02 19:37:19 +00:00
|
|
|
<p>{i18n.t('general_sponsors')}</p>
|
2020-07-23 18:40:05 +00:00
|
|
|
<div class="row justify-content-md-center card-columns">
|
2020-01-15 15:28:27 +00:00
|
|
|
{highlighted.map(s => (
|
|
|
|
<div class="card bg-primary col-12 col-md-2 font-weight-bold">
|
|
|
|
<div>{s}</div>
|
|
|
|
</div>
|
|
|
|
))}
|
2019-10-19 00:20:27 +00:00
|
|
|
{general.map(s => (
|
2019-04-24 03:17:02 +00:00
|
|
|
<div class="card col-12 col-md-2">
|
|
|
|
<div>{s}</div>
|
|
|
|
</div>
|
2019-10-19 00:20:27 +00:00
|
|
|
))}
|
2019-04-24 03:17:02 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-10-19 00:20:27 +00:00
|
|
|
);
|
2019-04-24 03:17:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bitcoin() {
|
|
|
|
return (
|
|
|
|
<div>
|
2020-02-02 19:37:19 +00:00
|
|
|
<h5>{i18n.t('crypto')}</h5>
|
2019-10-19 00:20:27 +00:00
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table table-hover text-center">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2020-02-02 19:37:19 +00:00
|
|
|
<td>{i18n.t('bitcoin')}</td>
|
2019-10-19 00:20:27 +00:00
|
|
|
<td>
|
|
|
|
<code>1Hefs7miXS5ff5Ck5xvmjKjXf5242KzRtK</code>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-02-02 19:37:19 +00:00
|
|
|
<td>{i18n.t('ethereum')}</td>
|
2019-10-19 00:20:27 +00:00
|
|
|
<td>
|
|
|
|
<code>0x400c96c96acbC6E7B3B43B1dc1BB446540a88A01</code>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-02-02 19:37:19 +00:00
|
|
|
<td>{i18n.t('monero')}</td>
|
2019-10-19 00:20:27 +00:00
|
|
|
<td>
|
|
|
|
<code>
|
|
|
|
41taVyY6e1xApqKyMVDRVxJ76sPkfZhALLTjRvVKpaAh2pBd4wv9RgYj1tSPrx8wc6iE1uWUfjtQdTmTy2FGMeChGVKPQuV
|
|
|
|
</code>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
2019-04-24 03:17:02 +00:00
|
|
|
</div>
|
2019-10-19 00:20:27 +00:00
|
|
|
);
|
2019-04-24 03:17:02 +00:00
|
|
|
}
|
2020-07-08 05:02:14 +00:00
|
|
|
|
|
|
|
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;
|
2020-07-27 15:54:42 +00:00
|
|
|
this.state.site = data.site;
|
|
|
|
this.setState(this.state);
|
2020-07-08 05:02:14 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-24 03:17:02 +00:00
|
|
|
}
|