diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 87ac561fcd9..ccb759e0145 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -8343,5 +8343,9 @@ "icu:WhatsNew__v7.50--0": { "messageformat": "If you link a new Desktop on Signal Android and choose to transfer your message history, now you can also selectively transfer old attachments from your primary device too. Bring the past into the present by scrolling back in time and clicking on the download icon. As always, the transfer process is end-to-end encrypted and secure.", "description": "Release notes for version 7.49" + }, + "icu:jumpto": { + "messageformat": "Jump to", + "description": "Jumps to the medias position in the conversation" } } diff --git a/stylesheets/components/Lightbox.scss b/stylesheets/components/Lightbox.scss index 10376657df7..6a7e6d582fa 100644 --- a/stylesheets/components/Lightbox.scss +++ b/stylesheets/components/Lightbox.scss @@ -360,6 +360,15 @@ } } + &--jump { + &::before { + @include mixins.color-svg( + '../images/icons/v3/chat/chat.svg', + variables.$color-gray-15 + ); + } + } + &--close { &::before { @include mixins.color-svg( diff --git a/ts/components/Lightbox.tsx b/ts/components/Lightbox.tsx index 4a80f806c4c..b0e770d1454 100644 --- a/ts/components/Lightbox.tsx +++ b/ts/components/Lightbox.tsx @@ -13,6 +13,7 @@ import type { ConversationType, SaveAttachmentActionCreatorType, } from '../state/ducks/conversations'; +import { useConversationsActions } from '../state/ducks/conversations'; import type { LocalizerType } from '../types/Util'; import type { MediaItemType } from '../types/MediaItem'; import * as GoogleChrome from '../util/GoogleChrome'; @@ -99,6 +100,7 @@ export function Lightbox({ hasNextMessage, hasPrevMessage, }: PropsType): JSX.Element | null { + const { scrollToMessage } = useConversationsActions(); const hasThumbnails = media.length > 1; const messageId = media.at(0)?.message.id; const prevMessageId = usePrevious(messageId, messageId); @@ -243,6 +245,21 @@ export function Lightbox({ [isViewOnce, media, saveAttachment, selectedIndex] ); + const handleJumpToConversation = useCallback( + ( + _event: KeyboardEvent | React.MouseEvent + ) => { + if (isViewOnce) { + return; + } + const mediaItem = media[selectedIndex]; + const { message } = mediaItem; + const { conversationId, id } = message; + scrollToMessage(conversationId, id); + }, + [isViewOnce, media, selectedIndex, scrollToMessage] + ); + const handleForward = ( event: React.MouseEvent ) => { @@ -726,6 +743,14 @@ export function Lightbox({
)}
+ {!isViewOnce ? ( +