signal-desktop/ts/components/ChatsTab.tsx

78 lines
2.3 KiB
TypeScript
Raw Normal View History

2023-08-09 00:53:06 +00:00
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import type { LocalizerType } from '../types/I18N';
import type { NavTabPanelProps } from './NavTabs';
import { WhatsNewLink } from './WhatsNewLink';
import type { UnreadStats } from '../util/countUnreadStats';
2023-08-09 00:53:06 +00:00
2024-11-06 02:05:24 +00:00
export type ChatsTabProps = Readonly<{
2023-08-21 20:12:27 +00:00
otherTabsUnreadStats: UnreadStats;
2023-08-09 00:53:06 +00:00
i18n: LocalizerType;
2024-09-04 18:12:45 +00:00
isStaging: boolean;
hasPendingUpdate: boolean;
hasFailedStorySends: boolean;
2023-08-09 00:53:06 +00:00
navTabsCollapsed: boolean;
onToggleNavTabsCollapse: (navTabsCollapsed: boolean) => void;
renderConversationView: () => JSX.Element;
renderLeftPane: (props: NavTabPanelProps) => JSX.Element;
renderMiniPlayer: (options: { shouldFlow: boolean }) => JSX.Element;
selectedConversationId: string | undefined;
showWhatsNewModal: () => unknown;
}>;
export function ChatsTab({
2023-08-21 20:12:27 +00:00
otherTabsUnreadStats,
2023-08-09 00:53:06 +00:00
i18n,
2024-09-04 18:12:45 +00:00
isStaging,
hasPendingUpdate,
hasFailedStorySends,
2023-08-09 00:53:06 +00:00
navTabsCollapsed,
onToggleNavTabsCollapse,
renderConversationView,
renderLeftPane,
renderMiniPlayer,
selectedConversationId,
showWhatsNewModal,
}: ChatsTabProps): JSX.Element {
return (
<>
<div id="LeftPane">
{renderLeftPane({
2023-08-21 20:12:27 +00:00
otherTabsUnreadStats,
2023-08-09 00:53:06 +00:00
collapsed: navTabsCollapsed,
hasPendingUpdate,
hasFailedStorySends,
2023-08-09 00:53:06 +00:00
onToggleCollapse: onToggleNavTabsCollapse,
})}
</div>
<div className="Inbox__conversation-stack">
<div id="toast" />
2024-02-14 18:39:06 +00:00
{selectedConversationId ? (
2023-08-09 00:53:06 +00:00
<div
className="Inbox__conversation"
id={`conversation-${selectedConversationId}`}
>
{renderConversationView()}
</div>
2024-02-14 18:39:06 +00:00
) : (
2023-08-09 00:53:06 +00:00
<div className="Inbox__no-conversation-open">
{renderMiniPlayer({ shouldFlow: false })}
2024-11-06 02:05:24 +00:00
<div className="module-splash-screen__logo module-splash-screen__logo--96" />
2024-08-13 23:34:42 +00:00
<h3 className="Inbox__welcome">
2024-09-04 18:12:45 +00:00
{isStaging
? 'THIS IS A STAGING DESKTOP'
: i18n('icu:welcomeToSignal')}
2023-08-09 00:53:06 +00:00
</h3>
2024-08-13 23:34:42 +00:00
<p className="Inbox__whatsnew">
2023-08-09 00:53:06 +00:00
<WhatsNewLink i18n={i18n} showWhatsNewModal={showWhatsNewModal} />
</p>
2024-08-13 23:34:42 +00:00
<div className="Inbox__padding" />
2023-08-09 00:53:06 +00:00
</div>
)}
</div>
</>
);
}