feat: implement post numbers

This commit is contained in:
plebeius
2025-12-24 18:07:14 +01:00
parent e56ba3d050
commit 76845412e8
2 changed files with 8 additions and 25 deletions
+3 -3
View File
@@ -52,7 +52,7 @@ const useShowOmittedReplies = create<ShowOmittedRepliesState>((set) => ({
const PostInfo = ({ post, postReplyCount = 0, roles, isHidden }: PostProps) => { const PostInfo = ({ post, postReplyCount = 0, roles, isHidden }: PostProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { author, cid, deleted, locked, pinned, parentCid, postCid, reason, removed, shortCid, state, subplebbitAddress, timestamp } = post || {}; const { author, cid, deleted, locked, pinned, parentCid, postCid, reason, removed, state, subplebbitAddress, timestamp } = post || {};
const title = post?.title?.trim(); const title = post?.title?.trim();
const replies = useReplies(post); const replies = useReplies(post);
const { address, shortAddress } = author || {}; const { address, shortAddress } = author || {};
@@ -176,10 +176,10 @@ const PostInfo = ({ post, postReplyCount = 0, roles, isHidden }: PostProps) => {
title={t('link_to_post')} title={t('link_to_post')}
onClick={(e) => !cid && e.preventDefault()} onClick={(e) => !cid && e.preventDefault()}
> >
CID: No.
</Link> </Link>
<span className={styles.replyToPost} title={t('reply_to_post')} onMouseDown={onReplyModalClick}> <span className={styles.replyToPost} title={t('reply_to_post')} onMouseDown={onReplyModalClick}>
{shortCid} {post?.number || '?'}
</span> </span>
</span> </span>
) : ( ) : (
+5 -22
View File
@@ -32,25 +32,8 @@ import { selectPostMenuProps } from '../../lib/utils/post-menu-props';
const PostInfoAndMedia = ({ post, postReplyCount = 0, roles }: PostProps) => { const PostInfoAndMedia = ({ post, postReplyCount = 0, roles }: PostProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const defaultSubplebbits = useDefaultSubplebbits(); const defaultSubplebbits = useDefaultSubplebbits();
const { const { author, cid, deleted, link, linkHeight, linkWidth, locked, parentCid, pinned, postCid, reason, removed, state, subplebbitAddress, timestamp, thumbnailUrl } =
author, post || {};
cid,
deleted,
link,
linkHeight,
linkWidth,
locked,
parentCid,
pinned,
postCid,
reason,
removed,
shortCid,
state,
subplebbitAddress,
timestamp,
thumbnailUrl,
} = post || {};
const boardPath = subplebbitAddress ? getBoardPath(subplebbitAddress, defaultSubplebbits) : undefined; const boardPath = subplebbitAddress ? getBoardPath(subplebbitAddress, defaultSubplebbits) : undefined;
const isReply = parentCid; const isReply = parentCid;
const title = post?.title?.trim(); const title = post?.title?.trim();
@@ -117,7 +100,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles }: PostProps) => {
) )
) : ( ) : (
_.capitalize(t('anonymous')) _.capitalize(t('anonymous'))
)} )}{' '}
{!(deleted || removed) && authorRole && ( {!(deleted || removed) && authorRole && (
<span className='capitalize'> <span className='capitalize'>
{' '} {' '}
@@ -198,10 +181,10 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles }: PostProps) => {
title={t('link_to_post')} title={t('link_to_post')}
onClick={(e) => !cid && e.preventDefault()} onClick={(e) => !cid && e.preventDefault()}
> >
CID: No.
</Link> </Link>
<span className={styles.replyToPost} title={t('reply_to_post')} onMouseDown={onReplyModalClick}> <span className={styles.replyToPost} title={t('reply_to_post')} onMouseDown={onReplyModalClick}>
{shortCid.slice(0, -4)} {post?.number || '?'}
</span> </span>
</span> </span>
) : ( ) : (