Skip to content

Redirection changes - #61

Merged
dev-rathore merged 2 commits into
devfrom
initial-redirection-issues-resolved
Jan 9, 2025
Merged

dev-rathore merged 2 commits into
devfrom
initial-redirection-issues-resolved

Conversation

@dev-rathore

@dev-rathore dev-rathore commented Jan 8, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added a new "pre-signin" screen in the authentication flow
    • Introduced enhanced navigation logic for user sessions
  • Refactor

    • Simplified authentication and navigation routing
    • Removed public layout component
    • Updated root layout navigation handling
    • Simplified pathnames in routing for onboarding screens
  • Improvements

    • Streamlined user authentication and navigation experience

@dev-rathore dev-rathore self-assigned this Jan 8, 2025
@coderabbitai

coderabbitai Bot commented Jan 8, 2025 •

Copy link
Copy Markdown

Walkthrough

The pull request introduces changes to the authentication and navigation flow in a React Native application. A new "pre-signin" screen has been added to the authentication layout, and the root layout navigation logic has been modified to handle session-based routing more dynamically. The changes remove previous onboarding group checks and implement a more direct navigation approach across both web and non-web platforms. Additionally, the PublicLayout component has been removed, and several routing paths have been simplified.

Changes

File Change Summary
app/(auth)/_layout.tsx Added a new Stack.Screen for "pre-signin" route with headerShown set to false
app/(public)/_layout.tsx Removed the entire PublicLayout component
app/_layout.tsx - Imported resetAndNavigate function
- Refactored navigation logic for session handling
- Modified routing conditions for session existence
app/(main)/(screens)/(onboarding)/onboarding-your-brand.tsx Updated pathname in handleCreateBrand function from "/(onboarding)/onboarding-get-started" to "/onboarding-get-started"
components/drawer-layout/DrawerMenuContent.tsx Changed router.push pathname from "/(onboarding)/onboarding-your-brand" to "/onboarding-your-brand"
contexts/auth-context.provider.tsx Updated pathname in signUp function from "/(onboarding)/onboarding-your-brand" to "/onboarding-your-brand"

Possibly related PRs

  • Redirection fixes #59: Modifications to navigation logic in app/_layout.tsx, handling the "/pre-signin" path

Suggested reviewers

  • Manan-Sharma-5

Poem

🐰 A rabbit's tale of routes anew,
Where signin paths are crisp and true,
No headers block, no onboard's might,
Just smooth navigation, pure delight!
Hop along the auth's new way, 🚀

Finishing Touches

  • 📝 Generate Docstrings

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 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/_layout.tsx (1)

120-133: Navigation logic looks good, consider adding error boundaries

The simplified navigation logic is clear and handles the session states appropriately. However, consider adding error handling for edge cases where navigation might fail.

 if (
   session
   && (inAuthGroup || pathname === "/")
 ) {
   // On boot up, session exist and user is in auth group or /, redirect to collaborations
-  resetAndNavigate("/explore-influencers");
+  try {
+    resetAndNavigate("/explore-influencers");
+  } catch (error) {
+    console.error("Navigation failed:", error);
+    // Implement fallback navigation or error reporting
+  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 683d0b1 and a6b5506.

📒 Files selected for processing (4)
  • app/(main)/(screens)/(onboarding)/onboarding-your-brand.tsx (1 hunks)
  • app/_layout.tsx (3 hunks)
  • components/drawer-layout/DrawerMenuContent.tsx (1 hunks)
  • contexts/auth-context.provider.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • contexts/auth-context.provider.tsx
🔇 Additional comments (4)
app/_layout.tsx (2)

145-146: Stack screen configuration is consistent

The screen configuration aligns well with the navigation changes. The headerShown option is consistently applied.

✅ Verification successful

Stack screen configuration verified successfully

Both (main) and (auth) screen groups have their corresponding layout files properly implemented in the expected locations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the existence of corresponding layout files for (main) and (auth) groups
echo "Checking for layout files:"
fd -e tsx -e ts "(_layout|index)\.(tsx|ts)" app/\(main\)
fd -e tsx -e ts "(_layout|index)\.(tsx|ts)" app/\(auth\)

Length of output: 330


40-40: Verify the implementation of resetAndNavigate utility

The new utility function appears to handle both navigation reset and redirection. Let's verify its implementation to ensure it properly handles navigation state.

✅ Verification successful

Verified: resetAndNavigate utility is properly implemented and used

The utility function in utils/router.ts correctly handles navigation state by clearing the stack when possible and replacing the current route. Its usage in the authentication flow follows best practices for route management.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the implementation and usage of resetAndNavigate
echo "Searching for resetAndNavigate implementation:"
rg -l "resetAndNavigate" --type ts
echo "\nSearching for resetAndNavigate definition:"
ast-grep --pattern 'export function resetAndNavigate($_) {
  $$$
}'

Length of output: 373


Script:

#!/bin/bash
# Get the implementation and surrounding context
echo "Content of utils/router.ts:"
cat utils/router.ts

echo -e "\nUsage in auth context:"
rg -A 5 -B 5 "resetAndNavigate" contexts/auth-context.provider.tsx

Length of output: 1569

app/(main)/(screens)/(onboarding)/onboarding-your-brand.tsx (1)

94-94: Verify navigation flow after pathname simplification

The pathname has been simplified from "/(onboarding)/onboarding-get-started" to "/onboarding-get-started". While this aligns with the PR's goal of simplifying routes, we should ensure the new path is properly configured in the router.

✅ Verification successful

Navigation path simplification is correctly implemented

The simplified pathname /onboarding-get-started aligns with the Next.js app router structure and the file exists at the correct location. No references to the old path format were found, confirming a clean transition.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new route path exists and there are no references to the old path
# Check for route configuration
fd -e tsx -e ts "onboarding-get-started" app/

# Check for any remaining references to the old path format
rg "\(/\(onboarding\)/onboarding-get-started\)" 

Length of output: 156


Script:

#!/bin/bash
# Search for all references to the route
rg "onboarding-get-started" -A 2 -B 2

# Look for navigation patterns (push, replace, href)
rg "(href|push|replace).*onboarding-get-started"

Length of output: 534

components/drawer-layout/DrawerMenuContent.tsx (1)

245-245: Verify drawer navigation with simplified pathname

The pathname has been simplified from "/(onboarding)/onboarding-your-brand" to "/onboarding-your-brand". This change is consistent with the PR's routing simplification, but we should verify the drawer navigation still works correctly.

✅ Verification successful

Pathname change is correct and consistent with routing system

The simplified pathname /onboarding-your-brand matches the expected URL structure in Expo Router, where route groups (folders in parentheses) don't affect the final URL path. The drawer navigation will work correctly with this change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new route path exists and there are no references to the old path
# Check for route configuration
fd -e tsx -e ts "onboarding-your-brand" app/

# Check for any remaining references to the old path format
rg "\(/\(onboarding\)/onboarding-your-brand\)" 

# Check if there are any other drawer menu items still using the old format
rg "\(/\([^)]+\)/" components/drawer-layout/

Length of output: 200


Script:

#!/bin/bash
# Check the content of the page file
cat "app/(main)/(screens)/(onboarding)/onboarding-your-brand.tsx"

# Look for route configuration files
fd "route|page" app/

# Search for route mapping patterns or configuration
rg -g "!*.{json,md}" "export const runtime|export const dynamic|rewrite|redirect" app/

Length of output: 4018

@dev-rathore
dev-rathore merged commit 71f9778 into dev Jan 9, 2025
dev-rathore added a commit that referenced this pull request Jan 10, 2025
* pushed new contract screens

* fixed member container

* Redesign application and invitation cards (#51)

* redesign application and invitation cards

* added keyboard view

* fixes

* added underline in file attachment

* ui-feedback

* added work

* minor changes

* Repurpose messaging screen (#53)

* repurpose messaging screen

* accept application changes

* added phases

* invitationId as influencerId

* fixed signup signin

* fix: bug on brand creation

* minor changes

* minor changes

* minor changes

* minor changes

* pushed a minor change

* fix: accept application (#56)

* fix: accept application

* fix: managerId

* ui fix

* Redirection fixes (#59)

* fix: initial redirections

* scheme change

* router navigate fix

* router navigate fix

* Redirection changes (#61)

* redirection changes

* redirection changes

* image component and other fixes

* No brands protected screen implementation (#64)

* added no brands protected screen and shimmer ui

* shimmer ui update

* added loading indicator

---------

Co-authored-by: Manan Sharma <112090668+Manan-Sharma-5@users.noreply.github.com>
dev-rathore added a commit that referenced this pull request Jan 15, 2025
* pushed new contract screens

* fixed member container

* Redesign application and invitation cards (#51)

* redesign application and invitation cards

* added keyboard view

* fixes

* added underline in file attachment

* ui-feedback

* added work

* minor changes

* Repurpose messaging screen (#53)

* repurpose messaging screen

* accept application changes

* added phases

* invitationId as influencerId

* fixed signup signin

* fix: bug on brand creation

* minor changes

* minor changes

* minor changes

* minor changes

* pushed a minor change

* fix: accept application (#56)

* fix: accept application

* fix: managerId

* ui fix

* Redirection fixes (#59)

* fix: initial redirections

* scheme change

* router navigate fix

* router navigate fix

* Redirection changes (#61)

* redirection changes

* redirection changes

* image component and other fixes

* No brands protected screen implementation (#64)

* added no brands protected screen and shimmer ui

* shimmer ui update

* added loading indicator

* brand protected screen bug fix

* shared-uis conflict

* shared-uis conflict

* fix: build

* pushed ui fixes

* social button change

* Bug fixes (#68)

* bug fixes

* bug fixes

* message screen fix

* pushed ui fix

* pushed icons

* Bug fixes (#69)

* bug fixes

* render html, location address, and rating section

* refactored code

* refactor

* refactor

* location address changes

* messages icons changes

---------

Co-authored-by: Manan Sharma <112090668+Manan-Sharma-5@users.noreply.github.com>
dev-rathore added a commit that referenced this pull request Jan 23, 2025
* pushed new contract screens

* fixed member container

* Redesign application and invitation cards (#51)

* redesign application and invitation cards

* added keyboard view

* fixes

* added underline in file attachment

* ui-feedback

* added work

* minor changes

* Repurpose messaging screen (#53)

* repurpose messaging screen

* accept application changes

* added phases

* invitationId as influencerId

* fixed signup signin

* fix: bug on brand creation

* minor changes

* minor changes

* minor changes

* minor changes

* pushed a minor change

* fix: accept application (#56)

* fix: accept application

* fix: managerId

* ui fix

* Redirection fixes (#59)

* fix: initial redirections

* scheme change

* router navigate fix

* router navigate fix

* Redirection changes (#61)

* redirection changes

* redirection changes

* image component and other fixes

* No brands protected screen implementation (#64)

* added no brands protected screen and shimmer ui

* shimmer ui update

* added loading indicator

* brand protected screen bug fix

* shared-uis conflict

* shared-uis conflict

* fix: build

* pushed ui fixes

* social button change

* Bug fixes (#68)

* bug fixes

* bug fixes

* message screen fix

* pushed ui fix

* pushed icons

* Bug fixes (#69)

* bug fixes

* render html, location address, and rating section

* refactored code

* refactor

* refactor

* location address changes

* messages icons changes

* pushed new icons

* pushed brand modal fixes

* pushed changes

* Icons changes (#73)

* icons changes

* icons changes

* email verification

* changed icon

* pushed slight change to dev for a slight route change

* merge conflict

* refactor code (#75)

---------

Co-authored-by: Manan Sharma <112090668+Manan-Sharma-5@users.noreply.github.com>
dev-rathore added a commit that referenced this pull request Jan 27, 2025
* pushed new contract screens

* fixed member container

* Redesign application and invitation cards (#51)

* redesign application and invitation cards

* added keyboard view

* fixes

* added underline in file attachment

* ui-feedback

* added work

* minor changes

* Repurpose messaging screen (#53)

* repurpose messaging screen

* accept application changes

* added phases

* invitationId as influencerId

* fixed signup signin

* fix: bug on brand creation

* minor changes

* minor changes

* minor changes

* minor changes

* pushed a minor change

* fix: accept application (#56)

* fix: accept application

* fix: managerId

* ui fix

* Redirection fixes (#59)

* fix: initial redirections

* scheme change

* router navigate fix

* router navigate fix

* Redirection changes (#61)

* redirection changes

* redirection changes

* image component and other fixes

* No brands protected screen implementation (#64)

* added no brands protected screen and shimmer ui

* shimmer ui update

* added loading indicator

* brand protected screen bug fix

* shared-uis conflict

* shared-uis conflict

* fix: build

* pushed ui fixes

* social button change

* Bug fixes (#68)

* bug fixes

* bug fixes

* message screen fix

* pushed ui fix

* pushed icons

* Bug fixes (#69)

* bug fixes

* render html, location address, and rating section

* refactored code

* refactor

* refactor

* location address changes

* messages icons changes

* pushed new icons

* pushed brand modal fixes

* pushed changes

* Icons changes (#73)

* icons changes

* icons changes

* email verification

* changed icon

* pushed slight change to dev for a slight route change

* merge conflict

* refactor code (#75)

* feedbacks resolved (#77)

* pushed changes

* Feedbacks resolved (#79)

* feedbacks resolved

* max width refactor

* removed unused imports

* reusable component fix

---------

Co-authored-by: Manan Sharma <112090668+Manan-Sharma-5@users.noreply.github.com>
This was referenced Jan 28, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Mar 22, 2025
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.

2 participants