Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: New onboarding #1510

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions design-system/Text/Text.styles.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { TextStyle } from "react-native";
import { typography } from "@theme/typography";
import { Theme, ThemedStyle } from "@theme/useAppTheme";
import { TextStyle } from "react-native";
import { IInvertedTextColors, ITextColors, IWeights } from "./Text.props";

export const textSizeStyles = {
xxl: { fontSize: 48, lineHeight: 60 } satisfies TextStyle,
["3xl"]: { fontSize: 48, lineHeight: 60 } satisfies TextStyle,
xxl: { fontSize: 40, lineHeight: 44 } satisfies TextStyle,
xl: { fontSize: 32, lineHeight: 36 } satisfies TextStyle, // Made up, need to confirm with Andrew once we have the design
lg: { fontSize: 24, lineHeight: 28 } satisfies TextStyle, // Made up, need to confirm with Andrew once we have the design
md: { fontSize: 20, lineHeight: 20 } satisfies TextStyle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const MessageSimpleText = memo(function MessageSimpleText(props: {
alignItems: fromMe ? "flex-end" : "flex-start",
}}
>
<Text style={textSizeStyles.xxl}>{textContent}</Text>
<Text style={textSizeStyles["3xl"]}>{textContent}</Text>
</VStack>
);
}
Expand Down
15 changes: 15 additions & 0 deletions features/onboarding/components/onboarding-subtitlte.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { AnimatedText, IAnimatedTextProps } from "@/design-system/Text";
import { memo } from "react";

export const OnboardingSubtitle = memo(function OnboardingSubtitle(
props: IAnimatedTextProps
) {
const { style, ...rest } = props;
return (
<AnimatedText
size="sm"
style={[{ textAlign: "center" }, style]}
{...rest}
/>
);
});
Comment on lines +1 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filename onboarding-subtitlte.tsx contains a typo. Please rename it to onboarding-subtitle.tsx and update all corresponding imports. This will maintain consistency and prevent potential issues with file references.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +1 to +15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix typo in filename: "subtitlte" → "subtitle"

The filename contains a typo which should be corrected to maintain consistency and prevent confusion. This will require updating import statements in other files as well.

Run this script to verify all imports that need to be updated:

#!/bin/bash
# Find all files importing the misspelled component
rg -l "onboarding-subtitlte"

16 changes: 16 additions & 0 deletions features/onboarding/components/onboarding-title.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { AnimatedText, IAnimatedTextProps } from "@/design-system/Text";
import { memo } from "react";

export const OnboardingTitle = memo(function OnboardingTitle(
props: IAnimatedTextProps
) {
const { style, ...rest } = props;
return (
<AnimatedText
weight="semiBold"
size="xxl"
style={[{ textAlign: "center" }, style]}
{...rest}
/>
);
});
133 changes: 133 additions & 0 deletions features/onboarding/onboarding-get-started.screen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import { Screen } from "@/components/Screen/ScreenComp/Screen";
import { AnimatedCenter } from "@/design-system/Center";
import { Icon } from "@/design-system/Icon/Icon";
import { Pressable } from "@/design-system/Pressable";
import { AnimatedText } from "@/design-system/Text";
import { AnimatedVStack, VStack } from "@/design-system/VStack";
import { PressableScale } from "@/design-system/pressable-scale";
import { OnboardingSubtitle } from "@/features/onboarding/components/onboarding-subtitlte";
import { OnboardingTitle } from "@/features/onboarding/components/onboarding-title";
import { useAppTheme } from "@/theme/useAppTheme";
import { getRandomId } from "@/utils/general";
import { memo } from "react";
import { FadeIn, FadeInUp } from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";

export const OnboardingGetStartedScreen = memo(
function OnboardingGetStartedScreen() {
const { theme } = useAppTheme();
const insets = useSafeAreaInsets();

return (
<Screen
key={getRandomId()}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using getRandomId() as a key prop will force a re-render on every render cycle since it generates a new value each time. This can hurt performance, especially for complex component trees. Either remove the key prop if it's not needed for list reconciliation, or use a stable identifier that persists across renders.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove getRandomId() from Screen key prop

Using a random key can cause unnecessary remounts of the entire screen component and its children. Remove this key prop as it's not needed here.

-      <Screen
-        key={getRandomId()}
+      <Screen

Committable suggestion skipped: line range outside the PR's diff.

contentContainerStyle={{
flex: 1,
}}
>
<VStack
// {...debugBorder()}
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
}}
>
<VStack
// {...debugBorder()}
style={{
rowGap: theme.spacing.xs,
alignItems: "center",
justifyContent: "center",
paddingHorizontal: theme.spacing.lg,
}}
>
<OnboardingSubtitle
entering={
FadeInUp.springify().delay(200).duration(3000)
// .stiffness(theme.animation.spring.stiffness)
// .damping(theme.animation.spring.damping)
}
>
Welcome to Convos
</OnboardingSubtitle>
<OnboardingTitle
entering={FadeInUp.springify().delay(250).duration(3000)}
>
Become unspammable
</OnboardingTitle>
</VStack>
<AnimatedCenter
style={{
marginTop: theme.spacing.sm,
flexDirection: "row",
columnGap: theme.spacing.xxs,
}}
>
<AnimatedText
size="xs"
color="secondary"
entering={FadeIn.springify().delay(400).duration(3000)}
>
Simple
</AnimatedText>
<AnimatedText size="xs" color="secondary">
</AnimatedText>
<AnimatedText
size="xs"
color="secondary"
entering={FadeIn.springify().delay(450).duration(3000)}
>
Secure
</AnimatedText>
<AnimatedText size="xs" color="secondary">
</AnimatedText>
<AnimatedText
size="xs"
color="secondary"
entering={FadeIn.springify().delay(500).duration(3000)}
>
Universal
</AnimatedText>
</AnimatedCenter>
</VStack>

<Pressable>
<AnimatedVStack
entering={FadeIn.springify().delay(600).duration(3000)}
style={{
paddingBottom: insets.bottom + theme.spacing.sm,
justifyContent: "center",
alignItems: "center",
rowGap: theme.spacing.xxs,
}}
>
<PressableScale>
<AnimatedCenter
style={{
borderRadius: 999,
width: theme.avatarSize.lg,
height: theme.avatarSize.lg,
backgroundColor: theme.colors.fill.primary,
justifyContent: "center",
alignItems: "center",
}}
>
<Icon
style={{
color: "#A1F293",

Check failure on line 120 in features/onboarding/onboarding-get-started.screen.tsx

View workflow job for this annotation

GitHub Actions / tsc

Object literal may only specify known properties, and 'color' does not exist in type 'ViewStyle | RecursiveArray<Falsy | ViewStyle | RegisteredStyle<ViewStyle>>'.
}}
icon="checkmark"
size={40}
/>
Comment on lines +118 to +124
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Use theme color instead of hard-coded value

Replace the hard-coded color "#A1F293" with a theme color to maintain consistency and support different themes.

               <Icon
                 style={{
-                  color: "#A1F293",
+                  tintColor: theme.colors.success.primary, // or appropriate theme color
                 }}
                 icon="checkmark"
                 size={40}
               />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Icon
style={{
color: "#A1F293",
}}
icon="checkmark"
size={40}
/>
<Icon
style={{
tintColor: theme.colors.success.primary,
}}
icon="checkmark"
size={40}
/>
🧰 Tools
🪛 GitHub Check: tsc

[failure] 120-120:
Object literal may only specify known properties, and 'color' does not exist in type 'ViewStyle | RecursiveArray<Falsy | ViewStyle | RegisteredStyle>'.

</AnimatedCenter>
</PressableScale>
<AnimatedText size="xs">Create a Contact Card</AnimatedText>
</AnimatedVStack>
</Pressable>
Comment on lines +97 to +129
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Simplify nested Pressable components

The component has nested Pressable and PressableScale which might lead to conflicting touch handling. Consider combining them into a single PressableScale.

-        <Pressable>
-          <AnimatedVStack
+        <PressableScale>
+          <AnimatedVStack
             entering={FadeIn.springify().delay(600).duration(3000)}
             style={{
               paddingBottom: insets.bottom + theme.spacing.sm,
               justifyContent: "center",
               alignItems: "center",
               rowGap: theme.spacing.xxs,
             }}
           >
-            <PressableScale>
             <AnimatedCenter
               style={{
                 borderRadius: 999,
                 width: theme.avatarSize.lg,
                 height: theme.avatarSize.lg,
                 backgroundColor: theme.colors.fill.primary,
                 justifyContent: "center",
                 alignItems: "center",
               }}
             >
               <Icon
                 style={{
                   color: "#A1F293",
                 }}
                 icon="checkmark"
                 size={40}
               />
             </AnimatedCenter>
-            </PressableScale>
             <AnimatedText size="xs">Create a Contact Card</AnimatedText>
           </AnimatedVStack>
-        </Pressable>
+        </PressableScale>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Pressable>
<AnimatedVStack
entering={FadeIn.springify().delay(600).duration(3000)}
style={{
paddingBottom: insets.bottom + theme.spacing.sm,
justifyContent: "center",
alignItems: "center",
rowGap: theme.spacing.xxs,
}}
>
<PressableScale>
<AnimatedCenter
style={{
borderRadius: 999,
width: theme.avatarSize.lg,
height: theme.avatarSize.lg,
backgroundColor: theme.colors.fill.primary,
justifyContent: "center",
alignItems: "center",
}}
>
<Icon
style={{
color: "#A1F293",
}}
icon="checkmark"
size={40}
/>
</AnimatedCenter>
</PressableScale>
<AnimatedText size="xs">Create a Contact Card</AnimatedText>
</AnimatedVStack>
</Pressable>
<PressableScale>
<AnimatedVStack
entering={FadeIn.springify().delay(600).duration(3000)}
style={{
paddingBottom: insets.bottom + theme.spacing.sm,
justifyContent: "center",
alignItems: "center",
rowGap: theme.spacing.xxs,
}}
>
<AnimatedCenter
style={{
borderRadius: 999,
width: theme.avatarSize.lg,
height: theme.avatarSize.lg,
backgroundColor: theme.colors.fill.primary,
justifyContent: "center",
alignItems: "center",
}}
>
<Icon
style={{
color: "#A1F293",
}}
icon="checkmark"
size={40}
/>
</AnimatedCenter>
<AnimatedText size="xs">Create a Contact Card</AnimatedText>
</AnimatedVStack>
</PressableScale>
🧰 Tools
🪛 GitHub Check: tsc

[failure] 120-120:
Object literal may only specify known properties, and 'color' does not exist in type 'ViewStyle | RecursiveArray<Falsy | ViewStyle | RegisteredStyle>'.

</Screen>
);
}
);
16 changes: 8 additions & 8 deletions screens/Navigation/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { NewAccountScreen } from "../NewAccount/NewAccountScreen";
import { NewAccountUserProfileScreen } from "../NewAccount/NewAccountUserProfileScreen";
import { OnboardingConnectWalletScreen } from "../Onboarding/OnboardingConnectWalletScreen";
import { OnboardingEphemeraScreen } from "../Onboarding/OnboardingEphemeraScreen";
import { OnboardingGetStartedScreen } from "../Onboarding/OnboardingGetStartedScreen";
import { OnboardingNotificationsScreen } from "../Onboarding/OnboardingNotificationsScreen";
import { OnboardingPrivateKeyScreen } from "../Onboarding/OnboardingPrivateKeyScreen";
import { OnboardingPrivyScreen } from "../Onboarding/OnboardingPrivyScreen";
Expand All @@ -46,6 +45,7 @@ import WebviewPreviewNav, {
WebviewPreviewNavParams,
} from "./WebviewPreviewNav";
import ConversationRequestsListNav from "@/screens/Navigation/ConversationRequestsListNav.ios";
import { OnboardingGetStartedScreen } from "@/features/onboarding/onboarding-get-started.screen";

export type NavigationParamList = {
Idle: undefined;
Expand Down Expand Up @@ -195,20 +195,20 @@ export function SignedOutNavigation() {
screenListeners={screenListeners("fullStackNavigation")}
>
<NativeStack.Group>
<NativeStack.Group screenOptions={{ headerShown: false }}>
<NativeStack.Screen
name="OnboardingGetStarted"
component={OnboardingGetStartedScreen}
/>
</NativeStack.Group>

{/* Auth / Onboarding */}
<NativeStack.Group
screenOptions={{
...stackGroupScreenOptions(colorScheme),
...authScreensSharedScreenOptions,
}}
>
<NativeStack.Screen
options={{
headerShown: false,
}}
name="OnboardingGetStarted"
component={OnboardingGetStartedScreen}
/>
<NativeStack.Screen
name="OnboardingPrivy"
component={OnboardingPrivyScreen}
Expand Down
Loading