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

fix: QA fixes for verify screens #3337

Merged
merged 12 commits into from
Dec 12, 2024
Merged

fix: QA fixes for verify screens #3337

merged 12 commits into from
Dec 12, 2024

Conversation

bistaastha
Copy link
Contributor

@bistaastha bistaastha commented Dec 12, 2024

Includes the following fixes:

  • Font weight and spacing fixes
  • Fix for Loader on Invite expired page
  • Adds Toast message on Reset password page
  • Adds icon beside error messages

Reference thread for design qa: https://fylein.slack.com/archives/C07PA9SACCR/p1733835884139739

Summary by CodeRabbit

  • New Features

    • Enhanced user feedback with new icons for error messages on password fields.
    • Improved button functionality with loading indicators during invite sending.
    • Stricter password validation criteria implemented for better security.
  • Bug Fixes

    • Consistent text capitalization across various pages for improved user experience.
  • Style

    • Updated styles for error messages and headers to enhance layout and visual consistency.
  • Tests

    • Refined test cases for the Reset Password component to ensure accurate user feedback and error handling.

Copy link

coderabbitai bot commented Dec 12, 2024

Warning

Rate limit exceeded

@bistaastha has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 13 minutes and 0 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 7f19293 and 868fd51.

📒 Files selected for processing (1)
  • src/app/core/services/loader.service.spec.ts (1 hunks)

Walkthrough

The pull request introduces modifications across several HTML and SCSS files related to the authentication flow. Key changes include updates to text casing for consistency, the addition of icons for error messages, and enhancements to styles for improved layout. The logic for displaying error messages and handling password validation has also been refined. These updates aim to enhance the user interface and provide clearer feedback without altering the underlying functionality.

Changes

File Path Change Summary
src/app/auth/disabled/disabled.page.html Changed text "Back to Sign In" to "Back to sign in."
src/app/auth/new-password/new-password.page.html Updated header "Reset Password" to "Reset password," changed "Back to Sign In" to "Back to sign in," and added icons for error messages.
src/app/auth/new-password/new-password.page.scss Added display: flex; align-items: center; to &__error and font-weight: 500; to &__form-header.
src/app/auth/pending-verification/pending-verification.page.html Changed "Registered Email" to "Registered email," added new attributes to the invite button, and updated "Back to Sign In" to "Back to sign in."
src/app/auth/pending-verification/pending-verification.page.scss Added font-weight: 500; to .pending-verification__page-header and introduced .pending-verification__error-message with new properties.
src/app/auth/reset-password/reset-password.page.html Updated "Forgot Password" to "Forgot password," changed error message to "Enter an email address," and modified "Back to Sign In" to "Back to sign in."
src/app/auth/reset-password/reset-password.page.scss Reduced margin-bottom to 6px and set font-weight: 500; for &__page-header; updated &__error-message to include display: flex; align-items: center;.
src/app/auth/reset-password/reset-password.page.ts Modified sendResetLink method to include a success toast message when the email is sent after the first attempt.
src/app/auth/verify/verify.page.scss Updated &__icon to include the loader mixin and changed dimensions to 40px for height and width.
src/app/post-verification/invited-user/invited-user.page.html Changed "Full Name" to "Full name," "Confirm Password" to "Confirm password," added error icons, and refined logic for error messages.
src/app/post-verification/invited-user/invited-user.page.scss Updated &__error to include display: flex; align-items: center; and set font-weight: 500; for &__form-header.
src/app/post-verification/invited-user/invited-user.page.ts Removed several password validation properties and updated validation criteria for passwords.
src/app/auth/reset-password/reset-password.page.spec.ts Updated test specifications for validation error messages and ensured comprehensive coverage of component functionality.
src/app/core/services/loader.service.ts Changed cssClass in showLoader method from 'custom-loading' to 'intermediate-loader' when no customLoaderUrl is provided.

Possibly related PRs

Suggested reviewers

  • Chethan-Fyle
  • arjunaj5

🎉 In the code, we make it right,
Text and styles shining bright!
Icons added, feedback clear,
User joy is what we cheer!
With each change, we pave the way,
For a smoother, brighter day! 🌟


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. (Experiment)
  • @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.

@github-actions github-actions bot added the size/M Medium PR label Dec 12, 2024
Copy link

PR title must start with "fix:", "feat:", "chore:", "refactor:", or "test:" (case-insensitive)

@bistaastha bistaastha changed the title Fyle qa fixes verify fix: QA fixes for verify screens Dec 12, 2024
Copy link

@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: 10

🧹 Outside diff range comments (1)
src/app/post-verification/invited-user/invited-user.page.html (1)

Line range hint 1-150: Let's make this form accessible to all fans!

The form needs some accessibility love for screen reader users.

Add these accessibility improvements:

+ aria-label="Toggle password visibility"

to password visibility toggle buttons, and:

+ role="alert"
+ aria-live="polite"

to error message containers.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 46a5063 and fe176b9.

📒 Files selected for processing (12)
  • src/app/auth/disabled/disabled.page.html (1 hunks)
  • src/app/auth/new-password/new-password.page.html (4 hunks)
  • src/app/auth/new-password/new-password.page.scss (2 hunks)
  • src/app/auth/pending-verification/pending-verification.page.html (4 hunks)
  • src/app/auth/pending-verification/pending-verification.page.scss (2 hunks)
  • src/app/auth/reset-password/reset-password.page.html (3 hunks)
  • src/app/auth/reset-password/reset-password.page.scss (2 hunks)
  • src/app/auth/reset-password/reset-password.page.ts (1 hunks)
  • src/app/auth/verify/verify.page.scss (1 hunks)
  • src/app/post-verification/invited-user/invited-user.page.html (6 hunks)
  • src/app/post-verification/invited-user/invited-user.page.scss (2 hunks)
  • src/app/post-verification/invited-user/invited-user.page.ts (1 hunks)
🔇 Additional comments (15)
src/app/auth/disabled/disabled.page.html (1)

28-28: Superstar approves this style consistency!

Like how I maintain my style in every movie, you've maintained consistent text casing across auth pages. The accessibility attributes are perfect too! This is what I call "En vazhi, thani vazhi" (My way is the unique way)!

src/app/auth/new-password/new-password.page.scss (2)

22-24: Style panrom! (We're styling it!)

The flex layout for error messages is perfect, like my perfectly choreographed fight scenes! The alignment will ensure error messages look sharp and professional.


86-86: Perfect font weight, just like my perfect timing!

The font-weight: 500 for the form header gives it the right emphasis without being too bold. Like how I balance action and style, this balances visibility and aesthetics!

src/app/post-verification/invited-user/invited-user.page.scss (3)

22-24: Mind-blowing flex alignment, partner!

The flex display and center alignment create a powerful visual connection between icon and error message. When style meets functionality, magic happens!


26-29: Perfect dimensions for the error icon, like a well-choreographed action sequence!

The 14px height and width with 4px margin-right create a balanced visual rhythm. Keep rocking the pixel-perfect precision!


87-87: Font-weight 500 makes the form header stand tall and proud!

The medium weight gives the header the authority it deserves, creating a strong visual hierarchy. Style makku style!

src/app/auth/reset-password/reset-password.page.scss (3)

20-21: Superstar spacing adjustment, mind it!

Reducing margin-bottom to 6px and adding font-weight: 500 creates a perfect balance. The header now commands attention without overwhelming the content below!


36-40: Error icon styling maintains perfect harmony across components!

The dimensions match perfectly with the invited-user page, creating a consistent experience. That's what I call style consistency!


44-45: Flex power for error messages, what a performance!

The flex display and center alignment create a professional look that matches our other components. When you maintain consistency, you maintain quality!

src/app/auth/pending-verification/pending-verification.page.scss (2)

48-48: Mind-blowing style update, partner!

The font-weight: 500 gives the perfect balance to the page header. When style meets substance, magic happens!


66-74: Superstar error message styling, I tell you!

The error message styling with flex layout and icon is a knockout combination! But listen carefully, we need to verify if this icon exists in our assets.

✅ Verification successful

The previous search might have failed because we were looking for specific content. Let's first find all SVG files and check how the error icon is referenced in the template, mind it! 🕶️


Mind it! The error icon is perfectly in place, like a well-timed punch dialogue!

I can confirm with style that the danger-fill.svg icon exists exactly where it should be at src/assets/svg/danger-fill.svg. And what's more powerful? The HTML template is using this very icon through mat-icon with svgIcon="danger-fill". This is not just a coincidence, this is destiny!

Like a perfectly choreographed action sequence, everything is synchronized:

  • The icon exists ✓
  • The template uses it correctly ✓
  • The styling matches perfectly ✓
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the danger-fill icon exists in assets
rg -g '*.svg' -l "danger-fill" 

Length of output: 30


Script:

#!/bin/bash
# Let's search for any SVG files in the repository, mind it!
fd -e svg

# And let's check the HTML template to see how this error icon is being used
rg -g '*.html' "error-message-icon" -A 2 -B 2

Length of output: 9288

src/app/auth/pending-verification/pending-verification.page.html (2)

91-91: Consistency in style, that's my signature move!

The "Back to sign in" text update maintains our style guide perfectly. When you do something, do it with style!


44-46: Loading state that dances like a boss!

The form button validation with loading state is a blockbuster addition! But let's make sure our custom directive is ready for action:

✅ Verification successful

Mind it! The loading state is perfectly set, like a well-oiled machine!

The directive is fully equipped with all the necessary inputs we need - loading, loadingText, and even a fancy loaderPosition. It's being used across multiple components in the shared module, which means it's battle-tested and ready to rock! When I make an entry, even the loading state makes a style statement!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify form button validation directive
rg -l "appFormButtonValidation" src/app/shared

Length of output: 614


Script:

#!/bin/bash
# Let's check the implementation of the directive to verify it handles loading state
ast-grep --pattern 'class FormButtonValidationDirective {
  $$$
}'

Length of output: 68


Script:

#!/bin/bash
# Mind it! Let's check the directive implementation with ripgrep, style!
rg -A 10 "export class FormButtonValidationDirective" src/app/shared/directive/form-button-validation.directive.ts

Length of output: 370

src/app/auth/new-password/new-password.page.html (2)

108-108: Style makeover done with style!

The capitalization change maintains consistency across all auth pages. That's what I call attention to detail!


87-96: ⚠️ Potential issue

Magizhchi! The error icons are perfect, but the password visibility needs a punch!

The password visibility toggle seems reversed. When hideConfirmPassword is true, it shows the text, but it should be the opposite.

Fix the type attribute in both password fields like this:

- [type]="hideConfirmPassword ? 'text': 'password'"
+ [type]="hideConfirmPassword ? 'password': 'text'"

Likely invalid or redundant comment.

@@ -94,7 +94,7 @@ export class InvitedUserPage implements OnInit {
this.isLoading = true;
this.fg.markAllAsTouched();
if (this.fg.valid) {
from(this.loaderService.showLoader())
from(this.loaderService.showLoader('Signing in...', 20000000))
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Mind it! The loader is properly handled, but that duration is still too long, macha!

Listen here, the code is following the correct pattern by calling hideLoader() in the finalize block - that's style! But keeping a loader running for 20000000 milliseconds (5.5 hours) is like waiting for a villain who's stuck in traffic!

Let's keep it simple and powerful:

-from(this.loaderService.showLoader('Signing in...', 20000000))
+from(this.loaderService.showLoader('Signing in...', 30000))

30 seconds is more than enough time for this operation. If it takes longer than that, better to show an error message to the user, just like how I deliver my punch dialogues - quick and effective! 🕶️

🔗 Analysis chain

Mind it! That loader duration is longer than my movie climax scenes!

Listen here, my friend! While showing "Signing in..." message is stylish like my signature moves, keeping the loader running for 20000000 milliseconds (5.5 hours) is like waiting for a villain who never shows up! 🕶️

Let's make it more reasonable, like this:

-from(this.loaderService.showLoader('Signing in...', 20000000))
+from(this.loaderService.showLoader('Signing in...', 30000))

Even if the network is slower than my punch, 30 seconds should be enough! If it takes longer, better to show an error message to the user, macha!

Also, verify if the loader is properly hidden in all scenarios:


The search results show that the hideLoader() method is consistently called in finalize() blocks across the codebase to ensure proper cleanup of loaders. Let me check if the same pattern is followed in the file under review.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if hideLoader is called in all error scenarios

# Search for showLoader calls and their corresponding hideLoader calls
echo "Checking loader patterns..."
rg -A 10 "showLoader|hideLoader" --type ts

Length of output: 71819


Script:

#!/bin/bash
# Check the saveData method implementation in the invited user page
rg -A 10 "saveData.*{" src/app/post-verification/invited-user/invited-user.page.ts

Length of output: 170


Script:

#!/bin/bash
# Check the saveData method implementation in the invited user page
rg -A 15 "saveData\(" src/app/post-verification/invited-user/invited-user.page.ts

Length of output: 779


Script:

#!/bin/bash
# Let's check the complete saveData method to see if hideLoader is called
rg -A 25 "saveData\(" src/app/post-verification/invited-user/invited-user.page.ts

Length of output: 1150

src/app/auth/verify/verify.page.scss Outdated Show resolved Hide resolved
Comment on lines 26 to 29
&__error-message-icon {
height: 14px;
width: 14px;
margin-right: 4px;
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Mind it! These dimensions need a small adjustment!

The error icon dimensions (14x14) might be too small for proper visibility, especially on mobile devices. Like how I make my presence felt in every scene, let's make these icons more noticeable!

Try this style, partner:

-    height: 14px;
-    width: 14px;
+    height: 16px;
+    width: 16px;
📝 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
&__error-message-icon {
height: 14px;
width: 14px;
margin-right: 4px;
&__error-message-icon {
height: 16px;
width: 16px;
margin-right: 4px;

Comment on lines +62 to +73
next: () => {
this.currentPageState = PageState.success;
if (this.isEmailSentOnce) {
const toastMessageData = {
message: ' Password recovery email sent successfully.',
};
this.matSnackBar.openFromComponent(ToastMessageComponent, {
...this.snackbarProperties.setSnackbarProperties('success', toastMessageData),
panelClass: ['msb-success'],
});
}
},
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Epic success handling, but watch out for that sneaky space!

The success handling is powerful, showing toast messages only when needed. But there's a small villain in your message - a leading space!

Let's fix that space with style:

-              message: ' Password recovery email sent successfully.',
+              message: 'Password recovery email sent successfully.',
📝 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
next: () => {
this.currentPageState = PageState.success;
if (this.isEmailSentOnce) {
const toastMessageData = {
message: ' Password recovery email sent successfully.',
};
this.matSnackBar.openFromComponent(ToastMessageComponent, {
...this.snackbarProperties.setSnackbarProperties('success', toastMessageData),
panelClass: ['msb-success'],
});
}
},
next: () => {
this.currentPageState = PageState.success;
if (this.isEmailSentOnce) {
const toastMessageData = {
message: 'Password recovery email sent successfully.',
};
this.matSnackBar.openFromComponent(ToastMessageComponent, {
...this.snackbarProperties.setSnackbarProperties('success', toastMessageData),
panelClass: ['msb-success'],
});
}
},

💡 Codebase verification

Mind it! Your toast messages need accessibility superpowers!

Listen here, style-ah! The toast message template is missing critical accessibility attributes that would make it a blockbuster for all users. Here's what needs to be fixed, like a powerful punch dialogue:

  • Add role="alert" and aria-live="polite" to the root container div to announce toast messages to screen readers
  • Add aria-label to the close button icon for better screen reader navigation
  • Add proper button roles and keyboard interaction for clickable elements

Example fix:

<div class="toast-message--container d-flex" role="alert" aria-live="polite">
  <!-- ... other elements ... -->
  <button *ngIf="data.redirectionText" class="toast-message--redirection" (click)="actionEvent()" role="button">
    {{data.redirectionText}}
  </button>
  <button *ngIf="data.showCloseButton" class="toast-message--right-icon" (click)="closeEvent()" aria-label="Close notification">
    <mat-icon>close</mat-icon>
  </button>
</div>
🔗 Analysis chain

Verify toast message accessibility for screen readers!

Let's ensure our stylish toast messages are accessible to all users, mind it!


The initial search didn't yield results, but like a true superstar, I won't give up! Let's check the actual toast component implementation and any accessibility-related configurations. In Angular Material, snackbar/toast messages often have built-in accessibility features, so we need to verify how it's configured.


Mind it! Like a true superstar, I need to check if there are any global configurations for the snackbar that might handle accessibility. The Material snackbar has built-in accessibility features, but we need to verify if they're properly configured, style-ah!


Listen here, style-ah! After analyzing the code like a true superstar, I can see that we're using Angular Material's MatSnackBar which comes with built-in accessibility features. But mind it! We need to verify the actual toast template.

I'll be back with more information to ensure our toast messages are as powerful as a punch dialogue, and accessible to all users!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if we're using aria-live for toast messages
rg -l "aria-live" --type html

Length of output: 29


Script:

#!/bin/bash
# Let's check the toast component implementation and its template
fd "toast.*component" --exec cat {}

# Also check for any accessibility configurations in the snackbar
rg -i "aria|accessibility" --type ts -A 5 -B 5

Length of output: 78238


Script:

#!/bin/bash
# Let's check the toast component and snackbar configuration for accessibility
rg -i "matsnackbar.*config" --type ts -A 5 -B 5

# Check for any global snackbar configurations in the app
fd "snackbar.*config|snackbar.*service" --exec cat {}

# Check for any accessibility-related configurations in the app module or core module
fd "app.module|core.module" --exec cat {}

Length of output: 7910


Script:

#!/bin/bash
# Let's check the toast message component template for proper accessibility markup
fd "toast-message.component.html" --exec cat {}

# Also check if there are any global Material configurations
fd "material.module" --exec cat {}

Length of output: 738

@@ -16,7 +16,7 @@
</div>
</div>
<form [formGroup]="fg" class="pending-verification__input-container">
<div class="pending-verification__input-container__label">Registered Email</div>
<div class="pending-verification__input-container__label">Registered email</div>
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Mind it! We've got a small style mismatch, machan!

Listen here, style warriors! While the error message icon is consistently using the danger-fill across all auth pages (that's mass!), I noticed something that needs our attention:

  • In new-password page, the container class is new-password__error
  • But in other pages, we're using *-verification__error-message and forgot-password__error-message

For that perfect punch, we should make these styles consistent! Either all should use __error or __error-message. Style consistency is not a choice, it's a way of life!

🔗 Analysis chain

Error handling with style, what a scene!

The error message presentation is top-notch! But remember what I always say - consistency is key, partner!

Let's check if the error message style matches across auth pages:

Also applies to: 33-34


I need to verify the complete error message structure, not just the icon part, to ensure full consistency in styling. The previous result shows the danger-fill icon is used consistently, but let's check the surrounding HTML structure and classes for a thorough verification.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check error message styling consistency
rg -g '*.html' "error-message.*danger-fill" src/app/auth/

Length of output: 982


Script:

#!/bin/bash
# Let's check the complete error message structure across auth pages
rg -g '*.html' -B 2 -A 2 "error-message" src/app/auth/

Length of output: 3458

Copy link

@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: 10

🧹 Outside diff range comments (2)
src/app/post-verification/invited-user/invited-user.page.ts (1)

Line range hint 97-122: Listen carefully! This chain of operations needs more power!

The way you've chained these operations is like a mass scene without proper coordination! Let's make it more robust:

  1. Separate the tracking logic into a dedicated service method
  2. Add proper error handling with retries for network operations
  3. Consider breaking down the chain into smaller, manageable pieces

Here's a powerful pattern to follow:

private async handleUserSetup(user: any): Promise<void> {
  try {
    await this.orgUserService.postUser(user);
    await this.trackingService.setupComplete();
    await this.authService.refreshEou();
    await this.orgUserService.markActive();
    await this.trackingService.activated();
  } catch (error) {
    // Handle specific error cases
    throw error;
  }
}

async saveData(): Promise<void> {
  try {
    await this.loaderService.showLoader('Signing in...', 30000);
    const eou = await firstValueFrom(this.eou$);
    await this.handleUserSetup({
      ...eou.us,
      full_name: this.fg.controls.fullName.value,
      password: this.fg.controls.password.value
    });
    this.router.navigate(['/', 'enterprise', 'my_dashboard']);
  } catch (error) {
    // Handle errors with proper user feedback
  } finally {
    this.isLoading = false;
    await this.loaderService.hideLoader();
  }
}
src/app/auth/pending-verification/pending-verification.page.scss (1)

Line range hint 1-1: Listen up, style warriors! Time for some architectural action!

I notice we're building an army of similar styles across different auth pages. Like how I lead my movies to success, let's lead these styles to better organization!

Consider creating an auth module style structure:

  1. Create src/theme/auth/_mixins.scss for shared auth mixins
  2. Create src/theme/auth/_variables.scss for auth-specific variables
  3. Create src/theme/auth/index.scss to export all auth styles

This way, our styles will be as organized as my movie scripts! 🕶️

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 46a5063 and fe176b9.

📒 Files selected for processing (12)
  • src/app/auth/disabled/disabled.page.html (1 hunks)
  • src/app/auth/new-password/new-password.page.html (4 hunks)
  • src/app/auth/new-password/new-password.page.scss (2 hunks)
  • src/app/auth/pending-verification/pending-verification.page.html (4 hunks)
  • src/app/auth/pending-verification/pending-verification.page.scss (2 hunks)
  • src/app/auth/reset-password/reset-password.page.html (3 hunks)
  • src/app/auth/reset-password/reset-password.page.scss (2 hunks)
  • src/app/auth/reset-password/reset-password.page.ts (1 hunks)
  • src/app/auth/verify/verify.page.scss (1 hunks)
  • src/app/post-verification/invited-user/invited-user.page.html (6 hunks)
  • src/app/post-verification/invited-user/invited-user.page.scss (2 hunks)
  • src/app/post-verification/invited-user/invited-user.page.ts (1 hunks)
🧰 Additional context used
📓 Learnings (2)
src/app/auth/verify/verify.page.scss (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3284
File: src/app/auth/verify/verify.page.scss:23-30
Timestamp: 2024-11-27T06:23:58.699Z
Learning: In `src/app/auth/verify/verify.page.scss`, maintain the CSS styles according to the current CSS in use, avoiding additional transitions unless necessary.
src/app/auth/pending-verification/pending-verification.page.html (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3306
File: src/app/auth/pending-verification/pending-verification.page.html:37-44
Timestamp: 2024-12-06T10:17:25.619Z
Learning: In `src/app/auth/pending-verification/pending-verification.page.html`, using `ion-button` may introduce additional CSS that is not required; prefer using a standard `button` element instead.
🔇 Additional comments (12)
src/app/auth/new-password/new-password.page.scss (1)

86-86: Font weight change - Kabali style!

The form header font weight change to 500 matches perfectly with our design system. Like how I make my grand entries, this makes the header stand out!

src/app/auth/pending-verification/pending-verification.page.scss (1)

48-48: Font weight looking strong like Rajinikanth!

The page header font weight of 500 is perfect for emphasis. When I point my finger, even the style follows!

src/app/post-verification/invited-user/invited-user.page.scss (2)

22-24: Mind it! These error message styles are perfectly balanced, like my signature sunglasses!

The flex display and center alignment create a powerful combo for error messages, making them stand tall and proud!


26-29: Listen up, style warriors! Let's verify these icon dimensions!

The icon measurements look sharp, but let's make sure they match our design system's standards. When I point my finger, style should follow!

✅ Verification successful

Mind it! These icon dimensions are perfectly styled, partner!

After scanning through our style system like a bullet through the air, I can confirm that 14x14px with 4px margin is our standard error icon styling. The global styles show we consistently use these dimensions for icons and loaders across the application:

  • The primary and secondary loaders use 14x14px dimensions
  • The error message icon follows this same pattern
  • The 4px margin spacing is used throughout for consistent element spacing
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for similar icon dimensions across the codebase
rg -g '*.scss' '(height|width): 14px' --type scss
rg -g '*.scss' 'margin-right: 4px' --type scss

Length of output: 158


Script:

#!/bin/bash
# Let's try without the file type flag for SCSS files
rg '(height|width): 14px' '*.scss'
rg 'margin-right: 4px' '*.scss'

# Let's also search in CSS files to be thorough
rg '(height|width): 14px' '*.css'
rg 'margin-right: 4px' '*.css'

# Let's check for any design system or style guide files
fd -e scss -e css -e ts -e js "design-system|style-guide|theme"

Length of output: 391


Script:

#!/bin/bash
# Mind it! Let's search recursively in the entire repository
rg -t scss -t css '(height|width): 14px'
rg -t scss -t css 'margin-right: 4px'

# Let's also check for any design tokens or variables
rg -t scss -t css '\$.*icon.*size'
rg -t scss -t css '\$.*spacing'

# And search for any theme or design system files
find . -type f \( -name "*.scss" -o -name "*.css" \) -exec grep -l "theme\|design-system\|tokens" {} \;

Length of output: 11926


Script:

#!/bin/bash
# Style is my signature! Let's check the theme variables
cat ./src/theme/variables.scss

# Let's also check any global styles
cat ./src/global.scss

# And the special FY select styles
cat ./src/assets/styles/_fy_select.scss

Length of output: 37114

src/app/auth/disabled/disabled.page.html (1)

28-28: Mind-blowing consistency, just like my style!

The capitalization change from "Back to Sign In" to "Back to sign in" is perfectly aligned with modern UI practices. When style meets substance, magic happens!

src/app/auth/reset-password/reset-password.page.scss (1)

20-21: Style makeover that packs a punch! 🌟

These style changes are like a perfectly choreographed action sequence:

  1. Reduced margin and stronger font-weight create better visual hierarchy
  2. New error icon styling adds that extra flair
  3. Flex display ensures everything stays in perfect formation

Just one thing, partner! Let's verify these changes across different screen sizes.

Also applies to: 36-40, 44-45

✅ Verification successful

The previous command failed because of the glob pattern. Let me try a more systematic approach to find the SCSS files and check their styling patterns, macha! 🕶️


Mind it! Before making the final call, we need to verify the flex display and error message styling consistency across other auth pages! 🕶️


Mind it! These style changes are perfectly synchronized across the auth module! 🕶️

Listen here, style is not just about looking good, it's about consistency! And these changes are following the same pattern we see across other auth pages:

  • Font-weight: 500 is consistently used in sign-in, switch-org, and other auth pages
  • Flex display is the chosen warrior for layout in verify, new-password, and disabled pages
  • Error message styling with icon (14x14) is matching the pattern in pending-verification and new-password pages

When style meets consistency, success is automatic! These changes are not just good, they're Superstar good!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for responsive design considerations in other auth pages
rg -l "font-weight: 500" "src/app/auth/**/*.scss"

Length of output: 114


Script:

#!/bin/bash
# Let's find all SCSS files in the auth directory first
fd -e scss . src/app/auth

# Then check for font-weight usage
rg "font-weight" src/app/auth

Length of output: 3871


Script:

#!/bin/bash
# Mind it! Let's check for flex display patterns in auth pages
rg "display:\s*flex" src/app/auth

# Now, let's see those error message styles, thalaiva! 
rg -A 2 "error-message|error-icon" src/app/auth

Length of output: 8686

src/app/auth/reset-password/reset-password.page.html (1)

28-29: Mind it! Error message styling looks stylish, macha!

The addition of the danger icon (mat-icon) next to the error message is a super duper improvement for visual feedback. When something goes wrong, users will know it with style!

src/app/auth/pending-verification/pending-verification.page.html (2)

33-34: Style ah? Error message with icon, semma mass!

The error message styling with the danger icon is consistent with other pages. That's how we maintain style across the app!


44-46: Kabali da! Let's verify the form button validation!

The new loading state attributes are super cool, but we need to make sure this appFormButtonValidation directive exists and works properly.

✅ Verification successful

Let me verify if this directive properly handles the loading state, macha! 🕶️


Let me style-ah check what's cooking in that directive file! 🕶️


Mind it! The loading state is perfectly valid, macha! 🕶️

The directive is a blockbuster hit! It's got everything we need:

  • @Input() loading: boolean - Check ✓
  • @Input() loadingText: string - Double Check ✓
  • Proper loading state handling with loader animation - Triple Check ✓

The code is working exactly like my punch dialogues - powerful and precise! No changes needed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the appFormButtonValidation directive
rg -l "appFormButtonValidation"

Length of output: 1746


Script:

#!/bin/bash
# Let's check the directive implementation to verify loading state support
ast-grep --pattern 'class FormButtonValidationDirective {
  $$$
}'

# Also check if loading input is defined
ast-grep --pattern '@Input() loading: $_'

Length of output: 112


Script:

#!/bin/bash
# Mind it! Let's check the directive file directly
cat src/app/shared/directive/form-button-validation.directive.ts

Length of output: 2866

src/app/auth/new-password/new-password.page.html (1)

10-10: Text changes are perfect, just like my punch dialogues!

The case changes in headers and button text maintain consistency across all auth pages:

  • "Reset password" instead of "Reset Password"
  • "Back to sign in" instead of "Back to Sign In"

Also applies to: 108-108

src/app/post-verification/invited-user/invited-user.page.html (2)

107-112: Superstar approval for that error handling logic!

The condition !fg.controls.confirmPassword.errors.required ensures we don't show conflicting error messages. That's what I call a punch dialogue in code! 🌟


18-18: Mind-blowing styling changes, partner! But let's verify the icon alignment.

The changes look stylish, but in my blockbuster experience, we need to ensure the error icon alignment is consistent across all form fields.

Also applies to: 25-26

✅ Verification successful

Mind-blowing implementation, thalaiva! The error icons are perfectly synchronized across the universe of our auth pages!

Looking at the code like a true superstar, I can see that all our auth pages - from invited-user to new-password - are following the same stellar pattern:

  • All error icons are consistently sized at 14x14 pixels
  • Every page uses the same 'danger-fill' SVG icon
  • The class naming follows the BEM methodology perfectly
  • Error message styling is uniform across all components

This consistency is not just a coincidence, it's a signature move! 🌟

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for consistent error icon styling across auth pages
rg -l "invited-user__error-message-icon|error-message-icon" src/app/auth/

Length of output: 409


Script:

#!/bin/bash
# Let's check the actual implementation of error icons in these files
rg "error-message-icon" src/app/auth/ -A 2 -B 2

Length of output: 4101


Script:

#!/bin/bash
# Also check the invited-user page implementation
rg "invited-user__error-message-icon|error-message-icon" src/app/post-verification/ -A 2 -B 2

Length of output: 3153

@@ -94,7 +94,7 @@ export class InvitedUserPage implements OnInit {
this.isLoading = true;
this.fg.markAllAsTouched();
if (this.fg.valid) {
from(this.loaderService.showLoader())
from(this.loaderService.showLoader('Signing in...', 20000000))
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

⚠️ Potential issue

Mind it! The loader timeout is way too long compared to other timeouts in our codebase, macha!

After scanning through the entire codebase like a bullet train, I can see that most loader timeouts are either:

  • Default to 1000ms (1 second)
  • 10000ms (10 seconds) for operations like signing in or scanning
  • 30000ms (30 seconds) for complex operations like linking cards

Our 20000000ms (5.5 hours) timeout stands out like a villain in a hero movie! Here's the style-ah fix:

-      from(this.loaderService.showLoader('Signing in...', 20000000))
+      from(this.loaderService.showLoader('Signing in...', 10000))

Even our most complex operations don't need more than 30 seconds, and for signing in, 10 seconds is more than enough to keep the style intact! 🕶️

🔗 Analysis chain

Mind it! That loader duration is longer than my movie climax scene!

The loader timeout of 20000000 milliseconds (≈5.5 hours) is way too long, macha! Even if the network is slower than a villain's getaway car, we shouldn't keep our users waiting that long.

Here's how to fix it, style ah:

-      from(this.loaderService.showLoader('Signing in...', 20000000))
+      from(this.loaderService.showLoader('Signing in...', 30000))

30 seconds is more than enough time for our operation to complete, or timeout gracefully!

Let me check other loader timeouts in the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find other loader service timeout values for comparison
rg -A 1 "showLoader\(" --type ts

Length of output: 18645

Comment on lines 29 to 32
@include loader;
fill: $brand-primary !important;
height: 40px;
width: 40px;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Mind it! The loader size needs consistency, macha!

The loader mixin defines 14px size, but you're overriding it to 40px right after including it. That's like wearing a small shirt and stretching it to XXL size! Let's fix this style, style-ah!

 &__icon {
   @include loader;
   fill: $brand-primary !important;
-  height: 40px;
-  width: 40px;
+  // If larger size needed, update the mixin or create a new one
+  // for consistent reuse across components

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

Comment on lines 22 to 29
display: flex;
align-items: center;
}

&__error-message-icon {
height: 14px;
width: 14px;
margin-right: 4px;
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Superstar approves these styles! But let's make them even more super!

The error message styling is perfect like a well-choreographed dance! But for better maintainability, let's create a shared error message style that can be reused across all auth pages!

Consider creating a shared mixin in a common SCSS file:

@mixin error-message {
  display: flex;
  align-items: center;
  
  &-icon {
    height: 14px;
    width: 14px;
    margin-right: 4px;
  }
}

Comment on lines 66 to 74
font-size: 12px;
display: flex;
align-items: center;
}

&__error-message-icon {
height: 14px;
width: 14px;
margin-right: 4px;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Mind it! We're repeating ourselves like my punch dialogues!

These error message styles are being copied across all auth pages. In my movies, I never repeat the same punch dialogue! Let's create a shared style, thalaiva!

Create a shared style in src/theme/_auth.scss:

@mixin auth-error-message {
  color: $red;
  font-size: 12px;
  display: flex;
  align-items: center;

  &-icon {
    height: 14px;
    width: 14px;
    margin-right: 4px;
  }
}

Then use it in all auth pages:

.pending-verification {
  &__error-message {
    @include auth-error-message;
  }
}

src/app/auth/new-password/new-password.page.html Outdated Show resolved Hide resolved
Copy link
Contributor

@Chethan-Fyle Chethan-Fyle left a comment

Choose a reason for hiding this comment

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

One comment.

Copy link

@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: 0

🧹 Outside diff range comments (1)
src/app/post-verification/invited-user/invited-user.page.ts (1)

Line range hint 123-129: Style-ah suggestion for better error messages, macha!

The error message is too simple like a basic punch dialogue! When the password is invalid, we should tell the user exactly what's missing - uppercase, lowercase, special character, or length! Here's how to make it more powerful:

-      const message = `Please enter a valid ${!this.fg.controls.fullName.valid ? 'name' : 'password'}`;
+      let message = '';
+      if (!this.fg.controls.fullName.valid) {
+        message = 'Please enter a valid name';
+      } else {
+        message = 'Password must contain at least one uppercase letter, one lowercase letter, one number, one special character, and be at least 8 characters long';
+      }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fe176b9 and 1df8a73.

📒 Files selected for processing (1)
  • src/app/post-verification/invited-user/invited-user.page.ts (1 hunks)
🔇 Additional comments (1)
src/app/post-verification/invited-user/invited-user.page.ts (1)

97-97: Mind it! Let's verify if that loader timeout was fixed, macha!

The loader message looks stylish now! But I need to make sure we're not keeping our users waiting longer than a slow-motion scene! 🕶️

#!/bin/bash
# Description: Check if the loader timeout was properly fixed
echo "Checking the current timeout value..."
rg "showLoader.*Signing in" src/app/post-verification/invited-user/invited-user.page.ts

Also, since we're dealing with authentication, let me check if we're following the same style in other auth-related loaders:

#!/bin/bash
# Description: Check loader patterns in auth-related files
echo "Checking auth loader patterns..."
fd -e ts -e html --full-path "auth|verification" | xargs rg "showLoader"

Copy link

@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: 2

🧹 Outside diff range comments (1)
src/app/auth/pending-verification/pending-verification.page.scss (1)

Line range hint 185-193: Watch out! Double display: flex like double action!

The display: flex property appears twice in the __cta-secondary class. In my movies, I do double roles, but in CSS, we need only one!

Fix it like this:

  &__cta-secondary {
    display: flex;
    padding-top: 18px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: $blue-black;
-   display: flex;
    flex-direction: row;
  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1df8a73 and c7a54fa.

📒 Files selected for processing (8)
  • src/app/auth/new-password/new-password.page.html (2 hunks)
  • src/app/auth/new-password/new-password.page.scss (2 hunks)
  • src/app/auth/pending-verification/pending-verification.page.html (3 hunks)
  • src/app/auth/pending-verification/pending-verification.page.scss (2 hunks)
  • src/app/auth/reset-password/reset-password.page.html (3 hunks)
  • src/app/auth/reset-password/reset-password.page.scss (2 hunks)
  • src/app/post-verification/invited-user/invited-user.page.html (5 hunks)
  • src/app/post-verification/invited-user/invited-user.page.scss (2 hunks)
🧰 Additional context used
📓 Learnings (2)
src/app/auth/new-password/new-password.page.html (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3309
File: src/app/auth/new-password/new-password.page.ts:79-99
Timestamp: 2024-12-09T06:37:55.768Z
Learning: The team prefers to retain existing error messages in `NewPasswordPage` component (`src/app/auth/new-password/new-password.page.ts`) unless there's a compelling reason to change them.
src/app/auth/pending-verification/pending-verification.page.html (1)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3306
File: src/app/auth/pending-verification/pending-verification.page.html:37-44
Timestamp: 2024-12-06T10:17:25.619Z
Learning: In `src/app/auth/pending-verification/pending-verification.page.html`, using `ion-button` may introduce additional CSS that is not required; prefer using a standard `button` element instead.
🔇 Additional comments (19)
src/app/post-verification/invited-user/invited-user.page.scss (2)

22-23: Mind it! These flex powers will make your error messages dance in perfect harmony!

The flex display and center alignment are giving those error messages the superstar treatment they deserve. Now your icons and text will stand shoulder to shoulder like true partners in style!


81-81: Kabali da! This font weight change packs a punch!

The medium weight of 500 gives the form header the respect it deserves. But remember, with great font weight comes great responsibility!

Consider using a SCSS variable for the font weight to maintain consistency:

-    font-weight: 500;
+    font-weight: $font-weight-medium;
src/app/auth/new-password/new-password.page.scss (2)

80-80: Super! The font weight change is perfect like my style!

The font-weight: 500 for form header maintains consistency with other auth pages. This is how we maintain style across scenes!


22-23: 🛠️ Refactor suggestion

Mind it! Let's make these error styles reusable, style-u!

The error message styling is being repeated across all auth pages like a hit movie being remade! Let's create a shared mixin, thalaiva!

Create a shared mixin in src/theme/_auth.scss:

@mixin auth-error-message {
  color: $red;
  display: flex;
  align-items: center;
  font-size: 12px;
}

Then use it like a signature move:

-  &__error {
-    color: $red;
-    font-size: 12px;
-    display: flex;
-    align-items: center;
-  }
+  &__error {
+    @include auth-error-message;
+  }
src/app/auth/reset-password/reset-password.page.scss (2)

20-21: Superstar approves these header styles!

The reduced margin and consistent font-weight: 500 create a perfect rhythm like a well-choreographed scene!


38-39: 🛠️ Refactor suggestion

Mind it! Same error message style appears again!

Just like how I don't repeat my punch dialogues, we shouldn't repeat these styles!

Use the same auth-error-message mixin suggested earlier:

-  &__error-message {
-    color: $red;
-    display: flex;
-    align-items: center;
-  }
+  &__error-message {
+    @include auth-error-message;
+  }
src/app/auth/pending-verification/pending-verification.page.scss (2)

48-48: Perfect font weight, just like my perfect timing!

The font-weight: 500 maintains consistency across all auth pages. This is style!


66-68: 🛠️ Refactor suggestion

Mind it! Error message style makes another appearance!

Like my famous dialogues that spread across movies, these styles are everywhere! Let's centralize them!

Use the same auth-error-message mixin as suggested for other pages:

-  &__error-message {
-    color: $red;
-    font-size: 12px;
-    display: flex;
-    align-items: center;
-  }
+  &__error-message {
+    @include auth-error-message;
+  }
src/app/auth/reset-password/reset-password.page.html (3)

11-11: Style! The header text change is perfect, like a well-choreographed scene!

The capitalization change from "Forgot Password" to "Forgot password" maintains consistency across the app. That's what I call style!


28-28: Mind it! The error message is now crystal clear!

The message "Enter an email address" is more direct and user-friendly than the previous version. That's how we roll!


88-88: Superstar move with the CTA text!

The consistent capitalization in "Back to sign in" matches the style guide perfectly. When style meets substance, magic happens!

src/app/auth/pending-verification/pending-verification.page.html (3)

19-19: Style makeover for the label text, what a scene!

The change from "Registered Email" to "Registered email" keeps the style consistent. That's how we maintain our standards!


90-90: Style consistency at its finest!

The "Back to sign in" text change matches the pattern across other pages. When you maintain consistency, you maintain class!


43-45: Now that's what I call a smart button upgrade!

The addition of loading state and validation makes the user experience smoother than a perfectly executed stunt!

✅ Verification successful

Mind it! This button upgrade is absolutely perfect, partner!

The appFormButtonValidation directive is a blockbuster hit across the application! It's properly imported in the shared module, widely used in 30+ templates, and comes with style! The directive handles loading states like I handle villains - with absolute precision and flair! When you click that button, it transforms smoothly with loading text and a spinner, just like how I transform in my movies!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify if appFormButtonValidation directive is properly imported
rg -l "appFormButtonValidation" src/app/auth/pending-verification/

Length of output: 131


Script:

#!/bin/bash
# Check if the directive is imported in the component file
rg "appFormButtonValidation" src/app/auth/pending-verification/pending-verification.page.ts

# Let's also check if this directive exists in the module declarations
rg "appFormButtonValidation" src/app/auth/pending-verification/pending-verification.module.ts

# Search for the directive definition in the codebase
ast-grep --pattern 'class $_ implements $_Directive {
  $$$
}'

Length of output: 250


Script:

#!/bin/bash
# Let's search for the directive in shared modules and components
fd -e ts -e html | xargs rg "appFormButtonValidation"

# Also search for any directive with similar naming pattern
fd -e ts | xargs rg "@Directive.*FormButtonValidation"

# Check for any form button related directives
ast-grep --pattern '@Directive({
  selector: $_
})
class $_ {
  $$$
}'

Length of output: 4031


Script:

#!/bin/bash
# Let's check the implementation of the form button validation directive
cat src/app/shared/directive/form-button-validation.directive.ts

# And check if it's properly declared in a shared module
rg "FormButtonValidationDirective" src/app/shared/shared.module.ts

Length of output: 3097

src/app/auth/new-password/new-password.page.html (3)

10-10: The header transformation is pure style!

The change from "Reset Password" to "Reset password" follows our consistent capitalization pattern. That's how we maintain our brand's signature style!


104-104: Another superstar move with the CTA text!

The "Back to sign in" change completes our style trilogy across all auth pages. When consistency meets perfection, that's what I call mass!


Line range hint 4-6: Mind it! Let's fix those asset paths!

I notice you're using relative paths for assets. Let's make it consistent with other pages!

-        src="../../../assets/svg/arrow-tail-left.svg"
+        src="/assets/svg/arrow-tail-left.svg"
src/app/post-verification/invited-user/invited-user.page.html (2)

18-18: Mind-it! The label change is perfect, partner!

The capitalization change from "Full Name" to "Full name" follows the style like my signature moves - smooth and consistent!


47-47: 🛠️ Refactor suggestion

Style ah? Logic ah? Why not both, partner!

The password visibility toggle needs the Rajini touch! Let's make it punch dialogues, not bugs!

Transform this style into a reusable constant, like my iconic moves:

readonly EYE_ICONS = {
  visible: '/assets/svg/eye.svg',
  hidden: '/assets/svg/eye-slash.svg'
};

get passwordVisibilityIcon(): string {
  return this.hide ? this.EYE_ICONS.hidden : this.EYE_ICONS.visible;
}

Then in template:

-src="{{hide ? '/assets/svg/eye-slash.svg' : '/assets/svg/eye.svg'}}"
+[src]="passwordVisibilityIcon"

@@ -72,7 +72,7 @@
class="invited-user__text invited-user__text-block"
[ngClass]="{'invited-user__text__invalid': fg.controls.confirmPassword.touched && !fg.controls.confirmPassword.valid}"
>
<div class="invited-user__text-label">Confirm Password</div>
<div class="invited-user__text-label">Confirm password</div>
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Mind-it! The label is perfect, but the visibility needs our style!

The capitalization is spot on! But partner, let's apply the same visibility icon improvement here too!

Add this to your component:

get confirmPasswordVisibilityIcon(): string {
  return this.hideConfirmPassword ? this.EYE_ICONS.hidden : this.EYE_ICONS.visible;
}

Then in template:

-src="{{hideConfirmPassword ? '/assets/svg/eye-slash.svg' : '/assets/svg/eye.svg'}}"
+[src]="confirmPasswordVisibilityIcon"

Also applies to: 91-91

@@ -100,7 +100,7 @@
Password cannot be empty
</div>
<div
*ngIf="fg.controls.confirmPassword.touched && fg.controls.confirmPassword.invalid && fg.controls.confirmPassword.errors.passwordMismatch"
*ngIf="fg.controls.confirmPassword.touched && fg.controls.confirmPassword.invalid && fg.controls.confirmPassword.errors.passwordMismatch && !fg.controls.confirmPassword.errors.required"
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Marana mass error handling, partner!

The error condition is now as precise as my punch dialogues! But let's make it accessible to everyone!

Add this accessibility enhancement:

<div
  *ngIf="fg.controls.confirmPassword.touched && fg.controls.confirmPassword.invalid && fg.controls.confirmPassword.errors.passwordMismatch && !fg.controls.confirmPassword.errors.required"
- class="invited-user__error"
+ class="invited-user__error"
+ role="alert"
+ aria-live="polite"
>
📝 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
*ngIf="fg.controls.confirmPassword.touched && fg.controls.confirmPassword.invalid && fg.controls.confirmPassword.errors.passwordMismatch && !fg.controls.confirmPassword.errors.required"
<div
*ngIf="fg.controls.confirmPassword.touched && fg.controls.confirmPassword.invalid && fg.controls.confirmPassword.errors.passwordMismatch && !fg.controls.confirmPassword.errors.required"
class="invited-user__error"
role="alert"
aria-live="polite"
>

Copy link

@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: 5

🧹 Outside diff range comments (2)
src/environments/environment.ts (1)

Line range hint 1-35: Punch dialogue: Secure those sensitive keys, partner!

I notice many sensitive configuration keys in this file. Even though values are empty, we should add this file to .gitignore and provide a template instead. When I commit something, I commit with style!

Here's what you should do, my friend:

  1. Rename this file to environment.template.ts
  2. Add environment.ts to .gitignore
  3. Add documentation for developers to copy template
- export const environment = {
+ // Copy this file to environment.ts and fill in the values
+ export const environment: {[key: string]: string} = {
src/app/post-verification/invited-user/invited-user.page.ts (1)

Line range hint 124-130: Mind it! Let's make those error messages more style-ah!

The error handling is good, but let's make it punch harder with specific messages!

-      const message = `Please enter a valid ${!this.fg.controls.fullName.valid ? 'name' : 'password'}`;
+      const message = !this.fg.controls.fullName.valid 
+        ? 'Please enter a valid name with at least one letter'
+        : 'Please ensure your password meets all the requirements';

Now that's how you deliver a message with style! 🎭

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c7a54fa and a6658ca.

📒 Files selected for processing (4)
  • src/app/auth/reset-password/reset-password.page.spec.ts (1 hunks)
  • src/app/core/services/loader.service.ts (1 hunks)
  • src/app/post-verification/invited-user/invited-user.page.ts (3 hunks)
  • src/environments/environment.ts (1 hunks)
🧰 Additional context used
📓 Learnings (1)
src/app/post-verification/invited-user/invited-user.page.ts (3)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3285
File: src/app/post-verification/invited-user/invited-user.page.ts:69-70
Timestamp: 2024-12-03T04:28:23.669Z
Learning: In the `InvitedUserPage` component, the password length is already validated in the password checks tooltip, so adding `Validators.minLength` in the form group is not necessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3309
File: src/app/post-verification/invited-user/invited-user.page.spec.ts:112-127
Timestamp: 2024-12-09T06:38:25.802Z
Learning: In `src/app/post-verification/invited-user/invited-user.page.spec.ts`, the `isPasswordValid` property will never be undefined, so testing for undefined values in `checkPasswordValidity` isn't necessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3289
File: src/app/post-verification/invited-user/invited-user.page.ts:97-98
Timestamp: 2024-12-04T05:23:21.200Z
Learning: In 'src/app/post-verification/invited-user/invited-user.page.ts', the 'password' and 'fullName' obtained from 'this.fg.controls.password.value' and 'this.fg.controls.fullName.value' will always be strings, so additional error handling for type checking is unnecessary.
🪛 eslint
src/app/post-verification/invited-user/invited-user.page.ts

[error] 54-54: Missing return type on function.

(@typescript-eslint/explicit-function-return-type)


[error] 101-101: Missing return type on function.

(@typescript-eslint/explicit-function-return-type)

🔇 Additional comments (2)
src/app/auth/reset-password/reset-password.page.spec.ts (1)

113-113: Mind it! The error message update looks perfect, macha!

The change in expected error message from "Please enter a valid email." to "Enter an email address." aligns perfectly with our mission to make the UI text more concise and direct, just like how I deliver my punch dialogues! 🎬

Let me verify this change with style:

✅ Verification successful

Mind-blowing consistency, thalaiva! The error message is perfectly synchronized!

Like a perfectly choreographed action sequence, the new error message "Enter an email address." appears consistently in both the template file and the test file. The component's form validation is also in perfect harmony, using the same pattern. This is what I call a blockbuster performance! 🎬

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of this error message across the codebase

# Check if the new message is consistently used in the template
rg -l "Enter an email address" src/app/auth/reset-password/

# Check if there are any lingering instances of the old message
rg -l "Please enter a valid email" src/app/auth/reset-password/

Length of output: 236


Script:

#!/bin/bash
# Let's check the actual content of these files to verify the message consistency, style!

# Check the template file content
echo "=== Content of reset-password.page.html ==="
rg -A 2 -B 2 "Enter an email address" src/app/auth/reset-password/reset-password.page.html

# Check the component spec file content
echo -e "\n=== Content of reset-password.page.spec.ts ==="
rg -A 2 -B 2 "Enter an email address" src/app/auth/reset-password/reset-password.page.spec.ts

# Let's also check if there are any similar validation messages in the component file
echo -e "\n=== Content of reset-password.page.ts ==="
cat src/app/auth/reset-password/reset-password.page.ts

Length of output: 3975

src/app/post-verification/invited-user/invited-user.page.ts (1)

104-104: ⚠️ Potential issue

Mind it! The loader needs a proper timeout, macha!

-      from(this.loaderService.showLoader())
+      from(this.loaderService.showLoader('Saving...', 10000))

Even my punch dialogues don't take this long! Let's keep it style-ah with a 10-second timeout! 🕶️

@@ -7,7 +7,7 @@ export const environment = {
NAME: '',
CLUSTER_DOMAIN: '',
ROOT_URL: '',
ROUTER_API_ENDPOINT: '',
ROUTER_API_ENDPOINT: 'https://accounts.fyle.tech',
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

💡 Codebase verification

Mind it! Production configuration is properly secured, but development needs a style change!

Hey machan, what a discovery! The production environment is doing it right-ah, using environment variables for sensitive URLs. But in development, we're breaking the style by hardcoding that production URL!

  • In hooks/utils/prod-environment.js, the ROUTER_API_ENDPOINT uses ${process.env.FYLE_MOBILE_ROUTER_API_ENDPOINT} - that's the mass style!
  • But in src/environments/environment.ts, we're hardcoding 'https://accounts.fyle.tech' - not cool, partner!

For local development, you should:

  1. Use a development-specific URL or environment variable
  2. Keep the production URLs away from development config, what do you say?

Remember my famous dialogue: "Development environment is like a rehearsal, production is the real show. Don't mix them up!" 🕶️

🔗 Analysis chain

Mind it! Let's verify this URL configuration, machan!

Hey partner! The URL 'https://accounts.fyle.tech' looks like a production URL in your development environment. This style won't work, I tell you!

Consider these super-powerful suggestions:

  1. Use environment variables or local development URLs for development
  2. Keep production URLs only in production config, what do you say?

Let me check the production config for you, style-ah!


I need to verify the production configuration and check for any other URLs in the environment files to make a proper assessment, partner!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check URL configuration across environments
echo "Checking environment configurations..."

# Look for environment files
fd -e ts -e js environment

# Check for hardcoded URLs in environment files
rg -i "accounts.fyle.tech" 

Length of output: 291


Script:

#!/bin/bash
# Let's check the production environment configuration, style-ah!
echo "Checking production environment configuration..."
cat hooks/utils/prod-environment.js

# Let's also check if there are any other URLs in the environment files
echo -e "\nChecking all URLs in environment files..."
rg -i "https?://" src/environments/ hooks/utils/

Length of output: 1893

@@ -13,7 +13,7 @@ export class LoaderService {
message,
duration,
spinner: customLoaderUrl ? null : 'crescent',
cssClass: customLoaderUrl ? 'custom-loading' : '',
cssClass: customLoaderUrl ? 'custom-loading' : 'intermediate-loader',
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Mind it! The style 'intermediate-loader' is missing in action, macha!

Listen here, my friend! The style class 'intermediate-loader' that we're trying to use doesn't exist anywhere in the styles, but 'custom-loading' is properly defined in global.scss. This is like trying to wear a suit that's not in your wardrobe - it won't work!

  • The 'intermediate-loader' class needs to be defined in global.scss or another stylesheet
  • Currently, when customLoaderUrl is false, it will apply a non-existent style class
🔗 Analysis chain

Mind it! Let's verify this loader style change, macha!

The change from 'custom-loading' to 'intermediate-loader' is like changing my signature style - it needs proper verification! Let's check where this new style is being used.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check usage of loader styles
echo "Checking loader style usage..."
rg "intermediate-loader|custom-loading" --type scss --type css

Length of output: 164


Script:

#!/bin/bash
# Let's try a broader search for these styles, including all file types
echo "Searching for loader styles in all files..."
rg "intermediate-loader|custom-loading"

# Also search for any loader-related SCSS/CSS files
echo -e "\nSearching for loader-related style files..."
fd -e scss -e css loader

Length of output: 812


async saveData(): Promise<void> {
this.isLoading = true;
async saveData() {
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Mind it! Function return type is missing, macha!

Let's add the return type like adding style to my walk!

-  async saveData() {
+  async saveData(): Promise<void> {
📝 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
async saveData() {
async saveData(): Promise<void> {
🧰 Tools
🪛 eslint

[error] 101-101: Missing return type on function.

(@typescript-eslint/explicit-function-return-type)

Comment on lines 75 to 92
this.lengthValidationDisplay$ = this.fg.controls.password.valueChanges.pipe(
map((password) => password && password.length >= 12 && password.length <= 32)
);

this.uppercaseValidationDisplay$ = this.fg.controls.password.valueChanges.pipe(
map((password) => /[A-Z]/.test(password))
);

this.numberValidationDisplay$ = this.fg.controls.password.valueChanges.pipe(
map((password) => /[0-9]/.test(password))
);
this.specialCharValidationDisplay$ = this.fg.controls.password.valueChanges.pipe(
map((password) => /[!@#$%^&*()+\-:;<=>{}|~?]/.test(password))
);

this.lowercaseValidationDisplay$ = this.fg.controls.password.valueChanges.pipe(
map((password) => /[a-z]/.test(password))
);
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Mind it! Let's add some type safety to these observables, macha!

These validation displays are working like my perfect timing, but let's make them type-safe!

-    this.lengthValidationDisplay$ = this.fg.controls.password.valueChanges.pipe(
+    this.lengthValidationDisplay$: Observable<boolean> = this.fg.controls.password.valueChanges.pipe(
       map((password: string) => password && password.length >= 12 && password.length <= 32)
     );

Apply similar changes to other validation observables. Type safety is like my sunglasses - always needed! 😎

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

Comment on lines 61 to 72
password: [
'',
Validators.compose([
Validators.required,
Validators.minLength(12),
Validators.maxLength(32),
Validators.pattern(/[A-Z]/),
Validators.pattern(/[a-z]/),
Validators.pattern(/[0-9]/),
Validators.pattern(/[!@#$%^&*()+\-:;<=>{}|~?]/),
]),
],
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Style-ah! Strong password validation, but let's make it bulletproof!

The password validation is looking sharp like my stunts, but that special character pattern needs a small punch-up, macha!

-          Validators.pattern(/[!@#$%^&*()+\-:;<=>{}|~?]/),
+          Validators.pattern(/[!@#$%^&*()+\-_:;<=>{}|~?,.'"`]/),

Adding more special characters gives users more style to choose from! 🕶️

📝 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
password: [
'',
Validators.compose([
Validators.required,
Validators.minLength(12),
Validators.maxLength(32),
Validators.pattern(/[A-Z]/),
Validators.pattern(/[a-z]/),
Validators.pattern(/[0-9]/),
Validators.pattern(/[!@#$%^&*()+\-:;<=>{}|~?]/),
]),
],
password: [
'',
Validators.compose([
Validators.required,
Validators.minLength(12),
Validators.maxLength(32),
Validators.pattern(/[A-Z]/),
Validators.pattern(/[a-z]/),
Validators.pattern(/[0-9]/),
Validators.pattern(/[!@#$%^&*()+\-_:;<=>{}|~?,.'"`]/),
]),
],

Copy link

@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: 0

🧹 Outside diff range comments (1)
src/app/post-verification/invited-user/invited-user.page.ts (1)

Line range hint 89-124: Style-ah! Let's handle loading state with more punch!

The loading state management needs some Rajini-style upgrades! The isLoading flag is being set but not properly used for error scenarios. Let's fix it with style:

   async saveData(): Promise<void> {
-    this.isLoading = true;
     this.fg.markAllAsTouched();
     if (this.fg.valid) {
       from(this.loaderService.showLoader('Signing in...', 30000))
         .pipe(
           switchMap(() => this.eou$),
           switchMap((eou) => {
             const user = eou.us;
             user.full_name = this.fg.controls.fullName.value as string;
             user.password = this.fg.controls.password.value as string;
             return this.orgUserService.postUser(user);
           }),
           tap(() => this.trackingService.setupComplete()),
           switchMap(() => this.authService.refreshEou()),
           switchMap(() => this.orgUserService.markActive()),
           tap(() => this.trackingService.activated()),
           finalize(async () => {
-            this.isLoading = false;
             return await this.loaderService.hideLoader();
           })
         )
         .subscribe({
+          next: () => {
             this.router.navigate(['/', 'enterprise', 'my_dashboard']);
+          },
+          error: (error) => {
+            const message = 'Failed to save user data. Please try again.';
+            this.matSnackBar.openFromComponent(ToastMessageComponent, {
+              ...this.snackbarProperties.setSnackbarProperties('failure', { message }),
+              panelClass: ['msb-failure'],
+            });
+            this.trackingService.showToastMessage({ ToastContent: message });
+          }
         });
     } else {

This change:

  1. Removes redundant loading state (the loader service handles this)
  2. Adds proper error handling for network failures
  3. Makes the code more robust than my action sequences! 🕶️
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a6658ca and 284f1e4.

📒 Files selected for processing (1)
  • src/app/post-verification/invited-user/invited-user.page.ts (1 hunks)
🧰 Additional context used
📓 Learnings (1)
src/app/post-verification/invited-user/invited-user.page.ts (3)
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3285
File: src/app/post-verification/invited-user/invited-user.page.ts:69-70
Timestamp: 2024-12-03T04:28:23.669Z
Learning: In the `InvitedUserPage` component, the password length is already validated in the password checks tooltip, so adding `Validators.minLength` in the form group is not necessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3309
File: src/app/post-verification/invited-user/invited-user.page.spec.ts:112-127
Timestamp: 2024-12-09T06:38:25.802Z
Learning: In `src/app/post-verification/invited-user/invited-user.page.spec.ts`, the `isPasswordValid` property will never be undefined, so testing for undefined values in `checkPasswordValidity` isn't necessary.
Learnt from: bistaastha
PR: fylein/fyle-mobile-app#3289
File: src/app/post-verification/invited-user/invited-user.page.ts:97-98
Timestamp: 2024-12-04T05:23:21.200Z
Learning: In 'src/app/post-verification/invited-user/invited-user.page.ts', the 'password' and 'fullName' obtained from 'this.fg.controls.password.value' and 'this.fg.controls.fullName.value' will always be strings, so additional error handling for type checking is unnecessary.
🔇 Additional comments (2)
src/app/post-verification/invited-user/invited-user.page.ts (2)

Line range hint 89-89: Mind it! Function return type is missing, just like my sunglasses in a fight scene!

-  async saveData() {
+  async saveData(): Promise<void> {

97-97: 🛠️ Refactor suggestion

Mind it! The loader implementation needs more style, macha!

The loader timeout issue is fixed like a perfect punch scene! But let's add some safety nets to handle timeouts gracefully:

-      from(this.loaderService.showLoader('Signing in...'))
+      from(this.loaderService.showLoader('Signing in...', 30000))

Adding a 30-second timeout is like my signature move - it keeps things running smooth! 🕶️

Likely invalid or redundant comment.

Copy link

Unit Test Coverage % values
Statements 96.04% ( 19284 / 20078 )
Branches 91.14% ( 10657 / 11692 )
Functions 94.4% ( 5738 / 6078 )
Lines 96.08% ( 18414 / 19164 )

@bistaastha bistaastha merged commit a1c3e8e into master Dec 12, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Medium PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants