mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-23 11:21:32 +00:00
Adding cards for sidebars in UI.
This commit is contained in:
parent
ee9d053251
commit
297755e757
7 changed files with 197 additions and 175 deletions
|
@ -6,7 +6,7 @@ import { WebSocketService } from '../services';
|
||||||
import { PostListings } from './post-listings';
|
import { PostListings } from './post-listings';
|
||||||
import { Sidebar } from './sidebar';
|
import { Sidebar } from './sidebar';
|
||||||
import { msgOp, routeSortTypeToEnum, fetchLimit } from '../utils';
|
import { msgOp, routeSortTypeToEnum, fetchLimit } from '../utils';
|
||||||
import { T } from 'inferno-i18next';
|
import { T, i18n } from 'inferno-i18next';
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
community: CommunityI;
|
community: CommunityI;
|
||||||
|
@ -134,7 +134,7 @@ export class Community extends Component<any, State> {
|
||||||
<option disabled><T i18nKey="sort_type">#</T></option>
|
<option disabled><T i18nKey="sort_type">#</T></option>
|
||||||
<option value={SortType.Hot}><T i18nKey="hot">#</T></option>
|
<option value={SortType.Hot}><T i18nKey="hot">#</T></option>
|
||||||
<option value={SortType.New}><T i18nKey="new">#</T></option>
|
<option value={SortType.New}><T i18nKey="new">#</T></option>
|
||||||
<option disabled>──────────</option>
|
<option disabled>──────</option>
|
||||||
<option value={SortType.TopDay}><T i18nKey="top_day">#</T></option>
|
<option value={SortType.TopDay}><T i18nKey="top_day">#</T></option>
|
||||||
<option value={SortType.TopWeek}><T i18nKey="week">#</T></option>
|
<option value={SortType.TopWeek}><T i18nKey="week">#</T></option>
|
||||||
<option value={SortType.TopMonth}><T i18nKey="month">#</T></option>
|
<option value={SortType.TopMonth}><T i18nKey="month">#</T></option>
|
||||||
|
|
|
@ -134,25 +134,30 @@ export class Main extends Component<any, MainState> {
|
||||||
<div>
|
<div>
|
||||||
{!this.state.loading &&
|
{!this.state.loading &&
|
||||||
<div>
|
<div>
|
||||||
{this.trendingCommunities()}
|
<div class="card border-secondary mb-3">
|
||||||
{UserService.Instance.user && this.state.subscribedCommunities.length > 0 &&
|
<div class="card-body">
|
||||||
<div>
|
{this.trendingCommunities()}
|
||||||
<h5>
|
{UserService.Instance.user && this.state.subscribedCommunities.length > 0 &&
|
||||||
<T i18nKey="subscribed_to_communities">#<Link class="text-white" to="/communities">#</Link></T>
|
<div>
|
||||||
</h5>
|
<h5>
|
||||||
<ul class="list-inline">
|
<T i18nKey="subscribed_to_communities">#<Link class="text-white" to="/communities">#</Link></T>
|
||||||
{this.state.subscribedCommunities.map(community =>
|
</h5>
|
||||||
<li class="list-inline-item"><Link to={`/c/${community.community_name}`}>{community.community_name}</Link></li>
|
<ul class="list-inline">
|
||||||
)}
|
{this.state.subscribedCommunities.map(community =>
|
||||||
</ul>
|
<li class="list-inline-item"><Link to={`/c/${community.community_name}`}>{community.community_name}</Link></li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<Link class="btn btn-sm btn-secondary btn-block"
|
||||||
|
to="/create_community">
|
||||||
|
<T i18nKey="create_a_community">#</T>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
<Link class="btn btn-sm btn-secondary btn-block mb-3"
|
|
||||||
to="/create_community">
|
|
||||||
<T i18nKey="create_a_community">#</T>
|
|
||||||
</Link>
|
|
||||||
{this.sidebar()}
|
|
||||||
</div>
|
</div>
|
||||||
|
{this.sidebar()}
|
||||||
|
{this.landing()}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -175,15 +180,16 @@ export class Main extends Component<any, MainState> {
|
||||||
|
|
||||||
sidebar() {
|
sidebar() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div class="card border-secondary mb-3">
|
||||||
{!this.state.showEditSite ?
|
<div class="card-body">
|
||||||
this.siteInfo() :
|
{!this.state.showEditSite ?
|
||||||
<SiteForm
|
this.siteInfo() :
|
||||||
site={this.state.site.site}
|
<SiteForm
|
||||||
onCancel={this.handleEditCancel}
|
site={this.state.site.site}
|
||||||
/>
|
onCancel={this.handleEditCancel}
|
||||||
}
|
/>
|
||||||
{this.landing()}
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -208,17 +214,17 @@ export class Main extends Component<any, MainState> {
|
||||||
</ul>
|
</ul>
|
||||||
}
|
}
|
||||||
<ul class="my-2 list-inline">
|
<ul class="my-2 list-inline">
|
||||||
<li className="list-inline-item badge badge-light">
|
<li className="list-inline-item badge badge-secondary">
|
||||||
<T i18nKey="number_of_users" interpolation={{count: this.state.site.site.number_of_users}}>#</T>
|
<T i18nKey="number_of_users" interpolation={{count: this.state.site.site.number_of_users}}>#</T>
|
||||||
</li>
|
</li>
|
||||||
<li className="list-inline-item badge badge-light">
|
<li className="list-inline-item badge badge-secondary">
|
||||||
<T i18nKey="number_of_posts" interpolation={{count: this.state.site.site.number_of_posts}}>#</T>
|
<T i18nKey="number_of_posts" interpolation={{count: this.state.site.site.number_of_posts}}>#</T>
|
||||||
</li>
|
</li>
|
||||||
<li className="list-inline-item badge badge-light">
|
<li className="list-inline-item badge badge-secondary">
|
||||||
<T i18nKey="number_of_comments" interpolation={{count: this.state.site.site.number_of_comments}}>#</T>
|
<T i18nKey="number_of_comments" interpolation={{count: this.state.site.site.number_of_comments}}>#</T>
|
||||||
</li>
|
</li>
|
||||||
<li className="list-inline-item">
|
<li className="list-inline-item">
|
||||||
<Link className="badge badge-light" to="/modlog">
|
<Link className="badge badge-secondary" to="/modlog">
|
||||||
<T i18nKey="modlog">#</T>
|
<T i18nKey="modlog">#</T>
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
@ -235,7 +241,6 @@ export class Main extends Component<any, MainState> {
|
||||||
<div>
|
<div>
|
||||||
<hr />
|
<hr />
|
||||||
<div className="md-div" dangerouslySetInnerHTML={mdToHtml(this.state.site.site.description)} />
|
<div className="md-div" dangerouslySetInnerHTML={mdToHtml(this.state.site.site.description)} />
|
||||||
<hr />
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -244,17 +249,19 @@ export class Main extends Component<any, MainState> {
|
||||||
|
|
||||||
landing() {
|
landing() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div class="card border-secondary">
|
||||||
<h5>
|
<div class="card-body">
|
||||||
<T i18nKey="powered_by" class="d-inline">#</T>
|
<h5>
|
||||||
<svg class="icon mx-2"><use xlinkHref="#icon-mouse">#</use></svg>
|
<T i18nKey="powered_by" class="d-inline">#</T>
|
||||||
<a href={repoUrl}>Lemmy<sup>beta</sup></a>
|
<svg class="icon mx-2"><use xlinkHref="#icon-mouse">#</use></svg>
|
||||||
</h5>
|
<a href={repoUrl}>Lemmy<sup>beta</sup></a>
|
||||||
<p>
|
</h5>
|
||||||
<T i18nKey="landing_0">#<a href="https://en.wikipedia.org/wiki/Link_aggregation">#</a><a href="https://en.wikipedia.org/wiki/Fediverse">#</a><br></br><code>#</code><br></br><b>#</b><br></br><a href={repoUrl}>#</a><br></br><a href="https://www.rust-lang.org">#</a><a href="https://actix.rs/">#</a><a href="https://www.infernojs.org">#</a><a href="https://www.typescriptlang.org/">#</a>
|
<p>
|
||||||
</T>
|
<T i18nKey="landing_0">#<a href="https://en.wikipedia.org/wiki/Link_aggregation">#</a><a href="https://en.wikipedia.org/wiki/Fediverse">#</a><br></br><code>#</code><br></br><b>#</b><br></br><a href={repoUrl}>#</a><br></br><a href="https://www.rust-lang.org">#</a><a href="https://actix.rs/">#</a><a href="https://www.infernojs.org">#</a><a href="https://www.typescriptlang.org/">#</a>
|
||||||
</p>
|
</T>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +282,7 @@ export class Main extends Component<any, MainState> {
|
||||||
|
|
||||||
selects() {
|
selects() {
|
||||||
return (
|
return (
|
||||||
<div className="mb-2">
|
<div className="mb-3">
|
||||||
<div class="btn-group btn-group-toggle">
|
<div class="btn-group btn-group-toggle">
|
||||||
<label className={`btn btn-sm btn-secondary
|
<label className={`btn btn-sm btn-secondary
|
||||||
${this.state.type_ == ListingType.Subscribed && 'active'}
|
${this.state.type_ == ListingType.Subscribed && 'active'}
|
||||||
|
@ -302,7 +309,7 @@ export class Main extends Component<any, MainState> {
|
||||||
<option disabled><T i18nKey="sort_type">#</T></option>
|
<option disabled><T i18nKey="sort_type">#</T></option>
|
||||||
<option value={SortType.Hot}><T i18nKey="hot">#</T></option>
|
<option value={SortType.Hot}><T i18nKey="hot">#</T></option>
|
||||||
<option value={SortType.New}><T i18nKey="new">#</T></option>
|
<option value={SortType.New}><T i18nKey="new">#</T></option>
|
||||||
<option disabled>──────────</option>
|
<option disabled>─────</option>
|
||||||
<option value={SortType.TopDay}><T i18nKey="top_day">#</T></option>
|
<option value={SortType.TopDay}><T i18nKey="top_day">#</T></option>
|
||||||
<option value={SortType.TopWeek}><T i18nKey="week">#</T></option>
|
<option value={SortType.TopWeek}><T i18nKey="week">#</T></option>
|
||||||
<option value={SortType.TopMonth}><T i18nKey="month">#</T></option>
|
<option value={SortType.TopMonth}><T i18nKey="month">#</T></option>
|
||||||
|
|
|
@ -76,7 +76,7 @@ export class Navbar extends Component<any, NavbarState> {
|
||||||
// TODO class active corresponding to current page
|
// TODO class active corresponding to current page
|
||||||
navbar() {
|
navbar() {
|
||||||
return (
|
return (
|
||||||
<nav class="container navbar navbar-expand-md navbar-light navbar-bg p-0 px-3">
|
<nav class="container-fluid navbar navbar-expand-md navbar-light shadow p-0 px-3">
|
||||||
<Link title={version} class="navbar-brand" to="/">
|
<Link title={version} class="navbar-brand" to="/">
|
||||||
{this.state.siteName}
|
{this.state.siteName}
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -54,85 +54,90 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
|
||||||
let community = this.props.community;
|
let community = this.props.community;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h5 className="mb-0">{community.title}
|
<div class="card border-secondary mb-3">
|
||||||
{community.removed &&
|
<div class="card-body">
|
||||||
<small className="ml-2 text-muted font-italic"><T i18nKey="removed">#</T></small>
|
<h5 className="mb-0">
|
||||||
}
|
<span>{community.title}</span>
|
||||||
{community.deleted &&
|
{community.removed &&
|
||||||
<small className="ml-2 text-muted font-italic"><T i18nKey="deleted">#</T></small>
|
<small className="ml-2 text-muted font-italic"><T i18nKey="removed">#</T></small>
|
||||||
}
|
}
|
||||||
</h5>
|
{community.deleted &&
|
||||||
<Link className="text-muted" to={`/c/${community.name}`}>/c/{community.name}</Link>
|
<small className="ml-2 text-muted font-italic"><T i18nKey="deleted">#</T></small>
|
||||||
<ul class="list-inline mb-1 text-muted small font-weight-bold">
|
}
|
||||||
{this.canMod &&
|
</h5>
|
||||||
<>
|
<Link className="text-muted" to={`/c/${community.name}`}>/c/{community.name}</Link>
|
||||||
<li className="list-inline-item">
|
<ul class="list-inline mb-1 text-muted small font-weight-bold">
|
||||||
<span class="pointer" onClick={linkEvent(this, this.handleEditClick)}><T i18nKey="edit">#</T></span>
|
{this.canMod &&
|
||||||
</li>
|
<>
|
||||||
{this.amCreator &&
|
<li className="list-inline-item">
|
||||||
<li className="list-inline-item">
|
<span class="pointer" onClick={linkEvent(this, this.handleEditClick)}><T i18nKey="edit">#</T></span>
|
||||||
<span class="pointer" onClick={linkEvent(this, this.handleDeleteClick)}>
|
</li>
|
||||||
{!community.deleted ? i18n.t('delete') : i18n.t('restore')}
|
{this.amCreator &&
|
||||||
</span>
|
<li className="list-inline-item">
|
||||||
</li>
|
<span class="pointer" onClick={linkEvent(this, this.handleDeleteClick)}>
|
||||||
}
|
{!community.deleted ? i18n.t('delete') : i18n.t('restore')}
|
||||||
</>
|
</span>
|
||||||
}
|
</li>
|
||||||
{this.canAdmin &&
|
}
|
||||||
<li className="list-inline-item">
|
</>
|
||||||
{!this.props.community.removed ?
|
}
|
||||||
<span class="pointer" onClick={linkEvent(this, this.handleModRemoveShow)}><T i18nKey="remove">#</T></span> :
|
{this.canAdmin &&
|
||||||
<span class="pointer" onClick={linkEvent(this, this.handleModRemoveSubmit)}><T i18nKey="restore">#</T></span>
|
<li className="list-inline-item">
|
||||||
}
|
{!this.props.community.removed ?
|
||||||
</li>
|
<span class="pointer" onClick={linkEvent(this, this.handleModRemoveShow)}><T i18nKey="remove">#</T></span> :
|
||||||
|
<span class="pointer" onClick={linkEvent(this, this.handleModRemoveSubmit)}><T i18nKey="restore">#</T></span>
|
||||||
|
}
|
||||||
|
</li>
|
||||||
|
|
||||||
}
|
}
|
||||||
</ul>
|
</ul>
|
||||||
{this.state.showRemoveDialog &&
|
{this.state.showRemoveDialog &&
|
||||||
<form onSubmit={linkEvent(this, this.handleModRemoveSubmit)}>
|
<form onSubmit={linkEvent(this, this.handleModRemoveSubmit)}>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-form-label"><T i18nKey="reason">#</T></label>
|
<label class="col-form-label"><T i18nKey="reason">#</T></label>
|
||||||
<input type="text" class="form-control mr-2" placeholder={i18n.t('optional')} value={this.state.removeReason} onInput={linkEvent(this, this.handleModRemoveReasonChange)} />
|
<input type="text" class="form-control mr-2" placeholder={i18n.t('optional')} value={this.state.removeReason} onInput={linkEvent(this, this.handleModRemoveReasonChange)} />
|
||||||
|
</div>
|
||||||
|
{/* TODO hold off on expires for now */}
|
||||||
|
{/* <div class="form-group row"> */}
|
||||||
|
{/* <label class="col-form-label">Expires</label> */}
|
||||||
|
{/* <input type="date" class="form-control mr-2" placeholder={i18n.t('expires')} value={this.state.removeExpires} onInput={linkEvent(this, this.handleModRemoveExpiresChange)} /> */}
|
||||||
|
{/* </div> */}
|
||||||
|
<div class="form-group row">
|
||||||
|
<button type="submit" class="btn btn-secondary"><T i18nKey="remove_community">#</T></button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
}
|
||||||
|
<ul class="my-1 list-inline">
|
||||||
|
<li className="list-inline-item"><Link className="badge badge-secondary" to="/communities">{community.category_name}</Link></li>
|
||||||
|
<li className="list-inline-item badge badge-secondary"><T i18nKey="number_of_subscribers" interpolation={{count: community.number_of_subscribers}}>#</T></li>
|
||||||
|
<li className="list-inline-item badge badge-secondary"><T i18nKey="number_of_posts" interpolation={{count: community.number_of_posts}}>#</T></li>
|
||||||
|
<li className="list-inline-item badge badge-secondary"><T i18nKey="number_of_comments" interpolation={{count: community.number_of_comments}}>#</T></li>
|
||||||
|
<li className="list-inline-item"><Link className="badge badge-secondary" to={`/modlog/community/${this.props.community.id}`}><T i18nKey="modlog">#</T></Link></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="list-inline small">
|
||||||
|
<li class="list-inline-item">{i18n.t('mods')}: </li>
|
||||||
|
{this.props.moderators.map(mod =>
|
||||||
|
<li class="list-inline-item"><Link class="text-info" to={`/u/${mod.user_name}`}>{mod.user_name}</Link></li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
<Link class={`btn btn-sm btn-secondary btn-block mb-3 ${(community.deleted || community.removed) && 'no-click'}`}
|
||||||
|
to={`/create_post/c/${community.name}`}><T i18nKey="create_a_post">#</T></Link>
|
||||||
|
<div>
|
||||||
|
{community.subscribed
|
||||||
|
? <button class="btn btn-sm btn-secondary btn-block" onClick={linkEvent(community.id, this.handleUnsubscribe)}><T i18nKey="unsubscribe">#</T></button>
|
||||||
|
: <button class="btn btn-sm btn-secondary btn-block" onClick={linkEvent(community.id, this.handleSubscribe)}><T i18nKey="subscribe">#</T></button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
{/* TODO hold off on expires for now */}
|
|
||||||
{/* <div class="form-group row"> */}
|
|
||||||
{/* <label class="col-form-label">Expires</label> */}
|
|
||||||
{/* <input type="date" class="form-control mr-2" placeholder={i18n.t('expires')} value={this.state.removeExpires} onInput={linkEvent(this, this.handleModRemoveExpiresChange)} /> */}
|
|
||||||
{/* </div> */}
|
|
||||||
<div class="form-group row">
|
|
||||||
<button type="submit" class="btn btn-secondary"><T i18nKey="remove_community">#</T></button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
}
|
|
||||||
<ul class="my-1 list-inline">
|
|
||||||
<li className="list-inline-item"><Link className="badge badge-light" to="/communities">{community.category_name}</Link></li>
|
|
||||||
<li className="list-inline-item badge badge-light"><T i18nKey="number_of_subscribers" interpolation={{count: community.number_of_subscribers}}>#</T></li>
|
|
||||||
<li className="list-inline-item badge badge-light"><T i18nKey="number_of_posts" interpolation={{count: community.number_of_posts}}>#</T></li>
|
|
||||||
<li className="list-inline-item badge badge-light"><T i18nKey="number_of_comments" interpolation={{count: community.number_of_comments}}>#</T></li>
|
|
||||||
<li className="list-inline-item"><Link className="badge badge-light" to={`/modlog/community/${this.props.community.id}`}><T i18nKey="modlog">#</T></Link></li>
|
|
||||||
</ul>
|
|
||||||
<ul class="list-inline small">
|
|
||||||
<li class="list-inline-item">{i18n.t('mods')}: </li>
|
|
||||||
{this.props.moderators.map(mod =>
|
|
||||||
<li class="list-inline-item"><Link class="text-info" to={`/u/${mod.user_name}`}>{mod.user_name}</Link></li>
|
|
||||||
)}
|
|
||||||
</ul>
|
|
||||||
<Link class={`btn btn-sm btn-secondary btn-block mb-3 ${(community.deleted || community.removed) && 'no-click'}`}
|
|
||||||
to={`/create_post/c/${community.name}`}><T i18nKey="create_a_post">#</T></Link>
|
|
||||||
<div>
|
|
||||||
{community.subscribed
|
|
||||||
? <button class="btn btn-sm btn-secondary btn-block mb-3" onClick={linkEvent(community.id, this.handleUnsubscribe)}><T i18nKey="unsubscribe">#</T></button>
|
|
||||||
: <button class="btn btn-sm btn-secondary btn-block mb-3" onClick={linkEvent(community.id, this.handleSubscribe)}><T i18nKey="subscribe">#</T></button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
{community.description &&
|
|
||||||
<div>
|
|
||||||
<hr />
|
|
||||||
<div className="md-div" dangerouslySetInnerHTML={mdToHtml(community.description)} />
|
|
||||||
<hr />
|
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
</div>
|
{community.description &&
|
||||||
|
<div class="card border-secondary">
|
||||||
|
<div class="card-body">
|
||||||
|
<div className="md-div" dangerouslySetInnerHTML={mdToHtml(community.description)} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ export class User extends Component<any, UserState> {
|
||||||
{this.state.loading ?
|
{this.state.loading ?
|
||||||
<h5><svg class="icon icon-spinner spin"><use xlinkHref="#icon-spinner"></use></svg></h5> :
|
<h5><svg class="icon icon-spinner spin"><use xlinkHref="#icon-spinner"></use></svg></h5> :
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-9">
|
<div class="col-12 col-md-8">
|
||||||
<h5>/u/{this.state.user.name}</h5>
|
<h5>/u/{this.state.user.name}</h5>
|
||||||
{this.selects()}
|
{this.selects()}
|
||||||
{this.state.view == View.Overview &&
|
{this.state.view == View.Overview &&
|
||||||
|
@ -140,7 +140,7 @@ export class User extends Component<any, UserState> {
|
||||||
}
|
}
|
||||||
{this.paginator()}
|
{this.paginator()}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-md-3">
|
<div class="col-12 col-md-4">
|
||||||
{this.userInfo()}
|
{this.userInfo()}
|
||||||
{this.isCurrentUser &&
|
{this.isCurrentUser &&
|
||||||
this.userSettings()
|
this.userSettings()
|
||||||
|
@ -232,19 +232,24 @@ export class User extends Component<any, UserState> {
|
||||||
let user = this.state.user;
|
let user = this.state.user;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h5>{user.name}</h5>
|
<div class="card border-secondary mb-3">
|
||||||
<div>{i18n.t('joined')} <MomentTime data={user} /></div>
|
<div class="card-body">
|
||||||
<table class="table table-bordered table-sm mt-2">
|
<h5>{user.name}</h5>
|
||||||
<tr>
|
<div>{i18n.t('joined')} <MomentTime data={user} /></div>
|
||||||
<td><T i18nKey="number_of_points" interpolation={{count: user.post_score}}>#</T></td>
|
<div class="table-responsive">
|
||||||
<td><T i18nKey="number_of_posts" interpolation={{count: user.number_of_posts}}>#</T></td>
|
<table class="table table-bordered table-sm mt-2 mb-0">
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td><T i18nKey="number_of_points" interpolation={{count: user.post_score}}>#</T></td>
|
||||||
<td><T i18nKey="number_of_points" interpolation={{count: user.comment_score}}>#</T></td>
|
<td><T i18nKey="number_of_posts" interpolation={{count: user.number_of_posts}}>#</T></td>
|
||||||
<td><T i18nKey="number_of_comments" interpolation={{count: user.number_of_comments}}>#</T></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
</table>
|
<td><T i18nKey="number_of_points" interpolation={{count: user.comment_score}}>#</T></td>
|
||||||
<hr />
|
<td><T i18nKey="number_of_comments" interpolation={{count: user.number_of_comments}}>#</T></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -252,23 +257,27 @@ export class User extends Component<any, UserState> {
|
||||||
userSettings() {
|
userSettings() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h5><T i18nKey="settings">#</T></h5>
|
<div class="card border-secondary mb-3">
|
||||||
<form onSubmit={linkEvent(this, this.handleUserSettingsSubmit)}>
|
<div class="card-body">
|
||||||
<div class="form-group row">
|
<h5><T i18nKey="settings">#</T></h5>
|
||||||
<div class="col-12">
|
<form onSubmit={linkEvent(this, this.handleUserSettingsSubmit)}>
|
||||||
<div class="form-check">
|
<div class="form-group row">
|
||||||
<input class="form-check-input" type="checkbox" checked={this.state.userSettingsForm.show_nsfw} onChange={linkEvent(this, this.handleUserSettingsShowNsfwChange)}/>
|
<div class="col-12">
|
||||||
<label class="form-check-label"><T i18nKey="show_nsfw">#</T></label>
|
<div class="form-check">
|
||||||
|
<input class="form-check-input" type="checkbox" checked={this.state.userSettingsForm.show_nsfw} onChange={linkEvent(this, this.handleUserSettingsShowNsfwChange)}/>
|
||||||
|
<label class="form-check-label"><T i18nKey="show_nsfw">#</T></label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="form-group row mb-0">
|
||||||
|
<div class="col-12">
|
||||||
|
<button type="submit" class="btn btn-secondary">{this.state.userSettingsLoading ?
|
||||||
|
<svg class="icon icon-spinner spin"><use xlinkHref="#icon-spinner"></use></svg> : capitalizeFirstLetter(i18n.t('save'))}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
</div>
|
||||||
<div class="col-12">
|
|
||||||
<button type="submit" class="btn btn-secondary">{this.state.userSettingsLoading ?
|
|
||||||
<svg class="icon icon-spinner spin"><use xlinkHref="#icon-spinner"></use></svg> : capitalizeFirstLetter(i18n.t('save'))}</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -276,16 +285,20 @@ export class User extends Component<any, UserState> {
|
||||||
moderates() {
|
moderates() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{this.state.moderates.length > 0 &&
|
<div class="card border-secondary mb-3">
|
||||||
<div>
|
<div class="card-body">
|
||||||
<h5><T i18nKey="moderates">#</T></h5>
|
{this.state.moderates.length > 0 &&
|
||||||
<ul class="list-unstyled">
|
<div>
|
||||||
{this.state.moderates.map(community =>
|
<h5><T i18nKey="moderates">#</T></h5>
|
||||||
<li><Link to={`/c/${community.community_name}`}>{community.community_name}</Link></li>
|
<ul class="list-unstyled mb-0">
|
||||||
)}
|
{this.state.moderates.map(community =>
|
||||||
</ul>
|
<li><Link to={`/c/${community.community_name}`}>{community.community_name}</Link></li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -294,14 +307,15 @@ export class User extends Component<any, UserState> {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{this.state.follows.length > 0 &&
|
{this.state.follows.length > 0 &&
|
||||||
<div>
|
<div class="card border-secondary mb-3">
|
||||||
<hr />
|
<div class="card-body">
|
||||||
<h5><T i18nKey="subscribed">#</T></h5>
|
<h5><T i18nKey="subscribed">#</T></h5>
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled mb-0">
|
||||||
{this.state.follows.map(community =>
|
{this.state.follows.map(community =>
|
||||||
<li><Link to={`/c/${community.community_name}`}>{community.community_name}</Link></li>
|
<li><Link to={`/c/${community.community_name}`}>{community.community_name}</Link></li>
|
||||||
)}
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
@ -310,7 +324,7 @@ export class User extends Component<any, UserState> {
|
||||||
|
|
||||||
paginator() {
|
paginator() {
|
||||||
return (
|
return (
|
||||||
<div class="mt-2">
|
<div class="my-2">
|
||||||
{this.state.page > 1 &&
|
{this.state.page > 1 &&
|
||||||
<button class="btn btn-sm btn-secondary mr-1" onClick={linkEvent(this, this.prevPage)}><T i18nKey="prev">#</T></button>
|
<button class="btn btn-sm btn-secondary mr-1" onClick={linkEvent(this, this.prevPage)}><T i18nKey="prev">#</T></button>
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,10 +96,6 @@ body, .text-white, .navbar-brand, .badge-light, .btn-secondary {
|
||||||
z-index: 2000;
|
z-index: 2000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-bg {
|
|
||||||
background-color: #222;
|
|
||||||
}
|
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
border-left: 3px solid #ccc;
|
border-left: 3px solid #ccc;
|
||||||
margin: 0.5em 5px;
|
margin: 0.5em 5px;
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Index extends Component<any, any> {
|
||||||
<Provider i18next={i18n}>
|
<Provider i18next={i18n}>
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Navbar />
|
<Navbar />
|
||||||
<div class="mt-1 p-0">
|
<div class="mt-3 p-0">
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path={`/home/type/:type/sort/:sort/page/:page`} component={Main} />
|
<Route path={`/home/type/:type/sort/:sort/page/:page`} component={Main} />
|
||||||
<Route exact path={`/`} component={Main} />
|
<Route exact path={`/`} component={Main} />
|
||||||
|
|
Loading…
Reference in a new issue