-import { Component, linkEvent } from 'inferno';
-import { Link } from 'inferno-router';
-import { Subscription } from 'rxjs';
+import { Component, linkEvent } from "inferno";
+import { Link } from "inferno-router";
+import { Subscription } from "rxjs";
import {
UserOperation,
CommunityFollowerView,
CommentResponse,
AddAdminResponse,
BanUserResponse,
-} from 'lemmy-js-client';
-import { DataType, InitialFetchRequest } from '../interfaces';
-import { WebSocketService, UserService } from '../services';
-import { PostListings } from './post-listings';
-import { CommentNodes } from './comment-nodes';
-import { SortSelect } from './sort-select';
-import { ListingTypeSelect } from './listing-type-select';
-import { DataTypeSelect } from './data-type-select';
-import { SiteForm } from './site-form';
-import { UserListing } from './user-listing';
-import { CommunityLink } from './community-link';
-import { BannerIconHeader } from './banner-icon-header';
-import { Icon, Spinner } from './icon';
+} from "lemmy-js-client";
+import { DataType, InitialFetchRequest } from "../interfaces";
+import { WebSocketService, UserService } from "../services";
+import { PostListings } from "./post-listings";
+import { CommentNodes } from "./comment-nodes";
+import { SortSelect } from "./sort-select";
+import { ListingTypeSelect } from "./listing-type-select";
+import { DataTypeSelect } from "./data-type-select";
+import { SiteForm } from "./site-form";
+import { UserListing } from "./user-listing";
+import { CommunityLink } from "./community-link";
+import { BannerIconHeader } from "./banner-icon-header";
+import { Icon, Spinner } from "./icon";
import {
wsJsonToRes,
mdToHtml,
authField,
saveScrollPosition,
restoreScrollPosition,
-} from '../utils';
-import { i18n } from '../i18next';
-import { T } from 'inferno-i18next';
-import { HtmlTags } from './html-tags';
+} from "../utils";
+import { i18n } from "../i18next";
+import { T } from "inferno-i18next";
+import { HtmlTags } from "./html-tags";
interface MainState {
subscribedCommunities: CommunityFollowerView[];
componentDidMount() {
// This means it hasn't been set up yet
if (!this.state.siteRes.site_view) {
- this.context.router.history.push('/setup');
+ this.context.router.history.push("/setup");
}
WebSocketService.Instance.send(wsClient.communityJoin({ community_id: 0 }));
}
static fetchInitialData(req: InitialFetchRequest): Promise<any>[] {
- let pathSplit = req.path.split('/');
+ let pathSplit = req.path.split("/");
let dataType: DataType = pathSplit[3]
? DataType[pathSplit[3]]
: DataType.Post;
return `${
this.state.siteRes.site_view
? this.state.siteRes.site_view.site.name
- : 'Lemmy'
+ : "Lemmy"
}`;
}
createCommunityButton() {
return (
<Link className="btn btn-secondary btn-block" to="/create_community">
- {i18n.t('create_a_community')}
+ {i18n.t("create_a_community")}
</Link>
);
}
admins() {
return (
<ul class="mt-1 list-inline small mb-0">
- <li class="list-inline-item">{i18n.t('admins')}:</li>
+ <li class="list-inline-item">{i18n.t("admins")}:</li>
{this.state.siteRes.admins.map(av => (
<li class="list-inline-item">
<UserListing user={av.user} />
return (
<ul class="my-2 list-inline">
<li className="list-inline-item badge badge-secondary">
- {i18n.t('number_online', { count: this.state.siteRes.online })}
+ {i18n.t("number_online", { count: this.state.siteRes.online })}
</li>
<li
className="list-inline-item badge badge-secondary pointer"
- data-tippy-content={`${i18n.t('number_of_users', {
+ data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_day,
- })} ${i18n.t('active_in_the_last')} ${i18n.t('day')}`}
+ })} ${i18n.t("active_in_the_last")} ${i18n.t("day")}`}
>
- {i18n.t('number_of_users', {
+ {i18n.t("number_of_users", {
count: counts.users_active_day,
- })}{' '}
- / {i18n.t('day')}
+ })}{" "}
+ / {i18n.t("day")}
</li>
<li
className="list-inline-item badge badge-secondary pointer"
- data-tippy-content={`${i18n.t('number_of_users', {
+ data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_week,
- })} ${i18n.t('active_in_the_last')} ${i18n.t('week')}`}
+ })} ${i18n.t("active_in_the_last")} ${i18n.t("week")}`}
>
- {i18n.t('number_of_users', {
+ {i18n.t("number_of_users", {
count: counts.users_active_week,
- })}{' '}
- / {i18n.t('week')}
+ })}{" "}
+ / {i18n.t("week")}
</li>
<li
className="list-inline-item badge badge-secondary pointer"
- data-tippy-content={`${i18n.t('number_of_users', {
+ data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_month,
- })} ${i18n.t('active_in_the_last')} ${i18n.t('month')}`}
+ })} ${i18n.t("active_in_the_last")} ${i18n.t("month")}`}
>
- {i18n.t('number_of_users', {
+ {i18n.t("number_of_users", {
count: counts.users_active_month,
- })}{' '}
- / {i18n.t('month')}
+ })}{" "}
+ / {i18n.t("month")}
</li>
<li
className="list-inline-item badge badge-secondary pointer"
- data-tippy-content={`${i18n.t('number_of_users', {
+ data-tippy-content={`${i18n.t("number_of_users", {
count: counts.users_active_half_year,
- })} ${i18n.t('active_in_the_last')} ${i18n.t('number_of_months', {
+ })} ${i18n.t("active_in_the_last")} ${i18n.t("number_of_months", {
count: 6,
})}`}
>
- {i18n.t('number_of_users', {
+ {i18n.t("number_of_users", {
count: counts.users_active_half_year,
- })}{' '}
- / {i18n.t('number_of_months', { count: 6 })}
+ })}{" "}
+ / {i18n.t("number_of_months", { count: 6 })}
</li>
<li className="list-inline-item badge badge-secondary">
- {i18n.t('number_of_subscribers', {
+ {i18n.t("number_of_subscribers", {
count: counts.users,
})}
</li>
<li className="list-inline-item badge badge-secondary">
- {i18n.t('number_of_communities', {
+ {i18n.t("number_of_communities", {
count: counts.communities,
})}
</li>
<li className="list-inline-item badge badge-secondary">
- {i18n.t('number_of_posts', {
+ {i18n.t("number_of_posts", {
count: counts.posts,
})}
</li>
<li className="list-inline-item badge badge-secondary">
- {i18n.t('number_of_comments', {
+ {i18n.t("number_of_comments", {
count: counts.comments,
})}
</li>
<li className="list-inline-item">
<Link className="badge badge-secondary" to="/modlog">
- {i18n.t('modlog')}
+ {i18n.t("modlog")}
</Link>
</li>
</ul>
class="pointer"
role="button"
onClick={linkEvent(this, this.handleEditClick)}
- aria-label={i18n.t('edit')}
- data-tippy-content={i18n.t('edit')}
+ aria-label={i18n.t("edit")}
+ data-tippy-content={i18n.t("edit")}
>
<Icon icon="edit" classes="icon-inline" />
</span>
class="btn btn-secondary mr-1"
onClick={linkEvent(this, this.prevPage)}
>
- {i18n.t('prev')}
+ {i18n.t("prev")}
</button>
)}
{this.state.posts.length > 0 && (
class="btn btn-secondary"
onClick={linkEvent(this, this.nextPage)}
>
- {i18n.t('next')}
+ {i18n.t("next")}
</button>
)}
</div>
parseMessage(msg: any) {
let op = wsUserOp(msg);
if (msg.error) {
- toast(i18n.t(msg.error), 'danger');
+ toast(i18n.t(msg.error), "danger");
return;
} else if (msg.reconnect) {
WebSocketService.Instance.send(
this.state.siteRes.site_view = data.site_view;
this.state.showEditSite = false;
this.setState(this.state);
- toast(i18n.t('site_saved'));
+ toast(i18n.t("site_saved"));
} else if (op == UserOperation.GetPosts) {
let data = wsJsonToRes<GetPostsResponse>(msg).data;
this.state.posts = data.posts;