Fix custom zap opening from context

This commit is contained in:
Bojan Mojsilovic 2024-03-18 15:59:56 +01:00
parent e287eac150
commit 1533d45000
2 changed files with 10 additions and 7 deletions

View File

@ -45,8 +45,6 @@ const NoteContextMenu: Component<{
const position = () => { const position = () => {
return props.data?.position; return props.data?.position;
}; };
const openCustomZap = props.data?.openCustomZap || (() => {});
const openReactions = props.data?.openReactions || (() => {});
createEffect(() => { createEffect(() => {
if(!context) return; if(!context) return;
@ -163,7 +161,7 @@ const NoteContextMenu: Component<{
{ {
label: intl.formatMessage(tActions.noteContext.reactions), label: intl.formatMessage(tActions.noteContext.reactions),
action: () => { action: () => {
openReactions(); props.data?.openReactions && props.data?.openReactions();
props.onClose() props.onClose()
}, },
icon: 'heart', icon: 'heart',
@ -171,7 +169,7 @@ const NoteContextMenu: Component<{
{ {
label: intl.formatMessage(tActions.noteContext.zap), label: intl.formatMessage(tActions.noteContext.zap),
action: () => { action: () => {
openCustomZap(); props.data?.openCustomZap && props.data?.openCustomZap();
props.onClose() props.onClose()
}, },
icon: 'feed_zap', icon: 'feed_zap',

View File

@ -109,12 +109,17 @@ export const AppProvider = (props: { children: JSXElement }) => {
updateStore('showCustomZapModal', () => false); updateStore('showCustomZapModal', () => false);
}; };
const openContextMenu = (note: PrimalNote, position: DOMRect | undefined, openCustomZapModal: () => void, openReactionModal: () => void) => { const openContextMenu = (
note: PrimalNote,
position: DOMRect | undefined,
openCustomZap: () => void,
openReactions: () => void,
) => {
updateStore('noteContextMenuInfo', reconcile({ updateStore('noteContextMenuInfo', reconcile({
note, note,
position, position,
openCustomZapModal, openCustomZap,
openReactionModal, openReactions,
})) }))
updateStore('showNoteContextMenu', () => true); updateStore('showNoteContextMenu', () => true);
}; };