forked from nutomic/lemmy
Show ago for user details. Fixes #586
This commit is contained in:
parent
c5e9e9b674
commit
22d75990b7
2 changed files with 6 additions and 3 deletions
5
ui/src/components/moment-time.tsx
vendored
5
ui/src/components/moment-time.tsx
vendored
|
@ -9,6 +9,7 @@ interface MomentTimeProps {
|
||||||
when_?: string;
|
when_?: string;
|
||||||
updated?: string;
|
updated?: string;
|
||||||
};
|
};
|
||||||
|
showAgo?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class MomentTime extends Component<MomentTimeProps, any> {
|
export class MomentTime extends Component<MomentTimeProps, any> {
|
||||||
|
@ -32,7 +33,7 @@ export class MomentTime extends Component<MomentTimeProps, any> {
|
||||||
<svg class="icon icon-inline mr-1">
|
<svg class="icon icon-inline mr-1">
|
||||||
<use xlinkHref="#icon-edit-2"></use>
|
<use xlinkHref="#icon-edit-2"></use>
|
||||||
</svg>
|
</svg>
|
||||||
{moment.utc(this.props.data.updated).fromNow(true)}
|
{moment.utc(this.props.data.updated).fromNow(!this.props.showAgo)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -42,7 +43,7 @@ export class MomentTime extends Component<MomentTimeProps, any> {
|
||||||
className="pointer unselectable"
|
className="pointer unselectable"
|
||||||
data-tippy-content={this.format(str)}
|
data-tippy-content={this.format(str)}
|
||||||
>
|
>
|
||||||
{moment.utc(str).fromNow(true)}
|
{moment.utc(str).fromNow(!this.props.showAgo)}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
4
ui/src/components/user.tsx
vendored
4
ui/src/components/user.tsx
vendored
|
@ -37,6 +37,7 @@ import {
|
||||||
createCommentLikeRes,
|
createCommentLikeRes,
|
||||||
createPostLikeFindRes,
|
createPostLikeFindRes,
|
||||||
commentsToFlatNodes,
|
commentsToFlatNodes,
|
||||||
|
setupTippy,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import { PostListing } from './post-listing';
|
import { PostListing } from './post-listing';
|
||||||
import { SortSelect } from './sort-select';
|
import { SortSelect } from './sort-select';
|
||||||
|
@ -358,7 +359,7 @@ export class User extends Component<any, UserState> {
|
||||||
</ul>
|
</ul>
|
||||||
</h5>
|
</h5>
|
||||||
<div>
|
<div>
|
||||||
{i18n.t('joined')} <MomentTime data={user} />
|
{i18n.t('joined')} <MomentTime data={user} showAgo />
|
||||||
</div>
|
</div>
|
||||||
<div class="table-responsive mt-1">
|
<div class="table-responsive mt-1">
|
||||||
<table class="table table-bordered table-sm mt-2 mb-0">
|
<table class="table table-bordered table-sm mt-2 mb-0">
|
||||||
|
@ -1034,6 +1035,7 @@ export class User extends Component<any, UserState> {
|
||||||
document.title = `/u/${this.state.user.name} - ${WebSocketService.Instance.site.name}`;
|
document.title = `/u/${this.state.user.name} - ${WebSocketService.Instance.site.name}`;
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
this.setState(this.state);
|
this.setState(this.state);
|
||||||
|
setupTippy();
|
||||||
} else if (res.op == UserOperation.EditComment) {
|
} else if (res.op == UserOperation.EditComment) {
|
||||||
let data = res.data as CommentResponse;
|
let data = res.data as CommentResponse;
|
||||||
editCommentRes(data, this.state.comments);
|
editCommentRes(data, this.state.comments);
|
||||||
|
|
Loading…
Reference in a new issue