2018-02-20 09:30:36 +00:00
|
|
|
/* @flow */
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
import React from 'react';
|
2018-04-11 10:06:46 +00:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
2018-05-18 16:41:40 +00:00
|
|
|
import { Notification } from '~/js/components/common/Notification';
|
2018-05-18 16:38:02 +00:00
|
|
|
import * as TrezorConnectActions from '~/js/actions/TrezorConnectActions';
|
2018-02-20 09:30:36 +00:00
|
|
|
|
2018-05-18 16:38:02 +00:00
|
|
|
import type { State, Dispatch } from '~/js/flowtype';
|
2018-04-16 21:19:50 +00:00
|
|
|
type Props = {
|
|
|
|
connect: $ElementType<State, 'connect'>,
|
|
|
|
acquireDevice: typeof TrezorConnectActions.acquire
|
|
|
|
}
|
|
|
|
|
|
|
|
const Acquire = (props: Props) => {
|
2018-03-08 16:10:53 +00:00
|
|
|
|
|
|
|
const actions = [
|
|
|
|
{
|
|
|
|
label: 'Acquire device',
|
|
|
|
callback: () => {
|
|
|
|
props.acquireDevice()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2018-02-20 09:30:36 +00:00
|
|
|
return (
|
|
|
|
<section className="acquire">
|
2018-03-08 16:10:53 +00:00
|
|
|
<Notification
|
|
|
|
title="Device is used in other window"
|
|
|
|
message="Do you want to use your device in this window?"
|
|
|
|
className="info"
|
2018-04-11 10:06:46 +00:00
|
|
|
cancelable={ false }
|
|
|
|
actions={ actions }
|
2018-03-08 16:10:53 +00:00
|
|
|
/>
|
2018-02-20 09:30:36 +00:00
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-04-16 21:19:50 +00:00
|
|
|
export default connect(
|
|
|
|
(state: State) => {
|
|
|
|
return {
|
|
|
|
log: state.log
|
|
|
|
};
|
|
|
|
},
|
|
|
|
(dispatch: Dispatch) => {
|
|
|
|
return {
|
2018-05-05 11:52:03 +00:00
|
|
|
acquireDevice: bindActionCreators(TrezorConnectActions.acquire, dispatch),
|
2018-04-16 21:19:50 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
)(Acquire);
|