Skip to content

Commit 5772d2c

Browse files
committed
feat: New Onboarding
Updated onboarding and new account experience Still a number of files to delete but there will be a bunch of conflicts so trying to avoid that for now
1 parent 3d3c926 commit 5772d2c

File tree

61 files changed

+1973
-1377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1973
-1377
lines changed

components/Avatar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Center } from "@/design-system/Center";
22
import { Icon } from "@/design-system/Icon/Icon";
33
import { Text } from "@/design-system/Text";
44
import { useAppTheme } from "@/theme/useAppTheme";
5-
import { getFirstLetterForAvatar } from "@utils/getFirstLetterForAvatar";
5+
import { getCapitalizedLettersForAvatar } from "@/utils/getCapitalizedLettersForAvatar";
66
import { Image } from "expo-image";
77
import React, { memo, useCallback, useState } from "react";
88
import { Platform, StyleProp, ViewStyle } from "react-native";
@@ -22,7 +22,7 @@ export const Avatar = memo(function Avatar({
2222
}: IAvatarProps) {
2323
const { theme } = useAppTheme();
2424
const avatarSize = size ?? theme.avatarSize.md;
25-
const firstLetter = getFirstLetterForAvatar(name ?? "");
25+
const firstLetter = getCapitalizedLettersForAvatar(name ?? "");
2626
const [didError, setDidError] = useState(false);
2727

2828
const handleImageError = useCallback(() => {

design-system/Icon/Icon.android.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ export const iconRegistry: Record<
6969
"shield.fill": "shield",
7070
"new-account-card": "person",
7171
settings: "settings",
72+
biometric: "fingerprint",
73+
camera: "camera",
7274
};
7375

7476
export function Icon(props: IIconProps) {
@@ -89,8 +91,8 @@ export function Icon(props: IIconProps) {
8991
const iconName = icon
9092
? iconRegistry[icon]
9193
: picto
92-
? iconRegistry[picto]
93-
: null;
94+
? iconRegistry[picto]
95+
: null;
9496

9597
if (!iconName) {
9698
logger.warn(`Invalid icon name ${icon || picto}`);

design-system/Icon/Icon.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export const iconRegistry: Record<IIconName, string> = {
6666
"shield.fill": "shield.fill",
6767
"new-account-card": "person.text.rectangle",
6868
settings: "gearshape",
69+
biometric: "faceid",
70+
camera: "camera.fill",
6971
};
7072

7173
export function Icon(props: IIconProps) {
@@ -98,8 +100,8 @@ export function Icon(props: IIconProps) {
98100
const iconName = icon
99101
? iconRegistry[icon]
100102
: picto
101-
? iconRegistry[picto]
102-
: null;
103+
? iconRegistry[picto]
104+
: null;
103105

104106
if (!iconName) {
105107
logger.warn(

design-system/Icon/Icon.types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ export type IIconName =
6262
| "shield"
6363
| "shield.fill"
6464
| "new-account-card"
65-
| "settings";
65+
| "settings"
66+
| "biometric"
67+
| "camera";
6668

6769
/**
6870
* Props for the Icon component.

design-system/IconButton/IconButton.props.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "react-native";
88

99
export type IIconButtonVariant = "outline" | "subtle" | "fill" | "ghost";
10-
export type IIconButtonSize = "sm" | "md" | "lg";
10+
export type IIconButtonSize = "sm" | "md" | "lg" | "xl";
1111
export type IIconButtonAction = "primary" | "danger";
1212

1313
export type IIconButtonProps = {

design-system/IconButton/IconButton.styles.ts

Lines changed: 47 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export const getIconButtonViewStyle =
4848
width: spacing.xxl,
4949
height: spacing.xxl,
5050
},
51+
xl: {
52+
width: 56,
53+
height: 56,
54+
},
5155
};
5256

5357
Object.assign(style, sizeStyles[size]);
@@ -131,6 +135,9 @@ export const getIconStyle =
131135
lg: {
132136
fontSize: spacing.xl,
133137
},
138+
xl: {
139+
fontSize: spacing.lg,
140+
},
134141
};
135142

136143
Object.assign(style, sizeStyles[size]);
@@ -172,46 +179,46 @@ export const getIconProps =
172179
pressed = false,
173180
disabled = false,
174181
}: IconButtonStyleProps) =>
175-
(theme: Theme) =>
176-
// TODO: fix once we fixed IconProps
177-
// : Partial<IIconProps>
178-
{
179-
const { colors, spacing } = theme;
180-
181-
const props: any =
182-
// :Partial<IIconProps>
183-
{};
184-
185-
// Set icon size
186-
const sizeMap = {
187-
sm: spacing.xs,
188-
md: spacing.sm,
189-
lg: spacing.lg,
190-
};
191-
192-
props.size = sizeMap[size];
193-
194-
if (disabled && variant !== "fill") {
195-
props.color = colors.text.tertiary;
196-
return props;
197-
}
182+
(theme: Theme) => // TODO: fix once we fixed IconProps
183+
// : Partial<IIconProps>
184+
{
185+
const { colors, spacing } = theme;
198186

199-
if (action === "primary") {
200-
switch (variant) {
201-
case "fill":
202-
props.color = colors.text.inverted.primary;
203-
break;
204-
205-
case "outline":
206-
case "subtle":
207-
case "ghost":
208-
props.color = colors.text.primary;
209-
break;
210-
211-
default:
212-
break;
213-
}
214-
}
187+
const props: any =
188+
// :Partial<IIconProps>
189+
{};
215190

216-
return props;
191+
// Set icon size
192+
const sizeMap = {
193+
sm: spacing.xs,
194+
md: spacing.sm,
195+
lg: spacing.lg,
196+
xl: spacing.lg,
217197
};
198+
199+
props.size = sizeMap[size];
200+
201+
if (disabled && variant !== "fill") {
202+
props.color = colors.text.tertiary;
203+
return props;
204+
}
205+
206+
if (action === "primary") {
207+
switch (variant) {
208+
case "fill":
209+
props.color = colors.text.inverted.primary;
210+
break;
211+
212+
case "outline":
213+
case "subtle":
214+
case "ghost":
215+
props.color = colors.text.primary;
216+
break;
217+
218+
default:
219+
break;
220+
}
221+
}
222+
223+
return props;
224+
};

design-system/IconButton/IconButton.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
PressableStateCallbackType,
55
StyleProp,
66
TextStyle,
7-
View,
87
ViewStyle,
98
} from "react-native";
109
import { useAppTheme } from "../../theme/useAppTheme";
@@ -18,7 +17,10 @@ import {
1817
} from "./IconButton.styles";
1918
import { Haptics } from "@utils/haptics";
2019

21-
export function IconButton(props: IIconButtonProps) {
20+
export const IconButton = React.forwardRef(function IconButton(
21+
props: IIconButtonProps,
22+
ref
23+
) {
2224
const {
2325
icon,
2426
iconName,
@@ -120,6 +122,7 @@ export function IconButton(props: IIconButtonProps) {
120122
if (iconName) {
121123
return (
122124
<Icon
125+
ref={ref}
123126
picto={iconName}
124127
style={iconStyle({ pressed, hovered })}
125128
{...iconProps({ pressed, hovered })}
@@ -131,4 +134,4 @@ export function IconButton(props: IIconButtonProps) {
131134
}}
132135
</Pressable>
133136
);
134-
}
137+
});
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import Animated, { AnimatedProps } from "react-native-reanimated";
2+
3+
import { IconButton } from "./IconButton";
4+
import { IIconButtonProps } from "./IconButton.props";
5+
6+
export type IAnimatedIconButtonProps = AnimatedProps<IIconButtonProps>;
7+
8+
export const AnimatedIconButton = Animated.createAnimatedComponent(IconButton);

design-system/Text/Text.styles.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { Theme, ThemedStyle } from "@theme/useAppTheme";
44
import { IInvertedTextColors, ITextColors, IWeights } from "./Text.props";
55

66
export const textSizeStyles = {
7-
xxl: { fontSize: 48, lineHeight: 60 } satisfies TextStyle,
7+
["3xl"]: { fontSize: 48, lineHeight: 60 } satisfies TextStyle,
8+
xxl: { fontSize: 40, lineHeight: 44 } satisfies TextStyle,
89
xl: { fontSize: 32, lineHeight: 36 } satisfies TextStyle, // Made up, need to confirm with Andrew once we have the design
910
lg: { fontSize: 24, lineHeight: 28 } satisfies TextStyle, // Made up, need to confirm with Andrew once we have the design
1011
md: { fontSize: 20, lineHeight: 20 } satisfies TextStyle,

features/conversation-list/conversation-list.screen-header.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { HeaderAction } from "@/design-system/Header/HeaderAction";
1010
import { Icon, iconRegistry } from "@/design-system/Icon/Icon";
1111
import { Pressable } from "@/design-system/Pressable";
1212
import { Text } from "@/design-system/Text";
13+
import { usePreferredAvatarUri } from "@/hooks/usePreferredAvatarUri";
1314
import { usePreferredName } from "@/hooks/usePreferredName";
1415
import { translate } from "@/i18n";
1516
import { useHeader } from "@/navigation/use-header";
@@ -33,7 +34,7 @@ export function useHeaderWrapper() {
3334
const accounts = useAccountsList();
3435
const accountsProfiles = useAccountsProfiles();
3536
const setCurrentAccount = useAccountsStore((s) => s.setCurrentAccount);
36-
37+
const avatarUri = usePreferredAvatarUri(currentAccount!);
3738
useHeader(
3839
{
3940
safeAreaEdges: ["top"],
@@ -81,7 +82,11 @@ export function useHeaderWrapper() {
8182
padding: theme.spacing.xxs,
8283
}}
8384
>
84-
<Avatar size={theme.avatarSize.sm} />
85+
<Avatar
86+
name={preferredName}
87+
uri={avatarUri}
88+
size={theme.avatarSize.sm}
89+
/>
8590
</Center>
8691
</Pressable>
8792
<ContextMenuButton

features/conversation/conversation-message/conversation-message-content-types/conversation-message-simple-text.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const MessageSimpleText = memo(function MessageSimpleText(props: {
3333
alignItems: fromMe ? "flex-end" : "flex-start",
3434
}}
3535
>
36-
<Text style={textSizeStyles.xxl}>{textContent}</Text>
36+
<Text style={textSizeStyles["3xl"]}>{textContent}</Text>
3737
</VStack>
3838
);
3939
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { useThemeProvider } from "@/theme/useAppTheme";
2+
import { memo } from "react";
3+
4+
/**
5+
* The Onboarding Contact Card will use inverted colors.
6+
* Rather than passing a bunch of inverted props around, just creating a mini theme provider for it specifically
7+
*/
8+
export const OnboardingContactCardThemeProvider = memo(
9+
function OnboardingContactCardThemeProvider({
10+
children,
11+
}: {
12+
children: React.ReactNode;
13+
}) {
14+
const { themeScheme, setThemeContextOverride, ThemeProvider } =
15+
useThemeProvider();
16+
17+
const invertedTheme = themeScheme === "light" ? "dark" : "light";
18+
19+
return (
20+
<ThemeProvider
21+
value={{ themeScheme: invertedTheme, setThemeContextOverride }}
22+
>
23+
{children}
24+
</ThemeProvider>
25+
);
26+
}
27+
);

0 commit comments

Comments
 (0)