Skip to content

No brands protected screen implementation - #64

Merged
dev-rathore merged 3 commits into
devfrom
protected-screen-implementation
Jan 10, 2025
Merged

dev-rathore merged 3 commits into
devfrom
protected-screen-implementation

Conversation

@dev-rathore

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

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a splash image to the home screen
    • Introduced a brand protection mechanism for app access
    • Created a shimmer loading effect for explore influencer section
  • Improvements

    • Enhanced theme configuration with new shimmer color properties
    • Implemented loading screen for brand verification process
  • Chores

    • Updated shared UI subproject commit

The release focuses on improving user experience with visual enhancements and access control mechanisms.

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

coderabbitai Bot commented Jan 10, 2025 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@dev-rathore has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6bc1851 and 7256453.

📒 Files selected for processing (3)
  • app/(main)/(screens)/(onboarding)/onboarding-your-brand.tsx (1 hunks)
  • layouts/protected/brand-protected-screen.tsx (1 hunks)
  • shared-uis (1 hunks)

Walkthrough

The pull request introduces a new BrandProtectedScreen component that adds a layer of protection to the application's drawer layout. This component checks for brand associations with a manager's ID and conditionally renders content or a loading screen. Accompanying changes include a new shimmer component for loading states, color constants for shimmer effects, and updates to the main application index page to include a splash image.

Changes

File Change Summary
app/(main)/(drawer)/_layout.tsx Added BrandProtectedScreen wrapper around Drawer component
app/index.tsx Added Image import and splash image in centered View
components/shimmers/explore-influencer-shimmer.tsx New shimmer component for loading states with dynamic sections
constants/Colors.ts Added shimmerBackground and shimmerOverlay theme colors
layouts/protected/brand-protected-screen.tsx New component to manage content display based on brand associations
layouts/protected/index.ts Imported and exported BrandProtectedScreen
shared-uis Updated subproject commit reference

Sequence Diagram

sequenceDiagram
    participant User
    participant BrandProtectedScreen
    participant AuthContext
    participant Firestore
    participant App

    User->>BrandProtectedScreen: Enters App
    BrandProtectedScreen->>AuthContext: Get Manager ID
    AuthContext-->>BrandProtectedScreen: Return Manager ID
    BrandProtectedScreen->>Firestore: Fetch Brands
    Firestore-->>BrandProtectedScreen: Return Brand Data
    alt Brands Found
        BrandProtectedScreen->>App: Render App Content
    else No Brands
        BrandProtectedScreen->>App: Redirect to Onboarding
    end
Loading

Possibly related PRs

Suggested reviewers

  • Manan-Sharma-5

Poem

🐰 A Rabbit's Ode to Protected Screens 🚀

In drawers of code, a guardian stands tall,
Checking brands with a shimmer's gentle call,
Loading states dance, a pixel-perfect art,
Protecting content, playing its smart part!

Hop, hop, hooray for screens so bright! 🌟


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: 3

🧹 Nitpick comments (5)
layouts/protected/brand-protected-screen.tsx (2)

18-23: Add type safety for manager object.

The manager object from useAuthContext lacks type safety.

+ interface Manager {
+   id: string;
+   // add other relevant fields
+ }
+
+ const {
+   manager,
+ } = useAuthContext() as { manager: Manager | null };

67-87: Consider adding a loading state timeout.

The loading screen could potentially show indefinitely if there are network issues or slow queries.

 const LoadingScreen: React.FC = () => {
   const theme = useTheme();
+  const [showTimeout, setShowTimeout] = useState(false);
+
+  useEffect(() => {
+    const timer = setTimeout(() => setShowTimeout(true), 10000);
+    return () => clearTimeout(timer);
+  }, []);
+
+  if (showTimeout) {
+    return (
+      <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
+        <Text>Taking longer than expected...</Text>
+        {/* Consider adding a retry button */}
+      </View>
+    );
+  }

   if (Platform.OS === "web") {
     // ... existing code ...
   }
components/shimmers/explore-influencer-shimmer.tsx (3)

12-14: Add TypeScript interface for component props.

Even if the component doesn't accept props currently, it's good practice to explicitly define the interface for maintainability.

+interface ExploreInfluencerShimmerProps {}
+
-const ExploreInfluencerShimmer = () => {
+const ExploreInfluencerShimmer: React.FC<ExploreInfluencerShimmerProps> = () => {

20-25: Extract magic numbers into named constants.

The Shimmer dimensions and counts are hardcoded. Consider extracting these values into named constants for better maintainability.

+const SHIMMER_DIMENSIONS = {
+  HEADER_DROPDOWN: { width: 80, height: 36 },
+  PROFILE_IMAGE: { width: 50, height: 50 },
+  PROFILE_NAME: { width: 150, height: 20 },
+  PROFILE_INFO: { width: 100, height: 16 },
+  MAIN_CONTENT: { height: 300 },
+  METRIC: { width: 50, height: 24 },
+  BOTTOM_NAV: { width: 56, height: 48 },
+} as const;

Also applies to: 39-43, 46-46, 49-51, 53-53


69-108: Consider enhancing theme support in styles.

While the layout styling is well-organized, consider:

  1. Using theme-aware background colors for better dark mode support
  2. Extracting common spacing values (16, 12, 4) into constants
+const SPACING = {
+  SMALL: 4,
+  MEDIUM: 12,
+  LARGE: 16,
+} as const;

 const styles = StyleSheet.create({
   container: {
     flex: 1,
-    paddingHorizontal: 16,
+    paddingHorizontal: SPACING.LARGE,
+    backgroundColor: Colors(theme).background,
   },
   // ... rest of the styles
 });
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 12d301f and 6bc1851.

📒 Files selected for processing (7)
  • app/(main)/(drawer)/_layout.tsx (1 hunks)
  • app/index.tsx (1 hunks)
  • components/shimmers/explore-influencer-shimmer.tsx (1 hunks)
  • constants/Colors.ts (2 hunks)
  • layouts/protected/brand-protected-screen.tsx (1 hunks)
  • layouts/protected/index.ts (1 hunks)
  • shared-uis (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • layouts/protected/index.ts
  • shared-uis
🔇 Additional comments (5)
app/index.tsx (1)

1-20: LGTM! Clean splash screen implementation.

The splash screen is well-implemented with proper styling to ensure the image fills the entire screen.

app/(main)/(drawer)/_layout.tsx (1)

5-28: LGTM! Clean integration of BrandProtectedScreen.

The BrandProtectedScreen component is properly integrated while maintaining existing drawer functionality.

constants/Colors.ts (1)

22-23: LGTM! Well-defined shimmer effect colors.

The shimmer colors are appropriately defined for both themes with good contrast ratios.

Also applies to: 38-39

components/shimmers/explore-influencer-shimmer.tsx (2)

1-11: LGTM! Clean and well-organized imports.

The imports are properly structured with core dependencies first, followed by third-party libraries and local imports.


110-110: LGTM! Clean export statement.

The default export is appropriate for this component.

@dev-rathore
dev-rathore merged commit 3a7ff25 into dev Jan 10, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Jan 10, 2025
Merged
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>
@coderabbitai coderabbitai Bot mentioned this pull request Jan 11, 2025
Merged
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>
@coderabbitai coderabbitai Bot mentioned this pull request Jan 25, 2025
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 29, 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