diff --git a/web/modals/threads/gallery/thread-settings-media-gallery.react.js b/web/modals/threads/gallery/thread-settings-media-gallery.react.js --- a/web/modals/threads/gallery/thread-settings-media-gallery.react.js +++ b/web/modals/threads/gallery/thread-settings-media-gallery.react.js @@ -14,12 +14,27 @@ import GalleryItem from './thread-settings-media-gallery-item.react.js'; import css from './thread-settings-media-gallery.css'; -import Tabs from '../../../components/tabs-legacy.react.js'; +import Tabs, { type TabData } from '../../../components/tabs.react.js'; import MultimediaModal from '../../../media/multimedia-modal.react.js'; import Modal from '../../modal.react.js'; type MediaGalleryTab = 'All' | 'Images' | 'Videos'; +const tabsData: $ReadOnlyArray> = [ + { + id: 'All', + header: 'All', + }, + { + id: 'Images', + header: 'Images', + }, + { + id: 'Videos', + header: 'Videos', + }, +]; + type ThreadSettingsMediaGalleryModalProps = { +onClose: () => void, +parentThreadInfo: ThreadInfo, @@ -39,6 +54,11 @@ const [mediaInfos, setMediaInfos] = React.useState<$ReadOnlyArray>([]); const [tab, setTab] = React.useState(activeTab); + const tabs = React.useMemo( + () => , + [tab], + ); + React.useEffect(() => { const fetchData = async () => { const result = await callFetchThreadMedia({ @@ -166,27 +186,26 @@ [callFetchThreadMedia, threadID, limit, mediaInfos], ); - return ( - - - -
- {mediaGalleryItems} -
-
- -
- {mediaGalleryItems} -
-
- -
- {mediaGalleryItems} -
-
-
-
+ const tabContent = React.useMemo( + () => ( +
+ {mediaGalleryItems} +
+ ), + [handleScroll, mediaGalleryItems], ); + + const threadSettingsMediaGalleryModal = React.useMemo( + () => ( + + {tabs} + {tabContent} + + ), + [onClose, tabContent, tabs], + ); + + return threadSettingsMediaGalleryModal; } export default ThreadSettingsMediaGalleryModal;