From ec634f4fa1c52dd6940b6e5a4250f094e958365f Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 2 Feb 2023 13:54:36 -0600 Subject: [PATCH] ChatUpload: allow clicking upload to view in modal --- .../features/chats/components/chat-upload.tsx | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/app/soapbox/features/chats/components/chat-upload.tsx b/app/soapbox/features/chats/components/chat-upload.tsx index 4b0272fc9..f3736b210 100644 --- a/app/soapbox/features/chats/components/chat-upload.tsx +++ b/app/soapbox/features/chats/components/chat-upload.tsx @@ -1,7 +1,11 @@ +import clsx from 'clsx'; +import { List as ImmutableList } from 'immutable'; import React from 'react'; +import { openModal } from 'soapbox/actions/modals'; import Blurhash from 'soapbox/components/blurhash'; import { Icon } from 'soapbox/components/ui'; +import { useAppDispatch } from 'soapbox/hooks'; import type { Attachment } from 'soapbox/types/entities'; @@ -12,20 +16,32 @@ interface IChatUpload { /** An attachment uploaded to the chat composer, before sending. */ const ChatUpload: React.FC = ({ attachment, onDelete }) => { + const dispatch = useAppDispatch(); + const clickable = attachment.type !== 'unknown'; + + const handleOpenModal = () => { + dispatch(openModal('MEDIA', { media: ImmutableList.of(attachment), index: 0 })); + }; + return ( -
+
- +
); };