fix(replymodal): replying didn't work from multiboard feeds (p/all, p/subscriptions)

This commit is contained in:
Tom (plebeius.eth)
2024-08-14 10:23:47 +02:00
parent f7bab7c83e
commit f6548cc2b8
6 changed files with 31 additions and 11 deletions
+4 -2
View File
@@ -6,6 +6,7 @@ const useReplyModal = () => {
const [showReplyModal, setShowReplyModal] = useState(false);
const [activeCid, setActiveCid] = useState<string | null>(null);
const [threadCid, setThreadCid] = useState<string | null>(null);
const [subplebbitAddress, setSubplebbitAddress] = useState<string | null>(null);
const { resetSelectedText, setSelectedText } = useSelectedTextStore();
// on mobile, the css position is absolute instead of fixed, so we need to calculate the top position
@@ -23,7 +24,7 @@ const useReplyModal = () => {
text && setSelectedText(`>${text}\n`);
};
const openReplyModal = (parentCid: string, postCid: string) => {
const openReplyModal = (parentCid: string, postCid: string, subplebbitAddress: string) => {
getSelectedText();
if (isMobile) {
@@ -37,9 +38,10 @@ const useReplyModal = () => {
setActiveCid(parentCid);
setThreadCid(postCid);
setShowReplyModal(true);
setSubplebbitAddress(subplebbitAddress);
};
return { activeCid, threadCid, closeModal, openReplyModal, scrollY, showReplyModal };
return { activeCid, threadCid, closeModal, openReplyModal, scrollY, showReplyModal, subplebbitAddress };
};
export default useReplyModal;