-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(suite): add missing 'use device here' button in the device settings
- Loading branch information
Showing
4 changed files
with
55 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/suite/src/components/suite/AcquireDeviceButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { MouseEventHandler } from 'react'; | ||
|
||
import { acquireDevice } from '@suite-common/wallet-core'; | ||
import { Button } from '@trezor/components'; | ||
|
||
import { useDevice, useDispatch } from 'src/hooks/suite'; | ||
|
||
import { Translation } from './Translation'; | ||
|
||
type AcquireButtonProps = { | ||
className?: string; | ||
onClick?: MouseEventHandler; | ||
}; | ||
|
||
export const AcquireDeviceButton = ({ className, onClick }: AcquireButtonProps) => { | ||
const { isLocked } = useDevice(); | ||
const dispatch = useDispatch(); | ||
|
||
const isDeviceLocked = isLocked(); | ||
|
||
const handleClick: MouseEventHandler = e => { | ||
onClick?.(e); | ||
dispatch(acquireDevice()); | ||
}; | ||
|
||
return ( | ||
<Button | ||
isLoading={isDeviceLocked} | ||
textWrap={false} | ||
onClick={handleClick} | ||
className={className} | ||
> | ||
<Translation id="TR_ACQUIRE_DEVICE" /> | ||
</Button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters