update composer

This commit is contained in:
Ren Amamiya
2023-07-08 15:21:06 +07:00
parent 3752a3ab0f
commit 4747299ade
6 changed files with 54 additions and 68 deletions

View File

@@ -3,35 +3,22 @@ import { create } from 'zustand';
interface ComposerState {
open: boolean;
reply: { id: string; root: string; pubkey: string };
repost: { id: string; pubkey: string };
toggleModal: (status: boolean) => void;
setReply: (id: string, root: string, pubkey: string) => void;
setRepost: (id: string, pubkey: string) => void;
clearReply: () => void;
clearRepost: () => void;
}
export const useComposer = create<ComposerState>((set) => ({
open: false,
reply: { id: null, root: null, pubkey: null },
repost: { id: null, pubkey: null },
toggleModal: (status: boolean) => {
set({ open: status });
},
setReply: (id: string, root: string, pubkey: string) => {
set({ reply: { id: id, root: root, pubkey: pubkey } });
set({ repost: { id: null, pubkey: null } });
set({ open: true });
},
setRepost: (id: string, pubkey: string) => {
set({ repost: { id: id, pubkey: pubkey } });
set({ reply: { id: null, root: null, pubkey: null } });
set({ open: true });
},
clearReply: () => {
set({ reply: { id: null, root: null, pubkey: null } });
},
clearRepost: () => {
set({ repost: { id: null, pubkey: null } });
},
}));