A hybrid panel system for React & Backbone

This commit is contained in:
Josh Perez 2022-12-14 13:41:04 -05:00 committed by GitHub
parent 624adca360
commit ebeb6a7a6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 474 additions and 157 deletions

View file

@ -64,6 +64,9 @@ import * as log from '../../logging/log';
import { TimelineMessageLoadingState } from '../../util/timelineUtil';
import { isSignalConversation } from '../../util/isSignalConversation';
import { reduce } from '../../util/iterables';
import { getConversationTitleForPanelType } from '../../util/getConversationTitleForPanelType';
import type { ReactPanelRenderType, PanelRenderType } from '../../types/Panels';
import { isPanelHandledByReact } from '../../types/Panels';
let placeholderContact: ConversationType;
export const getPlaceholderContact = (): ConversationType => {
@ -1131,3 +1134,34 @@ export const getHideStoryConversationIds = createSelector(
conversationId => conversationLookup[conversationId].hideStory
)
);
const getTopPanel = createSelector(
getConversations,
(conversations): PanelRenderType | undefined =>
conversations.selectedConversationPanels[
conversations.selectedConversationPanels.length - 1
]
);
export const getTopPanelRenderableByReact = createSelector(
getConversations,
(conversations): ReactPanelRenderType | undefined => {
const topPanel =
conversations.selectedConversationPanels[
conversations.selectedConversationPanels.length - 1
];
if (!isPanelHandledByReact(topPanel)) {
return;
}
return topPanel;
}
);
export const getConversationTitle = createSelector(
getIntl,
getTopPanel,
(i18n, panel): string | undefined =>
getConversationTitleForPanelType(i18n, panel?.type)
);