A hybrid panel system for React & Backbone
This commit is contained in:
parent
624adca360
commit
ebeb6a7a6d
14 changed files with 474 additions and 157 deletions
|
@ -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)
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue