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

Update header titles for DemoFeedScreen and DemoCaptureScreen Add demo mode UI changes with SkipDemoButton and demoMode prop #408

Merged
merged 5 commits into from
Feb 5, 2025

Conversation

jaronheard
Copy link
Owner

@jaronheard jaronheard commented Feb 4, 2025

  • ✨ feat: add skip demo button to onboarding flow for faster user progression
  • ✨ add tooltip to guide users on long-press interaction in demo feed
  • ✨ feat: add demo mode to prevent database modifications in onboarding flow
  • ♻️ simplify event menu action handling by removing redundant modifying actions check

Summary by CodeRabbit

  • New Features
    • Added a prompt on the demo feed screen encouraging users to press and hold for options.
    • Introduced a new Skip Demo button on the demo intro screen for streamlined navigation.
    • Enhanced event interactions in demo mode, providing clear feedback when actions are disabled.
    • Extended demo mode support across various components to deliver a more cohesive experience.

Copy link

linear bot commented Feb 4, 2025

Copy link

vercel bot commented Feb 4, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
soonlist-turbo ⬜️ Skipped (Inspect) Feb 5, 2025 0:30am

Copy link
Contributor

coderabbitai bot commented Feb 4, 2025

Walkthrough

This pull request introduces several updates focused on a new demo mode. A new text prompt is added to the demo feed screen, and a new SkipDemoButton component is integrated into the demo intro screen. The button manages onboarding completion, navigation, and error handling. Additionally, components such as EventMenu and UserEventsList are enhanced with a new boolean property, demoMode, which adjusts the control flow—disabling actions or modifying rendering when active. Minor alterations to function signatures and UI layout reorganizations support these changes without altering core functionality.

Changes

File(s) Change Summary
apps/expo/src/app/(onboarding)/.../demo-feed.tsx and apps/expo/src/app/(onboarding)/.../demo-intro.tsx Added a new text prompt in DemoFeedScreen and integrated a new SkipDemoButton in DemoIntroScreen; modified layout and updated function signature (removed async in handlePress)
apps/expo/src/components/EventMenu.tsx Introduced an optional demoMode property in EventMenuProps and adjusted handleMenuSelect to disable actions (with a toast notification) when demoMode is active
apps/expo/src/components/SkipDemoButton.tsx Added a new component to manage skip demo functionality including state management, navigation via expo-router, and error handling with toast notifications
apps/expo/src/components/UserEventsList.tsx Updated interfaces for UserEventListItemProps and UserEventsListProps by adding a demoMode?: boolean property and passing the prop to child components

Sequence Diagram(s)

sequenceDiagram
    participant DemoIntroScreen
    participant SkipDemoButton
    participant AppStore
    participant RevenueCat
    participant Router
    participant Toast

    DemoIntroScreen->>SkipDemoButton: Render SkipDemoButton
    SkipDemoButton->>SkipDemoButton: onPress triggered
    SkipDemoButton->>AppStore: setHasCompletedOnboarding()
    AppStore-->>SkipDemoButton: Confirmation received
    SkipDemoButton->>RevenueCat: showProPaywallIfNeeded()
    RevenueCat-->>SkipDemoButton: (Response from RevenueCat)
    SkipDemoButton->>Router: navigate("/feed")
    alt Error Occurred
        SkipDemoButton->>Toast: Display error message
    end
Loading
sequenceDiagram
    participant User
    participant EventMenu
    participant Toast

    User->>EventMenu: Click menu option
    alt demoMode is active
        EventMenu->>Toast: Show "action disabled" notification
        Note over EventMenu: Exit without further processing
    else
        EventMenu->>EventMenu: Process menu selection normally
    end
Loading

Possibly Related PRs

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46b197c and 5f9076c.

📒 Files selected for processing (1)
  • apps/expo/src/components/UserEventsList.tsx (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/expo/src/components/UserEventsList.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot changed the title Update header titles for DemoFeedScreen and DemoCaptureScreen @coderabbitai Update header titles for DemoFeedScreen and DemoCaptureScreen Add demo mode UI changes with SkipDemoButton and demoMode prop Feb 4, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (5)
apps/expo/src/components/SkipDemoButton.tsx (3)

14-24: Consider wrapping with error boundary for better error handling.

While the hooks usage is appropriate, consider wrapping the component with an error boundary to gracefully handle potential hook failures, especially for useRevenueCat which might involve external API calls.

+import { ErrorBoundary } from "~/components/ErrorBoundary";

 export function SkipDemoButton({
   className = "",
   textClassName = "text-sm text-neutral-2",
 }: SkipDemoButtonProps) {
+  return (
+    <ErrorBoundary fallback={<Text>Unable to load skip button</Text>}>
+      <SkipDemoButtonContent className={className} textClassName={textClassName} />
+    </ErrorBoundary>
+  );
+}
+
+function SkipDemoButtonContent({
+  className = "",
+  textClassName = "text-sm text-neutral-2",
+}: SkipDemoButtonProps) {

25-40: Enhance error handling with specific error types.

The error handling could be more specific to provide better user feedback based on the type of error.

   try {
     setHasCompletedOnboarding(true);
     await showProPaywallIfNeeded();
     router.push("/feed");
   } catch (error) {
+    const errorMessage = error instanceof Error ? error.message : "Something went wrong";
+    const description = error instanceof Error && error.cause 
+      ? String(error.cause) 
+      : "Please try again";
     toast.error("Something went wrong", {
-      description: "Please try again",
+      description,
     });
+    // Log error for monitoring
+    console.error("Skip demo failed:", errorMessage);
   } finally {

42-53: Enhance accessibility for better user experience.

Add accessibility props to improve the experience for screen reader users.

 <Pressable
   onPress={handlePress}
   disabled={isLoading}
   className={`py-2 ${className}`}
+  accessibilityRole="button"
+  accessibilityState={{ disabled: isLoading }}
+  accessibilityLabel="Skip demo"
+  accessibilityHint="Skips the demo and proceeds to the main feed"
 >
apps/expo/src/app/(onboarding)/onboarding/demo-intro.tsx (2)

148-154: Consider RTL layout support.

The layout uses left positioning and transform which might need adjustment for RTL languages.

-<View className="absolute bottom-48 left-1/2 flex -translate-x-1/2 flex-col items-center space-y-2">
+<View className="absolute bottom-48 start-1/2 flex -translate-x-1/2 flex-col items-center space-y-2">

116-167: Consider performance optimization for animations.

The bottom section uses multiple layers (BlurView, LinearGradient) and animations which could impact performance on lower-end devices.

Consider:

  1. Using useCallback for animation setup
  2. Memoizing gradient styles
  3. Using lighter blur intensity
+const gradientStyle = {
+  position: "absolute" as const,
+  height: "100%",
+  width: "100%",
+};

+const purpleGradient = {
+  ...gradientStyle,
+  opacity: 0.3,
+};

+const lightGradient = {
+  ...gradientStyle,
+  opacity: 0.1,
+};

 <BlurView
-  intensity={10}
+  intensity={5}
   className="h-full w-full opacity-20"
   tint="light"
 />
 // ...
 <LinearGradient
   colors={["transparent", "#5A32FB"]}
   locations={[0, 1]}
-  style={{
-    position: "absolute",
-    height: "100%",
-    width: "100%",
-    opacity: 0.3,
-  }}
+  style={purpleGradient}
 />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 141d3f8 and 46b197c.

📒 Files selected for processing (5)
  • apps/expo/src/app/(onboarding)/onboarding/demo-feed.tsx (3 hunks)
  • apps/expo/src/app/(onboarding)/onboarding/demo-intro.tsx (4 hunks)
  • apps/expo/src/components/EventMenu.tsx (3 hunks)
  • apps/expo/src/components/SkipDemoButton.tsx (1 hunks)
  • apps/expo/src/components/UserEventsList.tsx (6 hunks)
🧰 Additional context used
🪛 GitHub Check: lint
apps/expo/src/components/UserEventsList.tsx

[failure] 346-346:
'demoMode' is assigned a value but never used. Allowed unused vars must match /^_/u

🔇 Additional comments (8)
apps/expo/src/app/(onboarding)/onboarding/demo-feed.tsx (2)

163-167: LGTM! Well-positioned tooltip for user guidance.

The tooltip is appropriately positioned and styled, providing clear instructions for the long-press interaction.


169-178: LGTM! Proper integration of demo mode.

The demoMode prop is correctly passed to the UserEventsList component, enabling demo mode functionality.

apps/expo/src/components/EventMenu.tsx (2)

58-58: LGTM! Clean prop interface update.

The demoMode prop is properly added with a sensible default value.

Also applies to: 85-85


282-285: LGTM! Proper demo mode handling.

The implementation correctly prevents any actions from being executed in demo mode and provides appropriate user feedback.

apps/expo/src/components/UserEventsList.tsx (2)

63-63: LGTM! Clean prop interface update.

The demoMode prop is properly added to the UserEventListItem component.

Also applies to: 72-72


130-136: LGTM! Proper prop passing.

The demoMode prop is correctly passed down to the EventMenu component.

apps/expo/src/components/SkipDemoButton.tsx (1)

1-12: LGTM! Clean imports and well-defined interface.

The imports are appropriate and the interface is well-defined with optional styling props.

apps/expo/src/app/(onboarding)/onboarding/demo-intro.tsx (1)

18-18: Verify the removal of async from handlePress.

The handlePress function is no longer async but still handles async operations (router.push). While this works, verify that this change doesn't affect error handling or navigation behavior.

Also applies to: 45-58

✅ Verification successful

Let's run an updated shell script to inspect the usage of router.push and the definition of the handlePress function in the demo-intro file. We'll use explicit glob patterns to handle .tsx files correctly.


Verified removal of async from handlePress does not affect navigation behavior.

  • The handlePress function is declared synchronously (line 45) and calls router.push("/onboarding/demo-capture").
  • No evidence of additional error handling was required or expected, and similar navigation methods in the codebase follow this pattern.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other router.push usages to verify consistency
rg "router\.push" --type ts --type tsx

Length of output: 68


Script:

#!/bin/bash
echo "Searching for router.push usage in demo-intro.tsx:"
rg "router\.push" --glob="*.tsx" apps/expo/src/app/\(onboarding\)/onboarding/demo-intro.tsx

echo ""
echo "Searching for handlePress definition in demo-intro.tsx:"
rg -n "handlePress" --glob="*.tsx" apps/expo/src/app/\(onboarding\)/onboarding/demo-intro.tsx

Length of output: 546


Script:

#!/bin/bash
echo "Displaying context around handlePress definition in demo-intro.tsx:"
rg -C 10 "const handlePress = \(\) =>" apps/expo/src/app/(onboarding)/onboarding/demo-intro.tsx

Length of output: 423

@jaronheard jaronheard merged commit 68ad680 into main Feb 5, 2025
7 of 8 checks passed
@jaronheard jaronheard deleted the jaronheard/tim-839-enhance-demo-section-guidance branch February 5, 2025 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant