2023-01-02 21:34:41 +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';
|
2023-01-02 21:34:41 +00:00
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import { Inbox } from '../../components/Inbox';
|
2024-07-03 21:15:54 +00:00
|
|
|
import { isAlpha } from '../../util/version';
|
2023-01-02 21:34:41 +00:00
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
import { SmartCustomizingPreferredReactionsModal } from './CustomizingPreferredReactionsModal';
|
|
|
|
import { getIsCustomizingPreferredReactions } from '../selectors/preferredReactions';
|
2023-08-09 00:53:06 +00:00
|
|
|
import type { SmartNavTabsProps } from './NavTabs';
|
|
|
|
import { SmartNavTabs } from './NavTabs';
|
|
|
|
import { SmartStoriesTab } from './StoriesTab';
|
|
|
|
import { SmartCallsTab } from './CallsTab';
|
|
|
|
import { useItemsActions } from '../ducks/items';
|
|
|
|
import { getNavTabsCollapsed } from '../selectors/items';
|
|
|
|
import { SmartChatsTab } from './ChatsTab';
|
2024-03-15 14:38:26 +00:00
|
|
|
import { getHasInitialLoadCompleted } from '../selectors/app';
|
|
|
|
import {
|
|
|
|
getInboxEnvelopeTimestamp,
|
|
|
|
getInboxFirstEnvelopeTimestamp,
|
|
|
|
} from '../selectors/inbox';
|
2023-01-02 21:34:41 +00:00
|
|
|
|
2023-08-09 00:53:06 +00:00
|
|
|
function renderChatsTab() {
|
|
|
|
return <SmartChatsTab />;
|
|
|
|
}
|
|
|
|
|
|
|
|
function renderCallsTab() {
|
|
|
|
return <SmartCallsTab />;
|
2023-01-02 21:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function renderCustomizingPreferredReactionsModal() {
|
|
|
|
return <SmartCustomizingPreferredReactionsModal />;
|
|
|
|
}
|
|
|
|
|
2023-08-09 00:53:06 +00:00
|
|
|
function renderNavTabs(props: SmartNavTabsProps) {
|
|
|
|
return <SmartNavTabs {...props} />;
|
2023-03-20 18:03:21 +00:00
|
|
|
}
|
|
|
|
|
2023-08-09 00:53:06 +00:00
|
|
|
function renderStoriesTab() {
|
|
|
|
return <SmartStoriesTab />;
|
2023-01-02 21:34:41 +00:00
|
|
|
}
|
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export const SmartInbox = memo(function SmartInbox(): JSX.Element {
|
2023-01-02 21:34:41 +00:00
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const isCustomizingPreferredReactions = useSelector(
|
|
|
|
getIsCustomizingPreferredReactions
|
|
|
|
);
|
2024-03-15 14:38:26 +00:00
|
|
|
const envelopeTimestamp = useSelector(getInboxEnvelopeTimestamp);
|
|
|
|
const firstEnvelopeTimestamp = useSelector(getInboxFirstEnvelopeTimestamp);
|
|
|
|
const hasInitialLoadCompleted = useSelector(getHasInitialLoadCompleted);
|
2023-08-09 00:53:06 +00:00
|
|
|
const navTabsCollapsed = useSelector(getNavTabsCollapsed);
|
2024-03-15 14:38:26 +00:00
|
|
|
|
2023-08-09 00:53:06 +00:00
|
|
|
const { toggleNavTabsCollapse } = useItemsActions();
|
2023-01-02 21:34:41 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Inbox
|
2023-03-28 20:31:24 +00:00
|
|
|
envelopeTimestamp={envelopeTimestamp}
|
|
|
|
firstEnvelopeTimestamp={firstEnvelopeTimestamp}
|
2023-01-02 21:34:41 +00:00
|
|
|
hasInitialLoadCompleted={hasInitialLoadCompleted}
|
|
|
|
i18n={i18n}
|
2024-07-03 21:15:54 +00:00
|
|
|
isAlpha={isAlpha(window.getVersion())}
|
2023-01-02 21:34:41 +00:00
|
|
|
isCustomizingPreferredReactions={isCustomizingPreferredReactions}
|
2023-08-09 00:53:06 +00:00
|
|
|
navTabsCollapsed={navTabsCollapsed}
|
|
|
|
onToggleNavTabsCollapse={toggleNavTabsCollapse}
|
|
|
|
renderChatsTab={renderChatsTab}
|
|
|
|
renderCallsTab={renderCallsTab}
|
2023-01-02 21:34:41 +00:00
|
|
|
renderCustomizingPreferredReactionsModal={
|
|
|
|
renderCustomizingPreferredReactionsModal
|
|
|
|
}
|
2023-08-09 00:53:06 +00:00
|
|
|
renderNavTabs={renderNavTabs}
|
|
|
|
renderStoriesTab={renderStoriesTab}
|
2023-01-02 21:34:41 +00:00
|
|
|
/>
|
|
|
|
);
|
2024-03-13 20:44:13 +00:00
|
|
|
});
|