no longer showing empty space for conversations moved from list.

pull/2000/head
Warrick Corfe-Tan 4 years ago
parent 116cb25b27
commit d57300688e

@ -299,6 +299,8 @@ const ConversationListItem = (props: Props) => {
console.warn('convo marked as approved'); console.warn('convo marked as approved');
console.warn({ convo: conversationToApprove }); console.warn({ convo: conversationToApprove });
// TODO: Send sync message to other devices. Using config message // TODO: Send sync message to other devices. Using config message
}; };
return ( return (

@ -69,6 +69,8 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
convo => !Boolean(convo.isApproved) convo => !Boolean(convo.isApproved)
); );
console.warn('convos updated');
this.state = { this.state = {
loading: false, loading: false,
overlay: false, overlay: false,
@ -83,21 +85,22 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
public renderRow = ({ index, key, style }: RowRendererParamsType): JSX.Element | null => { public renderRow = ({ index, key, style }: RowRendererParamsType): JSX.Element | null => {
const { conversations } = this.props; const { conversations } = this.props;
// const { approvedConversations: conversations } = this.state; const approvedConversations = conversations?.filter(c => c.isApproved === true);
console.warn({ conversations }); if (!conversations || !approvedConversations) {
if (!conversations) {
throw new Error('renderRow: Tried to render without conversations'); throw new Error('renderRow: Tried to render without conversations');
} }
const conversation = conversations[index]; // const conversation = conversations[index];
let conversation;
console.warn(`${index}`); if (approvedConversations?.length) {
console.warn({ conversation }); conversation = approvedConversations[index];
}
// TODO: need to confirm whats best here. // TODO: need to confirm whats best here.
// true by default then false on newly received or if (
// false by default and true when approved but then how to handle pre-existing convos? !conversation ||
if (conversation.isApproved === undefined || conversation.isApproved === false) { conversation?.isApproved === undefined ||
conversation.isApproved === false
) {
return null; return null;
} }
return <MemoConversationListItemWithDetails key={key} style={style} {...conversation} />; return <MemoConversationListItemWithDetails key={key} style={style} {...conversation} />;
@ -143,11 +146,11 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
{({ height, width }) => ( {({ height, width }) => (
<List <List
className="module-left-pane__virtual-list" className="module-left-pane__virtual-list"
conversations={conversationsForList} conversations={this.state.approvedConversations}
// conversations={[]}
height={height} height={height}
rowCount={length} rowCount={length}
rowHeight={64} rowHeight={64}
// rowHeight={this.getRowHeight}
rowRenderer={this.renderRow} rowRenderer={this.renderRow}
width={width} width={width}
autoHeight={false} autoHeight={false}
@ -160,10 +163,6 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
return [list]; return [list];
} }
// private getRowHeight({index: any}: any) {
// if (this.)
// }
public closeOverlay({ pubKey }: { pubKey: string }) { public closeOverlay({ pubKey }: { pubKey: string }) {
if (this.state.valuePasted === pubKey) { if (this.state.valuePasted === pubKey) {
this.setState({ overlay: false, valuePasted: '' }); this.setState({ overlay: false, valuePasted: '' });

@ -297,6 +297,7 @@ const MessageRequestList = () => {
const unapprovedConversations = lists?.conversations.filter(c => { const unapprovedConversations = lists?.conversations.filter(c => {
return !c.isApproved; return !c.isApproved;
}) as Array<ConversationListItemProps>; }) as Array<ConversationListItemProps>;
console.warn({ unapprovedConversationsListConstructor: unapprovedConversations });
return ( return (
<div className="message-request-list__container"> <div className="message-request-list__container">
{unapprovedConversations.map(conversation => { {unapprovedConversations.map(conversation => {

Loading…
Cancel
Save