) => {
const moreMenuHeight = 10 * 16
setForceOpen(true)
openModal({
content: ,
onClose: () => setForceOpen(false),
})
}, [evt, roomCtx, setForceOpen, openModal])
const isEditing = useEventAsState(roomCtx.isEditing)
const isPending = evt.event_id.startsWith("~")
const pendingTitle = isPending ? "Can't action messages that haven't been sent yet" : undefined
// TODO should these subscribe to the store?
const plEvent = roomCtx.store.getStateEvent("m.room.power_levels", "")
const encryptionEvent = roomCtx.store.getStateEvent("m.room.encryption", "")
const isEncrypted = encryptionEvent?.content?.algorithm === "m.megolm.v1.aes-sha2"
const pls = (plEvent?.content ?? {}) as PowerLevelEventContent
const ownPL = pls.users?.[userID] ?? pls.users_default ?? 0
const reactPL = pls.events?.["m.reaction"] ?? pls.events_default ?? 0
const evtSendType = isEncrypted ? "m.room.encrypted" : evt.type === "m.sticker" ? "m.sticker" : "m.room.message"
const messageSendPL = pls.events?.[evtSendType] ?? pls.events_default ?? 0
const canSend = ownPL >= messageSendPL
const canEdit = canSend
&& evt.sender === userID
&& evt.type === "m.room.message"
&& evt.relation_type !== "m.replace"
&& !evt.redacted_by
const canReact = ownPL >= reactPL
return
{canReact && }
{canSend && }
{canEdit && }
}
export default EventMenu