1
- import { useIntl } from 'react-intl' ;
2
-
3
1
import styled from 'styled-components' ;
4
2
5
- import TrezorConnect from '@trezor/connect' ;
6
3
import { H2 , NewModal } from '@trezor/components' ;
7
4
import { ConfirmOnDevice } from '@trezor/product-components' ;
8
5
import { spacings } from '@trezor/theme' ;
9
6
10
7
import { Translation } from 'src/components/suite/Translation' ;
11
8
import { DeviceConfirmImage } from 'src/components/suite' ;
12
9
import { TrezorDevice } from 'src/types/suite' ;
13
- import messages from 'src/support/messages' ;
14
10
15
11
const ImageWrapper = styled . div `
16
12
display: flex;
@@ -19,31 +15,27 @@ const ImageWrapper = styled.div`
19
15
20
16
interface ConfirmActionProps {
21
17
device : TrezorDevice ;
18
+ onCancel ?: ( ) => void ;
22
19
}
23
20
24
- export const ConfirmActionModal = ( { device } : ConfirmActionProps ) => {
25
- const intl = useIntl ( ) ;
26
- const onCancel = ( ) => TrezorConnect . cancel ( intl . formatMessage ( messages . TR_CANCELLED ) ) ;
27
-
28
- return (
29
- < NewModal . Backdrop onClick = { onCancel } data-testid = "@suite/modal/confirm-action-on-device" >
30
- < ConfirmOnDevice
31
- title = { < Translation id = "TR_CONFIRM_ON_TREZOR" /> }
32
- deviceModelInternal = { device ?. features ?. internal_model }
33
- deviceUnitColor = { device ?. features ?. unit_color }
34
- onCancel = { onCancel }
35
- />
36
- < NewModal . ModalBase size = "tiny" >
37
- < ImageWrapper >
38
- < DeviceConfirmImage device = { device } />
39
- </ ImageWrapper >
40
- < H2
41
- align = "center"
42
- margin = { { left : spacings . md , right : spacings . md , bottom : spacings . md } }
43
- >
44
- < Translation id = "TR_CONFIRM_ACTION_ON_YOUR" />
45
- </ H2 >
46
- </ NewModal . ModalBase >
47
- </ NewModal . Backdrop >
48
- ) ;
49
- } ;
21
+ export const ConfirmActionModal = ( { device, onCancel } : ConfirmActionProps ) => (
22
+ < NewModal . Backdrop onClick = { onCancel } data-testid = "@suite/modal/confirm-action-on-device" >
23
+ < ConfirmOnDevice
24
+ title = { < Translation id = "TR_CONFIRM_ON_TREZOR" /> }
25
+ deviceModelInternal = { device ?. features ?. internal_model }
26
+ deviceUnitColor = { device ?. features ?. unit_color }
27
+ onCancel = { onCancel }
28
+ />
29
+ < NewModal . ModalBase size = "tiny" >
30
+ < ImageWrapper >
31
+ < DeviceConfirmImage device = { device } />
32
+ </ ImageWrapper >
33
+ < H2
34
+ align = "center"
35
+ margin = { { left : spacings . md , right : spacings . md , bottom : spacings . md } }
36
+ >
37
+ < Translation id = "TR_CONFIRM_ACTION_ON_YOUR" />
38
+ </ H2 >
39
+ </ NewModal . ModalBase >
40
+ </ NewModal . Backdrop >
41
+ ) ;
0 commit comments