1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-15 12:59:09 +00:00

Added loading state for acquire button

This commit is contained in:
Vladimir Volek 2019-01-07 15:36:47 +01:00
parent e750fc2da6
commit cbbcf1f4d1
2 changed files with 23 additions and 22 deletions

View File

@ -19,6 +19,7 @@ type Props = {
className?: string;
message?: ?string;
actions?: Array<CallbackAction>;
isActionInProgress?: boolean;
close?: typeof NotificationActions.close,
loading?: boolean
};
@ -122,6 +123,7 @@ const Notification = (props: Props): React$Element<string> => {
<NotificationButton
key={action.label}
type={props.type}
isLoading={props.isActionInProgress}
onClick={() => { close(); action.callback(); }}
>{action.label}
</NotificationButton>

View File

@ -21,28 +21,27 @@ const Wrapper = styled.div`
flex: 1;
`;
const Acquire = (props: Props) => {
const actions = props.acquiring ? [] : [
{
label: 'Acquire device',
callback: () => {
props.acquireDevice();
},
},
];
return (
<Wrapper>
<Notification
title="Device is used in other window"
message="Do you want to use your device in this window?"
type="info"
cancelable={false}
actions={actions}
/>
</Wrapper>
);
};
const Acquire = (props: Props) => (
<Wrapper>
<Notification
title="Device is used in other window"
message="Do you want to use your device in this window?"
type="info"
cancelable={false}
isActionInProgress={props.acquiring}
actions={
[
{
label: 'Acquire device',
callback: () => {
props.acquireDevice();
},
},
]
}
/>
</Wrapper>
);
export default connect(
(state: State) => ({