forked from nutomic/lemmy
parent
37f2a1651e
commit
939000fc05
2 changed files with 17 additions and 6 deletions
|
@ -216,7 +216,7 @@ export class Main extends Component<any, MainState> {
|
||||||
landing() {
|
landing() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h5>Welcome to
|
<h5>Powered by
|
||||||
<svg class="icon mx-2"><use xlinkHref="#icon-mouse"></use></svg>
|
<svg class="icon mx-2"><use xlinkHref="#icon-mouse"></use></svg>
|
||||||
<a href={repoUrl}>Lemmy<sup>Beta</sup></a>
|
<a href={repoUrl}>Lemmy<sup>Beta</sup></a>
|
||||||
</h5>
|
</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>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>
|
<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>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
posts() {
|
posts() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { Link } from 'inferno-router';
|
||||||
import { Subscription } from "rxjs";
|
import { Subscription } from "rxjs";
|
||||||
import { retryWhen, delay, take } from 'rxjs/operators';
|
import { retryWhen, delay, take } from 'rxjs/operators';
|
||||||
import { WebSocketService, UserService } from '../services';
|
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 { msgOp } from '../utils';
|
||||||
import { version } from '../version';
|
import { version } from '../version';
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ interface NavbarState {
|
||||||
expanded: boolean;
|
expanded: boolean;
|
||||||
expandUserDropdown: boolean;
|
expandUserDropdown: boolean;
|
||||||
unreadCount: number;
|
unreadCount: number;
|
||||||
|
siteName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Navbar extends Component<any, NavbarState> {
|
export class Navbar extends Component<any, NavbarState> {
|
||||||
|
@ -21,7 +22,8 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
isLoggedIn: (UserService.Instance.user !== undefined),
|
isLoggedIn: (UserService.Instance.user !== undefined),
|
||||||
unreadCount: 0,
|
unreadCount: 0,
|
||||||
expanded: false,
|
expanded: false,
|
||||||
expandUserDropdown: false
|
expandUserDropdown: false,
|
||||||
|
siteName: undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
|
@ -45,6 +47,8 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
(err) => console.error(err),
|
(err) => console.error(err),
|
||||||
() => console.log('complete')
|
() => console.log('complete')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
WebSocketService.Instance.getSite();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -59,13 +63,12 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO class active corresponding to current page
|
// TODO class active corresponding to current page
|
||||||
// TODO toggle css collapse
|
|
||||||
navbar() {
|
navbar() {
|
||||||
return (
|
return (
|
||||||
<nav class="container navbar navbar-expand-md navbar-light navbar-bg p-0 px-3">
|
<nav class="container navbar navbar-expand-md navbar-light navbar-bg p-0 px-3">
|
||||||
<Link title={version} class="navbar-brand" to="/">
|
<Link title={version} class="navbar-brand" to="/">
|
||||||
<svg class="icon mr-2 mouse-icon"><use xlinkHref="#icon-mouse"></use></svg>
|
<svg class="icon mr-2 mouse-icon"><use xlinkHref="#icon-mouse"></use></svg>
|
||||||
Lemmy
|
{this.state.siteName}
|
||||||
</Link>
|
</Link>
|
||||||
<button class="navbar-toggler" type="button" onClick={linkEvent(this, this.expandNavbar)}>
|
<button class="navbar-toggler" type="button" onClick={linkEvent(this, this.expandNavbar)}>
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
@ -145,6 +148,14 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
} else if (op == UserOperation.GetReplies) {
|
} else if (op == UserOperation.GetReplies) {
|
||||||
let res: GetRepliesResponse = msg;
|
let res: GetRepliesResponse = msg;
|
||||||
this.sendRepliesCount(res);
|
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