1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-22 10:22:30 +01:00

move message context menu trigger

This commit is contained in:
Puyodead1 2023-12-18 11:46:55 -05:00
parent 4d61a6059d
commit 8022c5146c
No known key found for this signature in database
GPG Key ID: BA5F91AAEF68E5CE
2 changed files with 25 additions and 25 deletions

View File

@ -30,7 +30,16 @@ function Message({ message, header }: Props) {
message.mention_roles.some((role) => guild.members.me?.roles.some((role) => role.id === role.id)); message.mention_roles.some((role) => guild.members.me?.roles.some((role) => role.id === role.id));
return ( return (
<MessageBase header={header} mention={isEveryoneMentioned || isUserMentioned || isRoleMentioned}> <MessageBase
header={header}
mention={isEveryoneMentioned || isUserMentioned || isRoleMentioned}
onContextMenu={(e) =>
contextMenuContext.onContextMenu(e, {
type: "message",
message: message,
})
}
>
<MessageInfo> <MessageInfo>
{header ? ( {header ? (
<Avatar key={message.author.id} user={message.author} size={40} /> <Avatar key={message.author.id} user={message.author} size={40} />
@ -45,31 +54,21 @@ function Message({ message, header }: Props) {
<MessageDetails message={message} position="top" /> <MessageDetails message={message} position="top" />
</span> </span>
)} )}
<div
onContextMenu={(e) =>
contextMenuContext.onContextMenu(e, {
type: "message",
message: message,
})
}
>
<MessageContentText
sending={"status" in message && message.status === QueuedMessageStatus.SENDING}
failed={"status" in message && message.status === QueuedMessageStatus.FAILED}
>
{message.content && <Markdown content={message.content} />}
</MessageContentText>
{"attachments" in message && <MessageContentText
message.attachments.map((attachment, index) => ( sending={"status" in message && message.status === QueuedMessageStatus.SENDING}
<MessageAttachment key={index} attachment={attachment} /> failed={"status" in message && message.status === QueuedMessageStatus.FAILED}
))} >
{"embeds" in message && {message.content && <Markdown content={message.content} />}
message.embeds?.map((embed, index) => <MessageEmbed key={index} embed={embed} />)} </MessageContentText>
{"files" in message && message.files?.length !== 0 && (
<AttachmentUploadProgress message={message} /> {"attachments" in message &&
)} message.attachments.map((attachment, index) => (
</div> <MessageAttachment key={index} attachment={attachment} />
))}
{"embeds" in message &&
message.embeds?.map((embed, index) => <MessageEmbed key={index} embed={embed} />)}
{"files" in message && message.files?.length !== 0 && <AttachmentUploadProgress message={message} />}
</MessageContent> </MessageContent>
</MessageBase> </MessageBase>
); );

View File

@ -62,6 +62,7 @@ export default function () {
function onContextMenu(e: React.MouseEvent, props: ContextMenuProps) { function onContextMenu(e: React.MouseEvent, props: ContextMenuProps) {
e.preventDefault(); e.preventDefault();
e.stopPropagation();
data.refs.setPositionReference({ data.refs.setPositionReference({
getBoundingClientRect() { getBoundingClientRect() {