mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(post): show edit reason as tooltip over red text
This commit is contained in:
@@ -218,7 +218,7 @@ const PostMedia = ({ post }: PostProps) => {
|
|||||||
|
|
||||||
const PostMessage = ({ post }: PostProps) => {
|
const PostMessage = ({ post }: PostProps) => {
|
||||||
const { cid, content, commentAuthor, deleted, edit, original, parentCid, postCid, reason, removed, spoiler, state, subplebbitAddress } = post || {};
|
const { cid, content, commentAuthor, deleted, edit, original, parentCid, postCid, reason, removed, spoiler, state, subplebbitAddress } = post || {};
|
||||||
const banned = commentAuthor?.banExpiresAt;
|
const banned = !!commentAuthor?.banExpiresAt;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@@ -242,9 +242,13 @@ const PostMessage = ({ post }: PostProps) => {
|
|||||||
<blockquote className={styles.postMessage}>
|
<blockquote className={styles.postMessage}>
|
||||||
{isReply && !(removed || deleted) && isReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} />}
|
{isReply && !(removed || deleted) && isReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} />}
|
||||||
{removed ? (
|
{removed ? (
|
||||||
<span className={styles.removedContent}>({t('this_post_was_removed')})</span>
|
<Tooltip
|
||||||
|
children={<span className={styles.removedContent}>({t('this_post_was_removed')})</span>}
|
||||||
|
content={`${_.capitalize(t('reason'))}: "${reason}"`}
|
||||||
|
showTooltip={!!reason}
|
||||||
|
/>
|
||||||
) : deleted ? (
|
) : deleted ? (
|
||||||
<span className={styles.deletedContent}>{t('user_deleted_this_post')}</span>
|
<Tooltip children={<span className={styles.deletedContent}>{t('user_deleted_this_post')}</span>} content={reason && `${t('reason')}: ${reason}`} />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{!showOriginal && <Markdown content={displayContent} spoiler={spoiler} />}
|
{!showOriginal && <Markdown content={displayContent} spoiler={spoiler} />}
|
||||||
@@ -269,26 +273,20 @@ const PostMessage = ({ post }: PostProps) => {
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{banned && (
|
|
||||||
<span className={styles.removedContent}>
|
|
||||||
<br />
|
|
||||||
<Tooltip
|
|
||||||
children={`(${t('user_banned')})`}
|
|
||||||
content={t('ban_expires_at', {
|
|
||||||
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress),
|
|
||||||
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
|
|
||||||
interpolation: { escapeValue: false },
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{(removed || deleted) && reason && (
|
{banned && (
|
||||||
<span>
|
<span className={styles.removedContent}>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
{t('reason')}: {reason}
|
<Tooltip
|
||||||
|
children={`(${t('user_banned')})`}
|
||||||
|
content={`${t('ban_expires_at', {
|
||||||
|
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress),
|
||||||
|
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
|
||||||
|
interpolation: { escapeValue: false },
|
||||||
|
})}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`}
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{!isReply && content.length > 1000 && !isInPostView && (
|
{!isReply && content.length > 1000 && !isInPostView && (
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ const ReplyBacklinks = ({ post }: PostProps) => {
|
|||||||
const PostMessageMobile = ({ post }: PostProps) => {
|
const PostMessageMobile = ({ post }: PostProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { cid, commentAuthor, content, deleted, edit, original, parentCid, postCid, reason, removed, spoiler, state, subplebbitAddress } = post || {};
|
const { cid, commentAuthor, content, deleted, edit, original, parentCid, postCid, reason, removed, spoiler, state, subplebbitAddress } = post || {};
|
||||||
const banned = commentAuthor?.banExpiresAt;
|
const banned = !!commentAuthor?.banExpiresAt;
|
||||||
const [showOriginal, setShowOriginal] = useState(false);
|
const [showOriginal, setShowOriginal] = useState(false);
|
||||||
|
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
@@ -178,9 +178,13 @@ const PostMessageMobile = ({ post }: PostProps) => {
|
|||||||
<blockquote className={`${styles.postMessage} ${!isReply && styles.clampLines}`}>
|
<blockquote className={`${styles.postMessage} ${!isReply && styles.clampLines}`}>
|
||||||
{isReply && !(removed || deleted) && isReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} />}
|
{isReply && !(removed || deleted) && isReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} />}
|
||||||
{removed ? (
|
{removed ? (
|
||||||
<span className={styles.removedContent}>({t('this_post_was_removed')})</span>
|
<Tooltip
|
||||||
|
children={<span className={styles.removedContent}>({t('this_post_was_removed')})</span>}
|
||||||
|
content={`${_.capitalize(t('reason'))}: "${reason}"`}
|
||||||
|
showTooltip={!!reason}
|
||||||
|
/>
|
||||||
) : deleted ? (
|
) : deleted ? (
|
||||||
<span className={styles.removedContent}>{t('user_deleted_this_post')}</span>
|
<Tooltip children={<span className={styles.deletedContent}>{t('user_deleted_this_post')}</span>} content={reason && `${t('reason')}: ${reason}`} />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{!showOriginal && <Markdown content={displayContent} spoiler={spoiler} />}
|
{!showOriginal && <Markdown content={displayContent} spoiler={spoiler} />}
|
||||||
@@ -205,26 +209,20 @@ const PostMessageMobile = ({ post }: PostProps) => {
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{banned && (
|
|
||||||
<span className={styles.removedContent}>
|
|
||||||
<br />
|
|
||||||
<Tooltip
|
|
||||||
children={`(${t('user_banned')})`}
|
|
||||||
content={t('ban_expires_at', {
|
|
||||||
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress),
|
|
||||||
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
|
|
||||||
interpolation: { escapeValue: false },
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{(removed || deleted) && reason && (
|
{banned && (
|
||||||
<span>
|
<span className={styles.removedContent}>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
reason: {reason}
|
<Tooltip
|
||||||
|
children={`(${t('user_banned')})`}
|
||||||
|
content={`${t('ban_expires_at', {
|
||||||
|
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress),
|
||||||
|
timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
|
||||||
|
interpolation: { escapeValue: false },
|
||||||
|
})}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`}
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
{!isReply && content.length > 1000 && !isInPostView && (
|
{!isReply && content.length > 1000 && !isInPostView && (
|
||||||
|
|||||||
Reference in New Issue
Block a user