From 6e0ea6f79b8ba82e13bb9c76193fa32689827e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deborah=20K=C3=B6pfer?= Date: Thu, 11 Jul 2024 16:27:59 +0200 Subject: [PATCH 1/3] fix(attachments): fix label color and make attachment area clickable --- src/components/message/MessageAttachment.tsx | 66 ++++++++++++------- src/components/message/message.styles.scss | 15 ++--- .../resources/styles/_overwrites.scss | 14 ++-- 3 files changed, 58 insertions(+), 37 deletions(-) diff --git a/src/components/message/MessageAttachment.tsx b/src/components/message/MessageAttachment.tsx index ecfb87277..01eecf779 100644 --- a/src/components/message/MessageAttachment.tsx +++ b/src/components/message/MessageAttachment.tsx @@ -6,7 +6,7 @@ import { import { ReactComponent as DownloadIcon } from '../../resources/img/icons/download.svg'; import { useTranslation } from 'react-i18next'; import { apiUrl } from '../../resources/scripts/endpoints'; -import { useCallback } from 'react'; +import { useCallback, useRef } from 'react'; import { FETCH_METHODS, fetchData } from '../../api'; import { decryptAttachment, @@ -54,6 +54,7 @@ export const MessageAttachment = (props: MessageAttachmentProps) => { const [attachmentStatus, setAttachmentStatus] = React.useState( props.t === 'e2e' ? ENCRYPTED : NOT_ENCRYPTED ); + const currentDownloadLink = useRef(); const decryptFile = useCallback( async (url: string) => { @@ -151,6 +152,18 @@ export const MessageAttachment = (props: MessageAttachmentProps) => { return null; }, []); + const attachmentAriaLabel = () => { + if ( + props.t === 'e2e' && + encryptedFile && + attachmentStatus === DECRYPTION_FINISHED + ) + return translate('e2ee.attachment.save'); + else if (props.t === 'e2e' && attachmentStatus != DECRYPTION_FINISHED) + return translate(`e2ee.attachment.${attachmentStatus}`); + else return translate('attachments.download.label'); + }; + return (
{ : '' } > -
+
+ {props.t === 'e2e' && ( <> {encryptedFile && - attachmentStatus === DECRYPTION_FINISHED ? ( + attachmentStatus === DECRYPTION_FINISHED ? ( { ) : (