// @flow
import moment from 'moment';
import React, { Component } from 'react';
import { Layout, Container, Header } from './Layout';
import { BackendError } from '../lib/backend';
import ExternalLinkSVG from '../assets/images/icon-extLink.svg';
import ChevronRightSVG from '../assets/images/icon-chevron.svg';
import type { HeaderBarStyle } from './HeaderBar';
import type { ConnectionReduxState } from '../redux/connection/reducers';
import type { SettingsReduxState } from '../redux/settings/reducers';
import type { RelayLocation } from '../lib/ipc-facade';
export type ConnectProps = {
accountExpiry: string,
connection: ConnectionReduxState,
settings: SettingsReduxState,
onSettings: () => void,
onSelectLocation: () => void,
onConnect: () => void,
onCopyIP: () => void,
onDisconnect: () => void,
onExternalLink: (type: string) => void,
};
export default class Connect extends Component {
props: ConnectProps;
state = {
isFirstPass: true,
showCopyIPMessage: false
};
_copyTimer: ?number;
componentDidMount() {
this.setState({ isFirstPass: false });
}
componentWillUnmount() {
if(this._copyTimer) {
clearTimeout(this._copyTimer);
this._copyTimer = null;
}
this.setState({
isFirstPass: true,
showCopyIPMessage: false
});
}
render(): React.Element<*> {
const error = this.displayError();
const child = error ? this.renderError(error) : this.renderMap();
return (