Merge pull request #1343 from Bilb/close-overlay-message-sent

pull/1345/head
Audric Ackermann 5 years ago committed by GitHub
commit 789461bd7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,7 +40,6 @@ export interface Props {
interface State {
showAddContactView: boolean;
selectedTab: number;
addContactRecipientID: string;
pubKeyPasted: string;
}
@ -52,27 +51,33 @@ export class LeftPaneContactSection extends React.Component<Props, State> {
super(props);
this.state = {
showAddContactView: false,
selectedTab: 0,
addContactRecipientID: '',
pubKeyPasted: '',
};
this.debouncedSearch = debounce(this.search.bind(this), 20);
this.handleTabSelected = this.handleTabSelected.bind(this);
this.handleToggleOverlay = this.handleToggleOverlay.bind(this);
this.handleOnAddContact = this.handleOnAddContact.bind(this);
this.handleRecipientSessionIDChanged = this.handleRecipientSessionIDChanged.bind(
this
);
this.closeOverlay = this.closeOverlay.bind(this);
}
public componentDidMount() {
MainViewController.renderMessageView();
window.Whisper.events.on('calculatingPoW', this.closeOverlay);
}
public componentDidUpdate() {
MainViewController.renderMessageView();
}
public componentWillUnmount() {
this.updateSearch('');
this.setState({ addContactRecipientID: '' });
}
public handleTabSelected(tabType: number) {
this.setState({ selectedTab: tabType, showAddContactView: false });
window.Whisper.events.off('calculatingPoW', this.closeOverlay);
}
public renderHeader(): JSX.Element | undefined {
@ -80,7 +85,7 @@ export class LeftPaneContactSection extends React.Component<Props, State> {
return LeftPane.RENDER_HEADER(
labels,
this.handleTabSelected,
null,
undefined,
undefined,
undefined,
@ -88,14 +93,6 @@ export class LeftPaneContactSection extends React.Component<Props, State> {
);
}
public componentDidMount() {
MainViewController.renderMessageView();
}
public componentDidUpdate() {
MainViewController.renderMessageView();
}
public render(): JSX.Element {
return (
<div className="left-pane-contact-section">
@ -182,6 +179,12 @@ export class LeftPaneContactSection extends React.Component<Props, State> {
);
}
private closeOverlay({ pubKey }: { pubKey: string }) {
if (this.state.addContactRecipientID === pubKey) {
this.setState({ showAddContactView: false, addContactRecipientID: '' });
}
}
private handleToggleOverlay() {
this.setState((prevState: { showAddContactView: boolean }) => ({
showAddContactView: !prevState.showAddContactView,
@ -217,7 +220,6 @@ export class LeftPaneContactSection extends React.Component<Props, State> {
}
private renderBottomButtons(): JSX.Element {
const { selectedTab } = this.state;
const addContact = window.i18n('addContact');
return (

@ -93,10 +93,21 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
this.renderClosableOverlay = this.renderClosableOverlay.bind(this);
this.debouncedSearch = debounce(this.search.bind(this), 20);
this.closeOverlay = this.closeOverlay.bind(this);
}
public componentDidMount() {
MainViewController.renderMessageView();
window.Whisper.events.on('calculatingPoW', this.closeOverlay);
}
public componentDidUpdate() {
MainViewController.renderMessageView();
}
public componentWillUnmount() {
this.updateSearch('');
window.Whisper.events.off('calculatingPoW', this.closeOverlay);
}
public renderRow = ({
@ -176,12 +187,10 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
return [list];
}
public componentDidMount() {
MainViewController.renderMessageView();
}
public componentDidUpdate() {
MainViewController.renderMessageView();
public closeOverlay({ pubKey }: { pubKey: string }) {
if (this.state.valuePasted === pubKey) {
this.setState({ overlay: false, valuePasted: '' });
}
}
public renderHeader(): JSX.Element {

Loading…
Cancel
Save