forked from abner/for-legacy-web
fix: add context menu to individual attachments if > 1 attached (#348)
This commit is contained in:
@@ -2,6 +2,7 @@ import { Attachment as AttachmentI } from "revolt-api/types/Autumn";
|
||||
|
||||
import styles from "./Attachment.module.scss";
|
||||
import classNames from "classnames";
|
||||
import { attachContextMenu } from "preact-context-menu";
|
||||
import { useContext, useState } from "preact/hooks";
|
||||
|
||||
import { useIntermediate } from "../../../../context/intermediate/Intermediate";
|
||||
@@ -9,9 +10,9 @@ import { AppContext } from "../../../../context/revoltjs/RevoltClient";
|
||||
|
||||
import AttachmentActions from "./AttachmentActions";
|
||||
import { SizedGrid } from "./Grid";
|
||||
import ImageFile from "./ImageFile";
|
||||
import Spoiler from "./Spoiler";
|
||||
import TextFile from "./TextFile";
|
||||
import ImageFile from "./ImageFile";
|
||||
|
||||
interface Props {
|
||||
attachment: AttachmentI;
|
||||
@@ -37,11 +38,18 @@ export default function Attachment({ attachment, hasContent }: Props) {
|
||||
<SizedGrid
|
||||
width={metadata.width}
|
||||
height={metadata.height}
|
||||
onContextMenu={attachContextMenu("Menu", {
|
||||
attachment: attachment,
|
||||
})}
|
||||
className={classNames({
|
||||
[styles.margin]: hasContent,
|
||||
spoiler,
|
||||
})}>
|
||||
<ImageFile attachment={attachment} width={metadata.width} height={metadata.height} />
|
||||
<ImageFile
|
||||
attachment={attachment}
|
||||
width={metadata.width}
|
||||
height={metadata.height}
|
||||
/>
|
||||
{spoiler && <Spoiler set={setSpoiler} />}
|
||||
</SizedGrid>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user