mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
pass threadNumber to reply modal store
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user