mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 16:24:20 +00:00
parent
8ebed4e945
commit
894a2e4586
|
@ -46,7 +46,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
||||||
<div className="details ml-4">
|
<div className="details ml-4">
|
||||||
<ul class="list-inline mb-0 text-muted small">
|
<ul class="list-inline mb-0 text-muted small">
|
||||||
<li className="list-inline-item">
|
<li className="list-inline-item">
|
||||||
<Link to={`/user/${node.comment.creator_id}`}>{node.comment.creator_name}</Link>
|
<Link className="text-info" to={`/user/${node.comment.creator_id}`}>{node.comment.creator_name}</Link>
|
||||||
</li>
|
</li>
|
||||||
<li className="list-inline-item">
|
<li className="list-inline-item">
|
||||||
<span>(
|
<span>(
|
||||||
|
|
|
@ -63,7 +63,7 @@ export class Community extends Component<any, State> {
|
||||||
<h4><svg class="icon icon-spinner spin"><use xlinkHref="#icon-spinner"></use></svg></h4> :
|
<h4><svg class="icon icon-spinner spin"><use xlinkHref="#icon-spinner"></use></svg></h4> :
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-lg-9">
|
<div class="col-12 col-lg-9">
|
||||||
<h4>/f/{this.state.community.name}</h4>
|
<h4>{this.state.community.title}</h4>
|
||||||
<PostListings communityId={this.state.communityId} />
|
<PostListings communityId={this.state.communityId} />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-lg-3">
|
<div class="col-12 col-lg-3">
|
||||||
|
|
|
@ -46,10 +46,10 @@ export class Main extends Component<any, State> {
|
||||||
return (
|
return (
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-lg-9">
|
<div class="col-12 col-md-9">
|
||||||
<PostListings />
|
<PostListings />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-lg-3">
|
<div class="col-12 col-md-3">
|
||||||
<h4>A Landing message</h4>
|
<h4>A Landing message</h4>
|
||||||
{UserService.Instance.loggedIn &&
|
{UserService.Instance.loggedIn &&
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -3,11 +3,24 @@ import { Link } from 'inferno-router';
|
||||||
import { repoUrl } from '../utils';
|
import { repoUrl } from '../utils';
|
||||||
import { UserService } from '../services';
|
import { UserService } from '../services';
|
||||||
|
|
||||||
export class Navbar extends Component<any, any> {
|
interface NavbarState {
|
||||||
|
isLoggedIn: boolean;
|
||||||
|
expanded: boolean;
|
||||||
|
expandUserDropdown: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Navbar extends Component<any, NavbarState> {
|
||||||
|
|
||||||
|
emptyState: NavbarState = {
|
||||||
|
isLoggedIn: UserService.Instance.loggedIn,
|
||||||
|
expanded: false,
|
||||||
|
expandUserDropdown: false
|
||||||
|
}
|
||||||
|
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this.state = {isLoggedIn: UserService.Instance.loggedIn, expanded: false};
|
this.state = this.emptyState;
|
||||||
|
this.handleOverviewClick = this.handleOverviewClick.bind(this);
|
||||||
|
|
||||||
// Subscribe to user changes
|
// Subscribe to user changes
|
||||||
UserService.Instance.sub.subscribe(user => {
|
UserService.Instance.sub.subscribe(user => {
|
||||||
|
@ -50,24 +63,44 @@ export class Navbar extends Component<any, any> {
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="navbar-nav ml-auto mr-2">
|
<ul class="navbar-nav ml-auto mr-2">
|
||||||
<li class="nav-item">
|
|
||||||
{this.state.isLoggedIn ?
|
{this.state.isLoggedIn ?
|
||||||
<a role="button" class="nav-link pointer" onClick={ linkEvent(this, this.handleLogoutClick) }>Logout</a> :
|
<li className={`nav-item dropdown ${this.state.expandUserDropdown && 'show'}`}>
|
||||||
|
<a class="pointer nav-link dropdown-toggle" onClick={linkEvent(this, this.expandUserDropdown)} role="button">
|
||||||
|
{UserService.Instance.user.username}
|
||||||
|
</a>
|
||||||
|
<div className={`dropdown-menu dropdown-menu-right ${this.state.expandUserDropdown && 'show'}`}>
|
||||||
|
<a role="button" class="dropdown-item pointer" onClick={linkEvent(this, this.handleOverviewClick)}>Overview</a>
|
||||||
|
<a role="button" class="dropdown-item pointer" onClick={ linkEvent(this, this.handleLogoutClick) }>Logout</a>
|
||||||
|
</div>
|
||||||
|
</li> :
|
||||||
<Link class="nav-link" to="/login">Login</Link>
|
<Link class="nav-link" to="/login">Login</Link>
|
||||||
}
|
}
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleLogoutClick() {
|
expandUserDropdown(i: Navbar) {
|
||||||
|
i.state.expandUserDropdown = !i.state.expandUserDropdown;
|
||||||
|
i.setState(i.state);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleLogoutClick(i: Navbar) {
|
||||||
|
i.state.expandUserDropdown = false;
|
||||||
UserService.Instance.logout();
|
UserService.Instance.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleOverviewClick(i: Navbar) {
|
||||||
|
i.state.expandUserDropdown = false;
|
||||||
|
i.setState(i.state);
|
||||||
|
let userPage = `/user/${UserService.Instance.user.id}`;
|
||||||
|
i.context.router.history.push(userPage);
|
||||||
|
}
|
||||||
|
|
||||||
expandNavbar(i: Navbar) {
|
expandNavbar(i: Navbar) {
|
||||||
i.state.expanded = !i.state.expanded;
|
i.state.expanded = !i.state.expanded;
|
||||||
i.setState(i.state);
|
i.setState(i.state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
<ul class="list-inline mb-0 text-muted small">
|
<ul class="list-inline mb-0 text-muted small">
|
||||||
<li className="list-inline-item">
|
<li className="list-inline-item">
|
||||||
<span>by </span>
|
<span>by </span>
|
||||||
<Link to={`/user/${post.creator_id}`}>{post.creator_name}</Link>
|
<Link className="text-info" to={`/user/${post.creator_id}`}>{post.creator_name}</Link>
|
||||||
{this.props.showCommunity &&
|
{this.props.showCommunity &&
|
||||||
<span>
|
<span>
|
||||||
<span> to </span>
|
<span> to </span>
|
||||||
|
@ -99,7 +99,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li className="list-inline-item">
|
<li className="list-inline-item">
|
||||||
<Link to={`/post/${post.id}`}>{post.number_of_comments} Comments</Link>
|
<Link className="text-muted" to={`/post/${post.id}`}>{post.number_of_comments} Comments</Link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{this.myPost &&
|
{this.myPost &&
|
||||||
|
|
|
@ -42,7 +42,8 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
||||||
let community = this.props.community;
|
let community = this.props.community;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h4>{community.title}</h4>
|
<h4 className="mb-0">{community.title}</h4>
|
||||||
|
<Link className="text-muted" to={`/community/${community.id}`}>/f/{community.name}</Link>
|
||||||
{this.amMod &&
|
{this.amMod &&
|
||||||
<ul class="list-inline mb-1 text-muted small font-weight-bold">
|
<ul class="list-inline mb-1 text-muted small font-weight-bold">
|
||||||
<li className="list-inline-item">
|
<li className="list-inline-item">
|
||||||
|
|
|
@ -77,7 +77,7 @@ export class User extends Component<any, UserState> {
|
||||||
return (
|
return (
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-lg-9">
|
<div class="col-12 col-md-9">
|
||||||
<h4>/u/{this.state.user.name}</h4>
|
<h4>/u/{this.state.user.name}</h4>
|
||||||
{this.selects()}
|
{this.selects()}
|
||||||
{this.state.view == View.Overview &&
|
{this.state.view == View.Overview &&
|
||||||
|
@ -90,7 +90,7 @@ export class User extends Component<any, UserState> {
|
||||||
this.posts()
|
this.posts()
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-lg-3">
|
<div class="col-12 col-md-3">
|
||||||
{this.userInfo()}
|
{this.userInfo()}
|
||||||
{this.moderates()}
|
{this.moderates()}
|
||||||
{this.follows()}
|
{this.follows()}
|
||||||
|
|
Loading…
Reference in a new issue