From 2fa748a4709148497cc10f2c6dff6e290675a054 Mon Sep 17 00:00:00 2001 From: Ginger <75683114+gingershaped@users.noreply.github.com> Date: Thu, 6 Mar 2025 13:06:30 -0500 Subject: [PATCH] Make it possible to mark videos as spoilers --- src/app/components/RenderMessageContent.tsx | 91 +++++++++---------- .../components/message/MsgTypeRenderers.tsx | 4 + .../message/content/VideoContent.tsx | 49 +++++++++- .../upload-card/UploadCardRenderer.tsx | 2 +- src/app/features/room/msgContent.ts | 3 +- 5 files changed, 95 insertions(+), 54 deletions(-) diff --git a/src/app/components/RenderMessageContent.tsx b/src/app/components/RenderMessageContent.tsx index 55b0ffc2..0c37f322 100644 --- a/src/app/components/RenderMessageContent.tsx +++ b/src/app/components/RenderMessageContent.tsx @@ -29,7 +29,7 @@ import { ImageViewer } from './image-viewer'; import { PdfViewer } from './Pdf-viewer'; import { TextViewer } from './text-viewer'; import { testMatrixTo } from '../plugins/matrix-to'; -import {IImageContent} from "../../types/matrix/common"; +import { IImageContent } from '../../types/matrix/common'; type RenderMessageContentProps = { displayName: string; @@ -70,7 +70,7 @@ export function RenderMessageContent({ }; const renderCaption = () => { const content: IImageContent = getContent(); - if(content.filename && content.filename !== content.body) { + if (content.filename && content.filename !== content.body) { return ( - ) + ); } return null; - } + }; const renderFile = () => ( <> ( - ( - } - /> - )} - renderAsTextFile={() => ( - } - /> - )} - > - - - + ( + } + /> + )} + renderAsTextFile={() => ( + } + /> + )} + > + + )} outlined={outlineAttachment} /> @@ -188,12 +187,12 @@ export function RenderMessageContent({ ( - } - renderViewer={(p) => } - /> + } + renderViewer={(p) => } + /> )} outlined={outlineAttachment} /> @@ -208,23 +207,21 @@ export function RenderMessageContent({ ( + renderVideoContent={({ body, info, ...props }) => ( ( - ( - {body} - )} - /> - ) + ( + {body} + )} + /> + ) : undefined } renderVideo={(p) =>