2022-12-20 12:50:23 -05:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
2024-03-13 13:44:13 -07:00
|
|
|
import React, { memo } from 'react';
|
2022-12-20 12:50:23 -05:00
|
|
|
import { useSelector } from 'react-redux';
|
2025-09-16 17:39:03 -07:00
|
|
|
import { MediaGallery } from '../../components/conversation/media-gallery/MediaGallery.js';
|
|
|
|
import { getMediaGalleryState } from '../selectors/mediaGallery.js';
|
|
|
|
import { getIntl, getTheme } from '../selectors/user.js';
|
|
|
|
import { useConversationsActions } from '../ducks/conversations.js';
|
|
|
|
import { useLightboxActions } from '../ducks/lightbox.js';
|
|
|
|
import { useMediaGalleryActions } from '../ducks/mediaGallery.js';
|
2022-12-20 12:50:23 -05:00
|
|
|
|
|
|
|
export type PropsType = {
|
|
|
|
conversationId: string;
|
|
|
|
};
|
|
|
|
|
2024-03-13 13:44:13 -07:00
|
|
|
export const SmartAllMedia = memo(function SmartAllMedia({
|
|
|
|
conversationId,
|
|
|
|
}: PropsType) {
|
2024-09-05 07:15:30 +10:00
|
|
|
const { media, documents, haveOldestDocument, haveOldestMedia, loading } =
|
|
|
|
useSelector(getMediaGalleryState);
|
|
|
|
const { initialLoad, loadMoreMedia, loadMoreDocuments } =
|
|
|
|
useMediaGalleryActions();
|
2025-09-10 13:25:21 -07:00
|
|
|
const {
|
|
|
|
saveAttachment,
|
|
|
|
kickOffAttachmentDownload,
|
|
|
|
cancelAttachmentDownload,
|
|
|
|
} = useConversationsActions();
|
2024-09-05 07:15:30 +10:00
|
|
|
const { showLightbox } = useLightboxActions();
|
2025-09-10 13:25:21 -07:00
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const theme = useSelector(getTheme);
|
2022-12-20 12:50:23 -05:00
|
|
|
|
|
|
|
return (
|
|
|
|
<MediaGallery
|
|
|
|
conversationId={conversationId}
|
2024-09-05 07:15:30 +10:00
|
|
|
haveOldestDocument={haveOldestDocument}
|
|
|
|
haveOldestMedia={haveOldestMedia}
|
2025-09-10 13:25:21 -07:00
|
|
|
i18n={i18n}
|
|
|
|
theme={theme}
|
2024-09-05 07:15:30 +10:00
|
|
|
initialLoad={initialLoad}
|
|
|
|
loading={loading}
|
|
|
|
loadMoreMedia={loadMoreMedia}
|
|
|
|
loadMoreDocuments={loadMoreDocuments}
|
2022-12-20 12:50:23 -05:00
|
|
|
media={media}
|
|
|
|
documents={documents}
|
2024-09-05 07:15:30 +10:00
|
|
|
showLightbox={showLightbox}
|
2025-09-10 13:25:21 -07:00
|
|
|
kickOffAttachmentDownload={kickOffAttachmentDownload}
|
|
|
|
cancelAttachmentDownload={cancelAttachmentDownload}
|
2022-12-20 12:50:23 -05:00
|
|
|
saveAttachment={saveAttachment}
|
|
|
|
/>
|
|
|
|
);
|
2024-03-13 13:44:13 -07:00
|
|
|
});
|