2023-01-02 21:34:41 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import type { AppStateType } from '../ducks/app';
|
|
|
|
import type { StateType } from '../reducer';
|
|
|
|
import { Inbox } from '../../components/Inbox';
|
|
|
|
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';
|
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
|
|
|
}
|
|
|
|
|
|
|
|
export function SmartInbox(): JSX.Element {
|
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const isCustomizingPreferredReactions = useSelector(
|
|
|
|
getIsCustomizingPreferredReactions
|
|
|
|
);
|
2023-03-28 20:31:24 +00:00
|
|
|
const envelopeTimestamp = useSelector<StateType, number | undefined>(
|
|
|
|
state => state.inbox.envelopeTimestamp
|
|
|
|
);
|
|
|
|
const firstEnvelopeTimestamp = useSelector<StateType, number | undefined>(
|
|
|
|
state => state.inbox.firstEnvelopeTimestamp
|
|
|
|
);
|
2023-01-02 21:34:41 +00:00
|
|
|
const { hasInitialLoadCompleted } = useSelector<StateType, AppStateType>(
|
|
|
|
state => state.app
|
|
|
|
);
|
2023-08-09 00:53:06 +00:00
|
|
|
|
|
|
|
const navTabsCollapsed = useSelector(getNavTabsCollapsed);
|
|
|
|
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}
|
|
|
|
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
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|