Skip to content

Commit 4ff917a

Browse files
ieowsmgv
andcommitted
feat: new UI for choose password and importFromSeed
Co-authored-by: smgv <gpatra1996@gmail.com>
1 parent 756db9a commit 4ff917a

File tree

18 files changed

+1750
-2104
lines changed

18 files changed

+1750
-2104
lines changed

app/component-library/components/Form/TextField/TextField.styles.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,18 @@ const styleSheet = (params: {
3030
}
3131

3232
return StyleSheet.create({
33-
base: Object.assign(
34-
{
35-
flexDirection: 'row',
36-
alignItems: 'center',
37-
borderRadius: 8,
38-
height: Number(size),
39-
borderWidth: 1,
40-
borderColor,
41-
opacity: isDisabled ? 0.5 : 1,
42-
paddingHorizontal: 16,
43-
backgroundColor: theme.colors.background.default,
44-
} as ViewStyle,
45-
style,
46-
) as ViewStyle,
33+
base: Object.assign({
34+
flexDirection: 'row',
35+
alignItems: 'center',
36+
borderRadius: 8,
37+
height: Number(size),
38+
borderWidth: 1,
39+
borderColor,
40+
opacity: isDisabled ? 0.5 : 1,
41+
paddingHorizontal: 16,
42+
backgroundColor: theme.colors.background.default,
43+
...StyleSheet.flatten(style),
44+
} as ViewStyle) as ViewStyle,
4745
startAccessory: {
4846
marginRight: 8,
4947
},

app/component-library/components/Icons/Icon/Icon.assets.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ import webtrafficSVG from './assets/web-traffic.svg';
273273
import widgetsSVG from './assets/widgets.svg';
274274
import wifioffSVG from './assets/wifi-off.svg';
275275
import wifiSVG from './assets/wifi.svg';
276+
import dangerSolidSVG from './assets/danger-solid.svg';
277+
import successSolidSVG from './assets/success.svg';
276278
import xSVG from './assets/x.svg';
277279

278280
/**
@@ -548,5 +550,7 @@ export const assetByIconName: AssetByIconName = {
548550
[IconName.Widgets]: widgetsSVG,
549551
[IconName.WifiOff]: wifioffSVG,
550552
[IconName.Wifi]: wifiSVG,
553+
[IconName.DangerSolid]: dangerSolidSVG,
554+
[IconName.SuccessSolid]: successSolidSVG,
551555
[IconName.X]: xSVG,
552556
};

app/component-library/components/Icons/Icon/Icon.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,5 +343,7 @@ export enum IconName {
343343
Widgets = 'Widgets',
344344
WifiOff = 'WifiOff',
345345
Wifi = 'Wifi',
346+
DangerSolid = 'DangerSolid',
347+
SuccessSolid = 'SuccessSolid',
346348
X = 'X',
347349
}
Lines changed: 10 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Loading

app/components/UI/LoginOptionsSwitch/LoginOptionsSwitch.tsx

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React, { useCallback, useState } from 'react';
2-
import { Switch, Text, View } from 'react-native';
32
import { strings } from '../../../../locales/i18n';
43
import { AUTHENTICATION_TYPE, BIOMETRY_TYPE } from 'react-native-keychain';
5-
import { createStyles } from './styles';
64
import { LoginViewSelectors } from '../../../../e2e/selectors/wallet/LoginView.selectors';
75
import { useSelector } from 'react-redux';
8-
import { useTheme } from '../../../util/theme';
6+
import SecurityOptionToggle from '../SecurityOptionToggle/SecurityOptionToggle';
97

108
interface Props {
119
shouldRenderBiometricOption:
@@ -30,9 +28,6 @@ const LoginOptionsSwitch = ({
3028
onUpdateBiometryChoice,
3129
onUpdateRememberMe,
3230
}: Props) => {
33-
const theme = useTheme();
34-
const { colors } = theme;
35-
const styles = createStyles(colors);
3631
const allowLoginWithRememberMe = useSelector(
3732
// TODO: Replace "any" with type
3833
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -56,44 +51,22 @@ const LoginOptionsSwitch = ({
5651
// if both are disabled then this component returns null
5752
if (shouldRenderBiometricOption !== null) {
5853
return (
59-
<View style={styles.container}>
60-
<Text style={styles.label}>
61-
{strings(
62-
`biometrics.enable_${shouldRenderBiometricOption.toLowerCase()}`,
63-
)}
64-
</Text>
65-
<Switch
66-
onValueChange={onBiometryValueChanged}
67-
value={biometryChoiceState}
68-
style={styles.switch}
69-
trackColor={{
70-
true: colors.primary.default,
71-
false: colors.border.muted,
72-
}}
73-
thumbColor={theme.brandColors.white}
74-
ios_backgroundColor={colors.border.muted}
75-
/>
76-
</View>
54+
<SecurityOptionToggle
55+
title={strings(
56+
`biometrics.enable_${shouldRenderBiometricOption.toLowerCase()}`,
57+
)}
58+
value={biometryChoiceState}
59+
onOptionUpdated={onBiometryValueChanged}
60+
/>
7761
);
7862
} else if (shouldRenderBiometricOption === null && allowLoginWithRememberMe) {
7963
return (
80-
<View style={styles.container}>
81-
<Text style={styles.label}>
82-
{strings(`choose_password.remember_me`)}
83-
</Text>
84-
<Switch
85-
onValueChange={onRememberMeValueChanged}
86-
value={rememberMeEnabled}
87-
style={styles.switch}
88-
trackColor={{
89-
true: colors.primary.default,
90-
false: colors.border.muted,
91-
}}
92-
thumbColor={theme.brandColors.white}
93-
ios_backgroundColor={colors.border.muted}
94-
testID={LoginViewSelectors.REMEMBER_ME_SWITCH}
95-
/>
96-
</View>
64+
<SecurityOptionToggle
65+
title={strings('choose_password.remember_me')}
66+
value={rememberMeEnabled}
67+
onOptionUpdated={onRememberMeValueChanged}
68+
testId={LoginViewSelectors.REMEMBER_ME_SWITCH}
69+
/>
9770
);
9871
}
9972
return null;

app/components/UI/Navbar/index.js

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -642,10 +642,14 @@ export function getModalNavbarOptions(title) {
642642
*/
643643
export function getOnboardingNavbarOptions(
644644
route,
645-
{ headerLeft } = {},
645+
{ headerLeft, headerRight },
646646
themeColors,
647+
showLogo = true,
647648
) {
648-
const headerLeftHide = headerLeft || route.params?.headerLeft;
649+
const headerLeftHide =
650+
headerLeft || route.params?.headerLeft || (() => <View />);
651+
const headerRightHide =
652+
headerRight || route.params?.headerRight || (() => <View />);
649653
const innerStyles = StyleSheet.create({
650654
headerStyle: {
651655
backgroundColor: themeColors.background.default,
@@ -661,17 +665,19 @@ export function getOnboardingNavbarOptions(
661665

662666
return {
663667
headerStyle: innerStyles.headerStyle,
664-
headerTitle: () => (
665-
<View style={styles.metamaskNameTransparentWrapper}>
666-
<Image
667-
source={metamask_name}
668-
style={innerStyles.metamaskName}
669-
resizeMethod={'auto'}
670-
/>
671-
</View>
672-
),
673-
headerBackTitle: strings('navigation.back'),
674-
headerRight: () => <View />,
668+
headerTitle: showLogo
669+
? () => (
670+
<View style={styles.metamaskNameTransparentWrapper}>
671+
<Image
672+
source={metamask_name}
673+
style={innerStyles.metamaskName}
674+
resizeMethod={'auto'}
675+
/>
676+
</View>
677+
)
678+
: null,
679+
// headerBackTitle: strings('navigation.back'),
680+
headerRight: headerRightHide,
675681
headerLeft: headerLeftHide,
676682
headerTintColor: themeColors.primary.default,
677683
};
@@ -796,7 +802,7 @@ export function getTransparentBackOnboardingNavbarOptions(themeColors, color) {
796802
*
797803
* @returns {Object} - Corresponding navbar options containing headerLeft
798804
*/
799-
export function getOptinMetricsNavbarOptions(themeColors) {
805+
export function getOptinMetricsNavbarOptions(themeColors, showLogo = true) {
800806
const innerStyles = StyleSheet.create({
801807
headerStyle: {
802808
backgroundColor: themeColors.background.default,
@@ -810,17 +816,19 @@ export function getOptinMetricsNavbarOptions(themeColors) {
810816
},
811817
});
812818
return {
813-
headerTitle: () => (
814-
<View style={styles.metamaskNameTransparentWrapper}>
815-
<Image
816-
source={metamask_name}
817-
style={innerStyles.metamaskName}
818-
resizeMethod={'auto'}
819-
/>
820-
</View>
821-
),
819+
headerTitle: () =>
820+
showLogo ? (
821+
<View style={styles.metamaskNameTransparentWrapper}>
822+
<Image
823+
source={metamask_name}
824+
style={innerStyles.metamaskName}
825+
resizeMethod={'auto'}
826+
/>
827+
</View>
828+
) : null,
822829
headerBackTitle: strings('navigation.back'),
823830
headerRight: () => <View />,
831+
headerLeft: () => <View />,
824832
headerStyle: innerStyles.headerStyle,
825833
headerTintColor: themeColors.primary.default,
826834
};

0 commit comments

Comments
 (0)