Support duplicate attachments in lightbox
This commit is contained in:
parent
b885ced90d
commit
1a2976dae4
7 changed files with 35 additions and 45 deletions
|
@ -19,7 +19,7 @@ export type Props = {
|
|||
loadRecentMediaItems: (id: string, limit: number) => void;
|
||||
showAllMedia: () => void;
|
||||
showLightboxWithMedia: (
|
||||
selectedAttachmentPath: string | undefined,
|
||||
selectedIndex: number,
|
||||
media: ReadonlyArray<ReadonlyDeep<MediaItemType>>
|
||||
) => void;
|
||||
};
|
||||
|
@ -66,9 +66,7 @@ export function ConversationDetailsMediaList({
|
|||
key={`${mediaItem.message.id}-${mediaItem.index}`}
|
||||
mediaItem={mediaItem}
|
||||
i18n={i18n}
|
||||
onClick={() =>
|
||||
showLightboxWithMedia(mediaItem.attachment.path, mediaItems)
|
||||
}
|
||||
onClick={() => showLightboxWithMedia(mediaItem.index, mediaItems)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
@ -35,7 +35,7 @@ export function AttachmentSection({
|
|||
const { message, index, attachment } = mediaItem;
|
||||
|
||||
const onClick = () => {
|
||||
onItemClick({ type, message, attachment });
|
||||
onItemClick({ type, message, attachment, index: mediaItem.index });
|
||||
};
|
||||
|
||||
switch (type) {
|
||||
|
|
|
@ -29,7 +29,7 @@ export type Props = {
|
|||
media: Array<MediaItemType>;
|
||||
saveAttachment: SaveAttachmentActionCreatorType;
|
||||
showLightboxWithMedia: (
|
||||
selectedAttachmentPath: string | undefined,
|
||||
selectedIndex: number,
|
||||
media: Array<MediaItemType>
|
||||
) => void;
|
||||
};
|
||||
|
@ -106,7 +106,7 @@ function MediaSection({
|
|||
}
|
||||
|
||||
case 'media': {
|
||||
showLightboxWithMedia(event.attachment.path, media);
|
||||
showLightboxWithMedia(event.index, media);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,5 +7,6 @@ import type { AttachmentType } from '../../../../types/Attachment';
|
|||
export type ItemClickEvent = {
|
||||
message: Pick<MessageAttributesType, 'sent_at'>;
|
||||
attachment: AttachmentType;
|
||||
index: number;
|
||||
type: 'media' | 'documents';
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue