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

View File

@ -109,12 +109,17 @@ export const AppProvider = (props: { children: JSXElement }) => {
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({
note,
position,
openCustomZapModal,
openReactionModal,
openCustomZap,
openReactions,
}))
updateStore('showNoteContextMenu', () => true);
};