pass threadNumber to reply modal store

This commit is contained in:
plebeius
2025-12-28 22:16:38 +01:00
parent bf2c7ae61b
commit c094786f97
6 changed files with 28 additions and 22 deletions
+6 -2
View File
@@ -5,17 +5,19 @@ interface ReplyModalState {
showReplyModal: boolean;
activeCid: string | null;
parentNumber: number | null;
threadNumber: number | null;
threadCid: string | null;
subplebbitAddress: string | null;
scrollY: number;
closeModal: () => void;
openReplyModal: (parentCid: string, parentNumber: number | undefined, postCid: string, subplebbitAddress: string) => void;
openReplyModal: (parentCid: string, parentNumber: number | undefined, postCid: string, threadNumber: number | undefined, subplebbitAddress: string) => void;
}
const useReplyModalStore = create<ReplyModalState>((set, get) => ({
showReplyModal: false,
activeCid: null,
parentNumber: null,
threadNumber: null,
threadCid: null,
subplebbitAddress: null,
scrollY: 0,
@@ -27,10 +29,11 @@ const useReplyModalStore = create<ReplyModalState>((set, get) => ({
showReplyModal: false,
activeCid: null,
parentNumber: null,
threadNumber: null,
});
},
openReplyModal: (parentCid, parentNumber, postCid, subplebbitAddress) => {
openReplyModal: (parentCid, parentNumber, postCid, threadNumber, subplebbitAddress) => {
// Don't update if already open with different parent
if (get().activeCid && get().activeCid !== parentCid) {
window.alert('Multiple quotes are not possible on 5chan for the time being, because of a protocol limitation. Please reply to one post at a time.');
@@ -50,6 +53,7 @@ const useReplyModalStore = create<ReplyModalState>((set, get) => ({
set({
activeCid: parentCid,
parentNumber: parentNumber ?? null,
threadNumber: threadNumber ?? null,
threadCid: postCid,
showReplyModal: true,
subplebbitAddress,