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