diff --git a/src/assets/symbols.svg b/src/assets/symbols.svg index 2fb8eac7..72214eaf 100644 --- a/src/assets/symbols.svg +++ b/src/assets/symbols.svg @@ -251,5 +251,12 @@ + + + + + + + diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index d68c5b30..16e0a731 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -282,8 +282,15 @@ export class CommentNode extends Component { )} {this.linkBtn(true)} + + { + this.props.allLanguages.find( + lang => lang.id === cv.comment.language_id + )?.name + } + {/* This is an expanding spacer for mobile */} - + {showScores() && ( <> { )} + + { + this.props.allLanguages.find( + lang => lang.id === post_view.post.language_id + )?.name + } + • {url && !(hostname(url) === getExternalHost()) && ( <> @@ -560,9 +569,19 @@ export class PostListing extends Component { commentsLine(mobile = false) { let post = this.props.post_view.post; + return ( {this.commentsButton} + {canShare() && ( + + + + )} {!post.local && ( { 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 }); } diff --git a/src/shared/utils.ts b/src/shared/utils.ts index b5b39c4f..2e18e2b8 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -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); + } +}