forked from trezor/trezor-suite
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(suite-native): modals renderer (trezor#10801)
- Loading branch information
Showing
10 changed files
with
73 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { useAtomValue } from 'jotai'; | ||
|
||
import { AlertSheet } from './AlertSheet'; | ||
import { alertAtom } from '../alertsAtoms'; | ||
|
||
type NotificationRendererProps = { | ||
children: ReactNode; | ||
}; | ||
|
||
export const AlertRenderer = ({ children }: NotificationRendererProps) => { | ||
export const AlertRenderer = () => { | ||
const alert = useAtomValue(alertAtom); | ||
|
||
return ( | ||
<> | ||
{children} | ||
{alert && <AlertSheet alert={alert} />} | ||
</> | ||
); | ||
if (!alert) return null; | ||
|
||
return <AlertSheet alert={alert} />; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { AlertRenderer } from '@suite-native/alerts'; | ||
import { PassphraseModalRenderer } from '@suite-native/passphrase'; | ||
import { ToastRenderer } from '@suite-native/toasts'; | ||
import { BiometricsModalRenderer } from '@suite-native/biometrics'; | ||
// import { NotificationRenderer } from '@suite-native/notifications'; | ||
|
||
import { Snow } from './snow/Snow'; | ||
|
||
export const ModalsRenderer = () => ( | ||
<> | ||
<AlertRenderer /> | ||
<PassphraseModalRenderer /> | ||
<ToastRenderer /> | ||
<Snow /> | ||
<BiometricsModalRenderer /> | ||
{/* Notifications are disabled until the problem with after-import notifications flooding is solved. */} | ||
{/* More here: https://github.com/trezor/trezor-suite/issues/7721 */} | ||
{/* <NotificationRenderer /> */} | ||
</> | ||
); |
21 changes: 0 additions & 21 deletions
21
suite-native/biometrics/src/components/AuthenticatorProvider.tsx
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
suite-native/biometrics/src/components/BiometricsModalRenderer.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,12 @@ | ||
import { useBiometrics } from '../useBiometrics'; | ||
import { useIsBiometricsOverlayVisible } from '../biometricsAtoms'; | ||
import { BiometricOverlay } from './BiometricOverlay'; | ||
|
||
export const BiometricsModalRenderer = () => { | ||
useBiometrics(); | ||
const { isBiometricsOverlayVisible } = useIsBiometricsOverlayVisible(); | ||
|
||
if (!isBiometricsOverlayVisible) return null; | ||
|
||
return <BiometricOverlay />; | ||
}; |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export * from './isBiometricsFeatureAvailable'; | ||
export * from './biometricsAtoms'; | ||
export * from './useBiometrics'; | ||
export * from './components/AuthenticatorProvider'; | ||
export * from './components/BiometricsModalRenderer'; | ||
export * from './useBiometricsSettings'; | ||
export * from './utils'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import { useAtomValue } from 'jotai'; | ||
|
||
import { PassphraseFormModal } from './PassphraseFormModal'; | ||
import { isPassphraseModalVisibleAtom } from './isPassphraseModalVisibleAtom'; | ||
|
||
type PassphraseModalRendererProps = { | ||
children: ReactNode; | ||
}; | ||
|
||
export const PassphraseModalRenderer = ({ children }: PassphraseModalRendererProps) => { | ||
export const PassphraseModalRenderer = () => { | ||
const isPassphraseModalVisible = useAtomValue(isPassphraseModalVisibleAtom); | ||
|
||
return ( | ||
<> | ||
{children} | ||
{isPassphraseModalVisible && <PassphraseFormModal />} | ||
</> | ||
); | ||
if (!isPassphraseModalVisible) return null; | ||
|
||
return <PassphraseFormModal />; | ||
}; |
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