mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 20:01:06 +00:00
Adding clearer goto context.
- Adding context props. - Making link / context the first selectable on user and inbox page. - Making icons a little bigger. - #609
This commit is contained in:
parent
522649d9d3
commit
f76c3af557
7 changed files with 52 additions and 42 deletions
31
ui/src/components/comment-node.tsx
vendored
31
ui/src/components/comment-node.tsx
vendored
|
@ -66,6 +66,7 @@ interface CommentNodeProps {
|
|||
viewOnly?: boolean;
|
||||
locked?: boolean;
|
||||
markable?: boolean;
|
||||
showContext?: boolean;
|
||||
moderators: Array<CommunityUser>;
|
||||
admins: Array<UserView>;
|
||||
// TODO is this necessary, can't I get it from the node itself?
|
||||
|
@ -249,10 +250,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
/>
|
||||
)}
|
||||
<ul class="list-inline mb-0 text-muted font-weight-bold small">
|
||||
{this.props.showContext && this.linkBtn}
|
||||
{this.props.markable && (
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-sm btn-animate text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleMarkRead)}
|
||||
data-tippy-content={
|
||||
node.comment.read
|
||||
|
@ -277,7 +279,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
<>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
className={`btn btn-link btn-sm btn-animate ${
|
||||
className={`btn btn-link btn-animate ${
|
||||
this.state.my_vote == 1 ? 'text-info' : 'text-muted'
|
||||
}`}
|
||||
onClick={linkEvent(node, this.handleCommentUpvote)}
|
||||
|
@ -294,7 +296,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
{WebSocketService.Instance.site.enable_downvotes && (
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
className={`btn btn-link btn-sm btn-animate ${
|
||||
className={`btn btn-link btn-animate ${
|
||||
this.state.my_vote == -1
|
||||
? 'text-danger'
|
||||
: 'text-muted'
|
||||
|
@ -316,7 +318,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
)}
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-sm btn-animate text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleSaveCommentClick)}
|
||||
data-tippy-content={
|
||||
node.comment.saved
|
||||
|
@ -338,7 +340,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
</li>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-sm btn-animate text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleReplyClick)}
|
||||
data-tippy-content={i18n.t('reply')}
|
||||
>
|
||||
|
@ -347,11 +349,10 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
</svg>
|
||||
</button>
|
||||
</li>
|
||||
{this.props.markable && this.linkBtn}
|
||||
{!this.state.showAdvanced ? (
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
className="btn btn-link btn-sm btn-animate text-muted"
|
||||
className="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleShowAdvanced)}
|
||||
data-tippy-content={i18n.t('more')}
|
||||
>
|
||||
|
@ -365,7 +366,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
{!this.myComment && (
|
||||
<li className="list-inline-item">
|
||||
<Link
|
||||
class="btn btn-link btn-sm btn-animate text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
to={`/create_private_message?recipient_id=${node.comment.creator_id}`}
|
||||
title={i18n.t('message').toLowerCase()}
|
||||
>
|
||||
|
@ -375,10 +376,10 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
</Link>
|
||||
</li>
|
||||
)}
|
||||
{!this.props.markable && this.linkBtn}
|
||||
{!this.props.showContext && this.linkBtn}
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
className="btn btn-link btn-sm btn-animate text-muted"
|
||||
className="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleViewSource)}
|
||||
data-tippy-content={i18n.t('view_source')}
|
||||
>
|
||||
|
@ -395,7 +396,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
<li className="list-inline-item">•</li>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-sm btn-animate text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleEditClick
|
||||
|
@ -409,7 +410,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
</li>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-sm btn-animate text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(
|
||||
this,
|
||||
this.handleDeleteClick
|
||||
|
@ -762,9 +763,11 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
return (
|
||||
<li className="list-inline-item">
|
||||
<Link
|
||||
className="btn btn-link btn-sm btn-animate text-muted"
|
||||
className="btn btn-link btn-animate text-muted"
|
||||
to={`/post/${node.comment.post_id}/comment/${node.comment.id}`}
|
||||
title={i18n.t('link')}
|
||||
title={
|
||||
this.props.showContext ? i18n.t('show_context') : i18n.t('link')
|
||||
}
|
||||
>
|
||||
<svg class="icon icon-inline">
|
||||
<use xlinkHref="#icon-link"></use>
|
||||
|
|
2
ui/src/components/comment-nodes.tsx
vendored
2
ui/src/components/comment-nodes.tsx
vendored
|
@ -20,6 +20,7 @@ interface CommentNodesProps {
|
|||
viewOnly?: boolean;
|
||||
locked?: boolean;
|
||||
markable?: boolean;
|
||||
showContext?: boolean;
|
||||
showCommunity?: boolean;
|
||||
sort?: CommentSortType;
|
||||
sortType?: SortType;
|
||||
|
@ -47,6 +48,7 @@ export class CommentNodes extends Component<
|
|||
admins={this.props.admins}
|
||||
postCreatorId={this.props.postCreatorId}
|
||||
markable={this.props.markable}
|
||||
showContext={this.props.showContext}
|
||||
showCommunity={this.props.showCommunity}
|
||||
sort={this.props.sort}
|
||||
sortType={this.props.sortType}
|
||||
|
|
30
ui/src/components/inbox.tsx
vendored
30
ui/src/components/inbox.tsx
vendored
|
@ -1,5 +1,4 @@
|
|||
import { Component, linkEvent } from 'inferno';
|
||||
import { Link } from 'inferno-router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { retryWhen, delay, take } from 'rxjs/operators';
|
||||
import {
|
||||
|
@ -34,7 +33,6 @@ import { CommentNodes } from './comment-nodes';
|
|||
import { PrivateMessage } from './private-message';
|
||||
import { SortSelect } from './sort-select';
|
||||
import { i18n } from '../i18next';
|
||||
import { T } from 'inferno-i18next';
|
||||
|
||||
enum UnreadOrAll {
|
||||
Unread,
|
||||
|
@ -100,26 +98,19 @@ export class Inbox extends Component<any, InboxState> {
|
|||
}
|
||||
|
||||
render() {
|
||||
let user = UserService.Instance.user;
|
||||
return (
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h5 class="mb-0">
|
||||
<T
|
||||
class="d-inline"
|
||||
i18nKey="inbox_for"
|
||||
interpolation={{ user: user.username }}
|
||||
>
|
||||
#<Link to={`/u/${user.username}`}>#</Link>
|
||||
</T>
|
||||
<h5 class="mb-1">
|
||||
{i18n.t('inbox')}
|
||||
<small>
|
||||
<a
|
||||
href={`/feeds/inbox/${UserService.Instance.auth}.xml`}
|
||||
target="_blank"
|
||||
title="RSS"
|
||||
>
|
||||
<svg class="icon mx-2 text-muted small">
|
||||
<svg class="icon ml-2 text-muted small">
|
||||
<use xlinkHref="#icon-rss">#</use>
|
||||
</svg>
|
||||
</a>
|
||||
|
@ -196,7 +187,12 @@ export class Inbox extends Component<any, InboxState> {
|
|||
<div>
|
||||
{combined.map(i =>
|
||||
isCommentType(i) ? (
|
||||
<CommentNodes nodes={[{ comment: i }]} noIndent markable />
|
||||
<CommentNodes
|
||||
nodes={[{ comment: i }]}
|
||||
noIndent
|
||||
markable
|
||||
showContext
|
||||
/>
|
||||
) : (
|
||||
<PrivateMessage privateMessage={i} />
|
||||
)
|
||||
|
@ -212,6 +208,7 @@ export class Inbox extends Component<any, InboxState> {
|
|||
nodes={commentsToFlatNodes(this.state.replies)}
|
||||
noIndent
|
||||
markable
|
||||
showContext
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -221,7 +218,12 @@ export class Inbox extends Component<any, InboxState> {
|
|||
return (
|
||||
<div>
|
||||
{this.state.mentions.map(mention => (
|
||||
<CommentNodes nodes={[{ comment: mention }]} noIndent markable />
|
||||
<CommentNodes
|
||||
nodes={[{ comment: mention }]}
|
||||
noIndent
|
||||
markable
|
||||
showContext
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
|
16
ui/src/components/post-listing.tsx
vendored
16
ui/src/components/post-listing.tsx
vendored
|
@ -524,7 +524,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
<>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-animate btn-sm text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleSavePostClick)}
|
||||
data-tippy-content={
|
||||
post.saved ? i18n.t('unsave') : i18n.t('save')
|
||||
|
@ -540,7 +540,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
</li>
|
||||
<li className="list-inline-item">
|
||||
<Link
|
||||
class="btn btn-link btn-animate btn-sm text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
to={`/create_post${this.crossPostParams}`}
|
||||
title={i18n.t('cross_post')}
|
||||
>
|
||||
|
@ -555,7 +555,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
<>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-animate btn-sm text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleEditClick)}
|
||||
data-tippy-content={i18n.t('edit')}
|
||||
>
|
||||
|
@ -566,7 +566,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
</li>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-animate btn-sm text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleDeleteClick)}
|
||||
data-tippy-content={
|
||||
!post.deleted
|
||||
|
@ -588,7 +588,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
{!this.state.showAdvanced && this.props.showBody ? (
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-animate btn-sm text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleShowAdvanced)}
|
||||
data-tippy-content={i18n.t('more')}
|
||||
>
|
||||
|
@ -602,7 +602,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
{this.props.showBody && post.body && (
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-animate btn-sm text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleViewSource)}
|
||||
data-tippy-content={i18n.t('view_source')}
|
||||
>
|
||||
|
@ -619,7 +619,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
<>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-animate btn-sm text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleModLock)}
|
||||
data-tippy-content={
|
||||
post.locked
|
||||
|
@ -637,7 +637,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
</li>
|
||||
<li className="list-inline-item">
|
||||
<button
|
||||
class="btn btn-link btn-animate btn-sm text-muted"
|
||||
class="btn btn-link btn-animate text-muted"
|
||||
onClick={linkEvent(this, this.handleModSticky)}
|
||||
data-tippy-content={
|
||||
post.stickied
|
||||
|
|
12
ui/src/components/symbols.tsx
vendored
12
ui/src/components/symbols.tsx
vendored
|
@ -88,14 +88,14 @@ export class Symbols extends Component<any, any> {
|
|||
<path d="M17 19h-12c-0.553 0-1-0.447-1-1s0.447-1 1-1h12c0.553 0 1 0.447 1 1s-0.447 1-1 1z"></path>
|
||||
<path d="M17.5 5h-12.5v9c0 1.1 0.9 2 2 2h8c1.1 0 2-0.9 2-2v-2h0.5c1.93 0 3.5-1.57 3.5-3.5s-1.57-3.5-3.5-3.5zM15 14h-8v-7h8v7zM17.5 10h-1.5v-3h1.5c0.827 0 1.5 0.673 1.5 1.5s-0.673 1.5-1.5 1.5z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-rss" viewBox="0 0 32 32">
|
||||
<path d="M4.259 23.467c-2.35 0-4.259 1.917-4.259 4.252 0 2.349 1.909 4.244 4.259 4.244 2.358 0 4.265-1.895 4.265-4.244-0-2.336-1.907-4.252-4.265-4.252zM0.005 10.873v6.133c3.993 0 7.749 1.562 10.577 4.391 2.825 2.822 4.384 6.595 4.384 10.603h6.16c-0-11.651-9.478-21.127-21.121-21.127zM0.012 0v6.136c14.243 0 25.836 11.604 25.836 25.864h6.152c0-17.64-14.352-32-31.988-32z"></path>
|
||||
<symbol id="icon-rss" viewBox="0 0 24 24">
|
||||
<path d="M4 12c2.209 0 4.208 0.894 5.657 2.343s2.343 3.448 2.343 5.657c0 0.552 0.448 1 1 1s1-0.448 1-1c0-2.761-1.12-5.263-2.929-7.071s-4.31-2.929-7.071-2.929c-0.552 0-1 0.448-1 1s0.448 1 1 1zM4 5c4.142 0 7.891 1.678 10.607 4.393s4.393 6.465 4.393 10.607c0 0.552 0.448 1 1 1s1-0.448 1-1c0-4.694-1.904-8.946-4.979-12.021s-7.327-4.979-12.021-4.979c-0.552 0-1 0.448-1 1s0.448 1 1 1zM7 19c0-0.552-0.225-1.053-0.586-1.414s-0.862-0.586-1.414-0.586-1.053 0.225-1.414 0.586-0.586 0.862-0.586 1.414 0.225 1.053 0.586 1.414 0.862 0.586 1.414 0.586 1.053-0.225 1.414-0.586 0.586-0.862 0.586-1.414z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-arrow-down" viewBox="0 0 26 28">
|
||||
<path d="M25.172 13c0 0.531-0.219 1.047-0.578 1.406l-10.172 10.187c-0.375 0.359-0.891 0.578-1.422 0.578s-1.047-0.219-1.406-0.578l-10.172-10.187c-0.375-0.359-0.594-0.875-0.594-1.406s0.219-1.047 0.594-1.422l1.156-1.172c0.375-0.359 0.891-0.578 1.422-0.578s1.047 0.219 1.406 0.578l4.594 4.594v-11c0-1.094 0.906-2 2-2h2c1.094 0 2 0.906 2 2v11l4.594-4.594c0.359-0.359 0.875-0.578 1.406-0.578s1.047 0.219 1.422 0.578l1.172 1.172c0.359 0.375 0.578 0.891 0.578 1.422z"></path>
|
||||
<symbol id="icon-arrow-down" viewBox="0 0 24 24">
|
||||
<path d="M18.293 11.293l-5.293 5.293v-11.586c0-0.552-0.448-1-1-1s-1 0.448-1 1v11.586l-5.293-5.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414l7 7c0.092 0.092 0.202 0.166 0.324 0.217 0.245 0.101 0.521 0.101 0.766 0 0.118-0.049 0.228-0.121 0.324-0.217l7-7c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-arrow-up" viewBox="0 0 26 28">
|
||||
<path d="M25.172 15.172c0 0.531-0.219 1.031-0.578 1.406l-1.172 1.172c-0.375 0.375-0.891 0.594-1.422 0.594s-1.047-0.219-1.406-0.594l-4.594-4.578v11c0 1.125-0.938 1.828-2 1.828h-2c-1.062 0-2-0.703-2-1.828v-11l-4.594 4.578c-0.359 0.375-0.875 0.594-1.406 0.594s-1.047-0.219-1.406-0.594l-1.172-1.172c-0.375-0.375-0.594-0.875-0.594-1.406s0.219-1.047 0.594-1.422l10.172-10.172c0.359-0.375 0.875-0.578 1.406-0.578s1.047 0.203 1.422 0.578l10.172 10.172c0.359 0.375 0.578 0.891 0.578 1.422z"></path>
|
||||
<symbol id="icon-arrow-up" viewBox="0 0 24 24">
|
||||
<path d="M5.707 12.707l5.293-5.293v11.586c0 0.552 0.448 1 1 1s1-0.448 1-1v-11.586l5.293 5.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-7-7c-0.092-0.092-0.202-0.166-0.324-0.217s-0.253-0.076-0.383-0.076c-0.256 0-0.512 0.098-0.707 0.293l-7 7c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0z"></path>
|
||||
</symbol>
|
||||
<symbol id="icon-mail" viewBox="0 0 24 24">
|
||||
<path d="M3 7.921l8.427 5.899c0.34 0.235 0.795 0.246 1.147 0l8.426-5.899v10.079c0 0.272-0.11 0.521-0.295 0.705s-0.433 0.295-0.705 0.295h-16c-0.272 0-0.521-0.11-0.705-0.295s-0.295-0.433-0.295-0.705zM1 5.983c0 0.010 0 0.020 0 0.030v11.987c0 0.828 0.34 1.579 0.88 2.12s1.292 0.88 2.12 0.88h16c0.828 0 1.579-0.34 2.12-0.88s0.88-1.292 0.88-2.12v-11.988c0-0.010 0-0.020 0-0.030-0.005-0.821-0.343-1.565-0.88-2.102-0.541-0.54-1.292-0.88-2.12-0.88h-16c-0.828 0-1.579 0.34-2.12 0.88-0.537 0.537-0.875 1.281-0.88 2.103zM20.894 5.554l-8.894 6.225-8.894-6.225c0.048-0.096 0.112-0.183 0.188-0.259 0.185-0.185 0.434-0.295 0.706-0.295h16c0.272 0 0.521 0.11 0.705 0.295 0.076 0.076 0.14 0.164 0.188 0.259z"></path>
|
||||
|
|
2
ui/src/components/user.tsx
vendored
2
ui/src/components/user.tsx
vendored
|
@ -312,6 +312,7 @@ export class User extends Component<any, UserState> {
|
|||
nodes={[{ comment: i.data as Comment }]}
|
||||
admins={this.state.admins}
|
||||
noIndent
|
||||
showContext
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
@ -327,6 +328,7 @@ export class User extends Component<any, UserState> {
|
|||
nodes={commentsToFlatNodes(this.state.comments)}
|
||||
admins={this.state.admins}
|
||||
noIndent
|
||||
showContext
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
|
1
ui/translations/en.json
vendored
1
ui/translations/en.json
vendored
|
@ -39,6 +39,7 @@
|
|||
"avatar": "Avatar",
|
||||
"upload_avatar": "Upload Avatar",
|
||||
"show_avatars": "Show Avatars",
|
||||
"show_context": "Show context",
|
||||
"formatting_help": "formatting help",
|
||||
"sorting_help": "sorting help",
|
||||
"view_source": "view source",
|
||||
|
|
Loading…
Reference in a new issue