import { Component, linkEvent } from 'inferno';
+import { Helmet } from 'inferno-helmet';
import { Subscription } from 'rxjs';
import { retryWhen, delay, take } from 'rxjs/operators';
import {
Comment,
MarkCommentAsReadForm,
CommentResponse,
- CommentSortType,
- CommentViewType,
CommunityUser,
CommunityResponse,
CommentNode as CommentNodeI,
GetSiteResponse,
GetCommunityResponse,
WebSocketJsonResponse,
-} from '../interfaces';
+} from 'lemmy-js-client';
+import { CommentSortType, CommentViewType } from '../interfaces';
import { WebSocketService, UserService } from '../services';
import {
wsJsonToRes,
createPostLikeRes,
commentsToFlatNodes,
setupTippy,
+ favIconUrl,
} from '../utils';
import { PostListing } from './post-listing';
import { Sidebar } from './sidebar';
enable_downvotes: undefined,
open_registration: undefined,
enable_nsfw: undefined,
+ icon: undefined,
+ banner: undefined,
},
online: null,
version: null,
+ federated_instances: undefined,
},
};
auth: null,
};
WebSocketService.Instance.markCommentAsRead(form);
- UserService.Instance.user.unreadCount--;
- UserService.Instance.sub.next({
- user: UserService.Instance.user,
- });
+ UserService.Instance.unreadCountSub.next(
+ UserService.Instance.unreadCountSub.value - 1
+ );
}
}
+ get documentTitle(): string {
+ if (this.state.post) {
+ return `${this.state.post.name} - ${this.state.siteRes.site.name}`;
+ } else {
+ return 'Lemmy';
+ }
+ }
+
+ get favIcon(): string {
+ return this.state.siteRes.site.icon
+ ? this.state.siteRes.site.icon
+ : favIconUrl;
+ }
+
render() {
return (
<div class="container">
+ <Helmet title={this.documentTitle}>
+ <link
+ id="favicon"
+ rel="icon"
+ type="image/x-icon"
+ href={this.favIcon}
+ />
+ </Helmet>
{this.state.loading ? (
<h5>
<svg class="icon icon-spinner spin">
sortRadios() {
return (
<>
- <div class="btn-group btn-group-toggle mr-3 mb-2">
+ <div class="btn-group btn-group-toggle flex-wrap mr-3 mb-2">
<label
- className={`btn btn-sm btn-secondary pointer ${
+ className={`btn btn-outline-secondary pointer ${
this.state.commentSort === CommentSortType.Hot && 'active'
}`}
>
/>
</label>
<label
- className={`btn btn-sm btn-secondary pointer ${
+ className={`btn btn-outline-secondary pointer ${
this.state.commentSort === CommentSortType.Top && 'active'
}`}
>
/>
</label>
<label
- className={`btn btn-sm btn-secondary pointer ${
+ className={`btn btn-outline-secondary pointer ${
this.state.commentSort === CommentSortType.New && 'active'
}`}
>
/>
</label>
<label
- className={`btn btn-sm btn-secondary pointer ${
+ className={`btn btn-outline-secondary pointer ${
this.state.commentSort === CommentSortType.Old && 'active'
}`}
>
/>
</label>
</div>
- <div class="btn-group btn-group-toggle mb-2">
+ <div class="btn-group btn-group-toggle flex-wrap mb-2">
<label
- className={`btn btn-sm btn-secondary pointer ${
+ className={`btn btn-outline-secondary pointer ${
this.state.commentViewType === CommentViewType.Chat && 'active'
}`}
>
admins={this.state.siteRes.admins}
online={this.state.online}
enableNsfw={this.state.siteRes.site.enable_nsfw}
+ showIcon
/>
</div>
);
this.state.moderators = data.moderators;
this.state.online = data.online;
this.state.loading = false;
- document.title = `${this.state.post.name} - ${this.state.siteRes.site.name}`;
// Get cross-posts
if (this.state.post.url) {
let form: SearchForm = {
q: this.state.post.url,
- type_: SearchType[SearchType.Url],
- sort: SortType[SortType.TopAll],
+ type_: SearchType.Url,
+ sort: SortType.TopAll,
page: 1,
limit: 6,
};