mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 12:21:13 +00:00
Merge branch 'rate-limiting-tab' of https://github.com/SleeplessOne1917/lemmy-ui into rate-limiting-tab
This commit is contained in:
commit
f51cc697a7
4 changed files with 54 additions and 2 deletions
|
@ -251,5 +251,12 @@
|
|||
<symbol id="icon-superscript" viewBox="0 0 20 20">
|
||||
<path d="M17.5 1h.5V0h-.5a1.49 1.49 0 0 0-1 .39 1.49 1.49 0 0 0-1-.39H15v1h.5a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-.5.5H15v1h.5a1.49 1.49 0 0 0 1-.39 1.49 1.49 0 0 0 1 .39h.5V8h-.5a.5.5 0 0 1-.5-.5v-6a.5.5 0 0 1 .5-.5zm-3.82 15h-2.42a.67.67 0 0 1-.46-.15 1.33 1.33 0 0 1-.28-.34l-2.77-4.44a2.65 2.65 0 0 1-.28.69L5 15.51a2.22 2.22 0 0 1-.29.34.58.58 0 0 1-.42.15H2l4.15-6.19L2.17 4h2.42a.81.81 0 0 1 .41.09.8.8 0 0 1 .24.26L8 8.59a2.71 2.71 0 0 1 .33-.74L10.6 4.4a.69.69 0 0 1 .6-.4h2.32l-4 5.71z" />
|
||||
</symbol>
|
||||
<symbol id="icon-share" viewBox="0 0 24 24">
|
||||
<path d="M21 6C21 7.65685 19.6569 9 18 9C16.3431 9 15 7.65685 15 6C15 4.34315 16.3431 3 18 3C19.6569 3 21 4.34315 21 6Z" stroke-width="2"/>
|
||||
<path d="M21 18C21 19.6569 19.6569 21 18 21C16.3431 21 15 19.6569 15 18C15 16.3431 16.3431 15 18 15C19.6569 15 21 16.3431 21 18Z" stroke-width="2"/>
|
||||
<path d="M9 12C9 13.6569 7.65685 15 6 15C4.34315 15 3 13.6569 3 12C3 10.3431 4.34315 9 6 9C7.65685 9 9 10.3431 9 12Z" stroke-width="2"/>
|
||||
<path d="M8.72046 10.6397L14.9999 7.5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M8.70605 13.353L15 16.5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</symbol>
|
||||
</defs>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
@ -282,8 +282,15 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
|
|||
)}
|
||||
</button>
|
||||
{this.linkBtn(true)}
|
||||
<span className="mx-1 badge badge-secondary">
|
||||
{
|
||||
this.props.allLanguages.find(
|
||||
lang => lang.id === cv.comment.language_id
|
||||
)?.name
|
||||
}
|
||||
</span>
|
||||
{/* This is an expanding spacer for mobile */}
|
||||
<div className="mr-lg-5 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2"></div>
|
||||
<div className="mr-lg-5 flex-grow-1 flex-lg-grow-0 unselectable pointer mx-2" />
|
||||
{showScores() && (
|
||||
<>
|
||||
<a
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
SavePost,
|
||||
TransferCommunity,
|
||||
} from "lemmy-js-client";
|
||||
import { getExternalHost } from "../../env";
|
||||
import { getExternalHost, getHttpBase } from "../../env";
|
||||
import { i18n } from "../../i18next";
|
||||
import { BanType, PostFormParams, PurgeType } from "../../interfaces";
|
||||
import { UserService, WebSocketService } from "../../services";
|
||||
|
@ -32,6 +32,7 @@ import {
|
|||
amMod,
|
||||
canAdmin,
|
||||
canMod,
|
||||
canShare,
|
||||
futureDaysToUnixTime,
|
||||
hostname,
|
||||
isAdmin,
|
||||
|
@ -46,6 +47,7 @@ import {
|
|||
numToSI,
|
||||
relTags,
|
||||
setupTippy,
|
||||
share,
|
||||
showScores,
|
||||
wsClient,
|
||||
} from "../../utils";
|
||||
|
@ -342,6 +344,13 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
</span>
|
||||
)}
|
||||
</li>
|
||||
<span className="mx-1 badge badge-secondary">
|
||||
{
|
||||
this.props.allLanguages.find(
|
||||
lang => lang.id === post_view.post.language_id
|
||||
)?.name
|
||||
}
|
||||
</span>
|
||||
<li className="list-inline-item">•</li>
|
||||
{url && !(hostname(url) === getExternalHost()) && (
|
||||
<>
|
||||
|
@ -560,9 +569,19 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
|
||||
commentsLine(mobile = false) {
|
||||
let post = this.props.post_view.post;
|
||||
|
||||
return (
|
||||
<div className="d-flex justify-content-start flex-wrap text-muted font-weight-bold mb-1">
|
||||
{this.commentsButton}
|
||||
{canShare() && (
|
||||
<button
|
||||
className="btn btn-link"
|
||||
onClick={linkEvent(this, this.handleShare)}
|
||||
type="button"
|
||||
>
|
||||
<Icon icon="share" inline />
|
||||
</button>
|
||||
)}
|
||||
{!post.local && (
|
||||
<a
|
||||
className="btn btn-link btn-animate text-muted py-0"
|
||||
|
@ -1399,6 +1418,15 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
|||
this.setState({ showEdit: false });
|
||||
}
|
||||
|
||||
handleShare(i: PostListing) {
|
||||
const { name, body, id } = i.props.post_view.post;
|
||||
share({
|
||||
title: name,
|
||||
text: body?.slice(0, 50),
|
||||
url: `${getHttpBase()}/post/${id}`,
|
||||
});
|
||||
}
|
||||
|
||||
handleShowReportDialog(i: PostListing) {
|
||||
i.setState({ showReportDialog: !i.state.showReportDialog });
|
||||
}
|
||||
|
|
|
@ -1593,3 +1593,13 @@ export function isAuthPath(pathname: string) {
|
|||
pathname
|
||||
);
|
||||
}
|
||||
|
||||
export function canShare() {
|
||||
return isBrowser() && !!navigator.canShare;
|
||||
}
|
||||
|
||||
export function share(shareData: ShareData) {
|
||||
if (isBrowser()) {
|
||||
navigator.share(shareData);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue