1
0
mirror of https://github.com/spacebarchat/client.git synced 2024-11-26 04:02:46 +01:00

proper variable name

This commit is contained in:
Puyodead1 2023-09-02 22:56:58 -04:00
parent 1fb1392d58
commit ff37abd9b9
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC

View File

@ -31,7 +31,7 @@ export default function MessageAttachment({ attachment, contextMenuItems, maxWid
const url = attachment.proxy_url && attachment.proxy_url.length > 0 ? attachment.proxy_url : attachment.url; const url = attachment.proxy_url && attachment.proxy_url.length > 0 ? attachment.proxy_url : attachment.url;
let a: JSX.Element = <></>; let finalElement: JSX.Element = <></>;
if (attachment.content_type?.startsWith("image")) { if (attachment.content_type?.startsWith("image")) {
const ratio = calculateImageRatio(attachment.width!, attachment.height!, maxWidth, maxHeight); const ratio = calculateImageRatio(attachment.width!, attachment.height!, maxWidth, maxHeight);
const { scaledWidth, scaledHeight } = calculateScaledDimensions( const { scaledWidth, scaledHeight } = calculateScaledDimensions(
@ -41,12 +41,12 @@ export default function MessageAttachment({ attachment, contextMenuItems, maxWid
maxWidth, maxWidth,
maxHeight, maxHeight,
); );
a = <Image src={url} alt={attachment.filename} width={scaledWidth} height={scaledHeight} />; finalElement = <Image src={url} alt={attachment.filename} width={scaledWidth} height={scaledHeight} />;
} else if (attachment.content_type?.startsWith("video")) { } else if (attachment.content_type?.startsWith("video")) {
{ {
/* TODO: poster thumbnail */ /* TODO: poster thumbnail */
} }
a = ( finalElement = (
<video playsInline controls preload="metadata" height={400}> <video playsInline controls preload="metadata" height={400}>
{/* TODO: the server doesn't return height and width yet for videos */} {/* TODO: the server doesn't return height and width yet for videos */}
<source src={url} type={attachment.content_type} /> <source src={url} type={attachment.content_type} />
@ -86,7 +86,7 @@ export default function MessageAttachment({ attachment, contextMenuItems, maxWid
openModal(AttachmentPreviewModal, { attachment }); openModal(AttachmentPreviewModal, { attachment });
}} }}
> >
{a} {finalElement}
</Attachment> </Attachment>
); );
} }