1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-31 19:30:53 +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; className?: string;
message?: ?string; message?: ?string;
actions?: Array<CallbackAction>; actions?: Array<CallbackAction>;
isActionInProgress?: boolean;
close?: typeof NotificationActions.close, close?: typeof NotificationActions.close,
loading?: boolean loading?: boolean
}; };
@ -122,6 +123,7 @@ const Notification = (props: Props): React$Element<string> => {
<NotificationButton <NotificationButton
key={action.label} key={action.label}
type={props.type} type={props.type}
isLoading={props.isActionInProgress}
onClick={() => { close(); action.callback(); }} onClick={() => { close(); action.callback(); }}
>{action.label} >{action.label}
</NotificationButton> </NotificationButton>

View File

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