From d57300688ec745a939d0bb41996dc5d33c2a23a6 Mon Sep 17 00:00:00 2001 From: Warrick Corfe-Tan Date: Tue, 26 Oct 2021 22:56:22 +1100 Subject: [PATCH] no longer showing empty space for conversations moved from list. --- ts/components/ConversationListItem.tsx | 2 ++ .../session/LeftPaneMessageSection.tsx | 33 +++++++++---------- .../session/SessionClosableOverlay.tsx | 1 + 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/ts/components/ConversationListItem.tsx b/ts/components/ConversationListItem.tsx index 61a2fb67b..f466f7170 100644 --- a/ts/components/ConversationListItem.tsx +++ b/ts/components/ConversationListItem.tsx @@ -299,6 +299,8 @@ const ConversationListItem = (props: Props) => { console.warn('convo marked as approved'); console.warn({ convo: conversationToApprove }); // TODO: Send sync message to other devices. Using config message + + }; return ( diff --git a/ts/components/session/LeftPaneMessageSection.tsx b/ts/components/session/LeftPaneMessageSection.tsx index 50fc1b4e8..e1d57a2c1 100644 --- a/ts/components/session/LeftPaneMessageSection.tsx +++ b/ts/components/session/LeftPaneMessageSection.tsx @@ -69,6 +69,8 @@ export class LeftPaneMessageSection extends React.Component { convo => !Boolean(convo.isApproved) ); + console.warn('convos updated'); + this.state = { loading: false, overlay: false, @@ -83,21 +85,22 @@ export class LeftPaneMessageSection extends React.Component { public renderRow = ({ index, key, style }: RowRendererParamsType): JSX.Element | null => { const { conversations } = this.props; - // const { approvedConversations: conversations } = this.state; - console.warn({ conversations }); - - if (!conversations) { + const approvedConversations = conversations?.filter(c => c.isApproved === true); + if (!conversations || !approvedConversations) { throw new Error('renderRow: Tried to render without conversations'); } - const conversation = conversations[index]; - - console.warn(`${index}`); - console.warn({ conversation }); + // const conversation = conversations[index]; + let conversation; + if (approvedConversations?.length) { + conversation = approvedConversations[index]; + } // TODO: need to confirm whats best here. - // true by default then false on newly received or - // false by default and true when approved but then how to handle pre-existing convos? - if (conversation.isApproved === undefined || conversation.isApproved === false) { + if ( + !conversation || + conversation?.isApproved === undefined || + conversation.isApproved === false + ) { return null; } return ; @@ -143,11 +146,11 @@ export class LeftPaneMessageSection extends React.Component { {({ height, width }) => ( { return [list]; } - // private getRowHeight({index: any}: any) { - // if (this.) - // } - public closeOverlay({ pubKey }: { pubKey: string }) { if (this.state.valuePasted === pubKey) { this.setState({ overlay: false, valuePasted: '' }); diff --git a/ts/components/session/SessionClosableOverlay.tsx b/ts/components/session/SessionClosableOverlay.tsx index 66b059808..9536fead5 100644 --- a/ts/components/session/SessionClosableOverlay.tsx +++ b/ts/components/session/SessionClosableOverlay.tsx @@ -297,6 +297,7 @@ const MessageRequestList = () => { const unapprovedConversations = lists?.conversations.filter(c => { return !c.isApproved; }) as Array; + console.warn({ unapprovedConversationsListConstructor: unapprovedConversations }); return (
{unapprovedConversations.map(conversation => {