mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-25 07:36:01 +00:00
parent
b04d4f03c5
commit
675cf61654
|
@ -216,7 +216,7 @@ export class Main extends Component<any, MainState> {
|
|||
landing() {
|
||||
return (
|
||||
<div>
|
||||
<h5>Welcome to
|
||||
<h5>Powered by
|
||||
<svg class="icon mx-2"><use xlinkHref="#icon-mouse"></use></svg>
|
||||
<a href={repoUrl}>Lemmy<sup>Beta</sup></a>
|
||||
</h5>
|
||||
|
@ -226,7 +226,7 @@ export class Main extends Component<any, MainState> {
|
|||
<p>Suggest new features or report bugs <a href={repoUrl}>here.</a></p>
|
||||
<p>Made with <a href="https://www.rust-lang.org">Rust</a>, <a href="https://actix.rs/">Actix</a>, <a href="https://www.infernojs.org">Inferno</a>, <a href="https://www.typescriptlang.org/">Typescript</a>.</p>
|
||||
</div>
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
posts() {
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Link } from 'inferno-router';
|
|||
import { Subscription } from "rxjs";
|
||||
import { retryWhen, delay, take } from 'rxjs/operators';
|
||||
import { WebSocketService, UserService } from '../services';
|
||||
import { UserOperation, GetRepliesForm, GetRepliesResponse, SortType } from '../interfaces';
|
||||
import { UserOperation, GetRepliesForm, GetRepliesResponse, SortType, GetSiteResponse } from '../interfaces';
|
||||
import { msgOp } from '../utils';
|
||||
import { version } from '../version';
|
||||
|
||||
|
@ -12,6 +12,7 @@ interface NavbarState {
|
|||
expanded: boolean;
|
||||
expandUserDropdown: boolean;
|
||||
unreadCount: number;
|
||||
siteName: string;
|
||||
}
|
||||
|
||||
export class Navbar extends Component<any, NavbarState> {
|
||||
|
@ -21,7 +22,8 @@ export class Navbar extends Component<any, NavbarState> {
|
|||
isLoggedIn: (UserService.Instance.user !== undefined),
|
||||
unreadCount: 0,
|
||||
expanded: false,
|
||||
expandUserDropdown: false
|
||||
expandUserDropdown: false,
|
||||
siteName: undefined
|
||||
}
|
||||
|
||||
constructor(props: any, context: any) {
|
||||
|
@ -45,6 +47,8 @@ export class Navbar extends Component<any, NavbarState> {
|
|||
(err) => console.error(err),
|
||||
() => console.log('complete')
|
||||
);
|
||||
|
||||
WebSocketService.Instance.getSite();
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -59,13 +63,12 @@ export class Navbar extends Component<any, NavbarState> {
|
|||
}
|
||||
|
||||
// TODO class active corresponding to current page
|
||||
// TODO toggle css collapse
|
||||
navbar() {
|
||||
return (
|
||||
<nav class="container navbar navbar-expand-md navbar-light navbar-bg p-0 px-3">
|
||||
<Link title={version} class="navbar-brand" to="/">
|
||||
<svg class="icon mr-2 mouse-icon"><use xlinkHref="#icon-mouse"></use></svg>
|
||||
Lemmy
|
||||
{this.state.siteName}
|
||||
</Link>
|
||||
<button class="navbar-toggler" type="button" onClick={linkEvent(this, this.expandNavbar)}>
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
|
@ -145,6 +148,14 @@ export class Navbar extends Component<any, NavbarState> {
|
|||
} else if (op == UserOperation.GetReplies) {
|
||||
let res: GetRepliesResponse = msg;
|
||||
this.sendRepliesCount(res);
|
||||
} else if (op == UserOperation.GetSite) {
|
||||
let res: GetSiteResponse = msg;
|
||||
|
||||
if (res.site) {
|
||||
this.state.siteName = res.site.name;
|
||||
WebSocketService.Instance.site = res.site;
|
||||
this.setState(this.state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue