mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
refactor: use post number instead of shortCid in reply modal and quote previews
This commit is contained in:
@@ -3,7 +3,6 @@ import { useLocation, useParams } from 'react-router-dom';
|
||||
import { Trans, useTranslation } from 'react-i18next';
|
||||
import { setAccount, useAccount } from '@plebbit/plebbit-react-hooks';
|
||||
import useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits';
|
||||
import Plebbit from '@plebbit/plebbit-js';
|
||||
import { formatMarkdown } from '../../lib/utils/post-utils';
|
||||
import { getFormattedTimeAgo } from '../../lib/utils/time-utils';
|
||||
import { isValidURL } from '../../lib/utils/url-utils';
|
||||
@@ -25,12 +24,14 @@ interface ReplyModalProps {
|
||||
closeModal: () => void;
|
||||
showReplyModal: boolean;
|
||||
parentCid: string;
|
||||
parentNumber: number | null;
|
||||
postNumber: number | null;
|
||||
postCid: string;
|
||||
scrollY: number;
|
||||
subplebbitAddress: string;
|
||||
}
|
||||
|
||||
const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, subplebbitAddress }: ReplyModalProps) => {
|
||||
const ReplyModal = ({ closeModal, showReplyModal, parentCid, parentNumber, postNumber, postCid, scrollY, subplebbitAddress }: ReplyModalProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { setPublishReplyOptions, publishReply, resetPublishReplyOptions, replyIndex } = usePublishReply({
|
||||
cid: parentCid,
|
||||
@@ -178,7 +179,7 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
}
|
||||
}, []);
|
||||
|
||||
const contentPrefix = `>>${parentCid && Plebbit.getShortCid({ cid: parentCid })}\n`;
|
||||
const contentPrefix = `>>${parentNumber ?? '?'}\n`;
|
||||
|
||||
// enable spellcheck after the prefix is set
|
||||
useEffect(() => {
|
||||
@@ -259,7 +260,7 @@ const ReplyModal = ({ closeModal, showReplyModal, parentCid, postCid, scrollY, s
|
||||
}}
|
||||
>
|
||||
<div className={`replyModalHandle ${styles.title}`} {...(!isMobile ? bind() : {})}>
|
||||
{t('reply_to_cid', { cid: `CID:${parentCid && Plebbit.getShortCid({ cid: parentCid })}`, interpolation: { escapeValue: false } })}
|
||||
{t('reply_to_no', { no: postNumber ?? '?' })}
|
||||
<button
|
||||
className={styles.closeIcon}
|
||||
onClick={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user