Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Added the merchant name as Suggestion in expense detail card for CC expenses #3369

Merged
merged 6 commits into from
Dec 19, 2024

Conversation

devendrafyle
Copy link
Contributor

@devendrafyle devendrafyle commented Dec 17, 2024

Clickup

https://app.clickup.com/t/86cxbrpvr

UI Preview

image image image

Summary by CodeRabbit

  • New Features

    • Added merchant information display for corporate credit card transactions, including a modal for more details.
    • Introduced a new popover component for displaying merchant information.
  • Bug Fixes

    • Improved error handling for mandatory fields in expense forms.
  • Style

    • Enhanced styling for merchant-related elements and transaction status display.
  • Tests

    • Added test cases for the new popover component and its integration within existing pages.

Copy link

coderabbitai bot commented Dec 17, 2024

Walkthrough

Listen up, superstar! 🌟 This pull request brings a stylish upgrade to the expense management system, introducing a new merchant information feature for corporate card transactions. We've added a sleek popover component that reveals merchant details with a single click, making expense tracking as cool as my signature style. The changes span multiple files, enhancing both the add-edit and view expense pages with a consistent, user-friendly approach.

Changes

File Change Summary
src/app/fyle/add-edit-expense/add-edit-expense.page.html Added merchant information section with clickable icon.
src/app/fyle/add-edit-expense/add-edit-expense.page.scss New styles for merchant information block and label.
src/app/fyle/add-edit-expense/add-edit-expense.page.ts Integrated new merchant info modal method.
src/app/fyle/view-expense/view-expense.page.html Added merchant information display with clickable icon.
src/app/fyle/view-expense/view-expense.page.scss New styles for merchant information display.
src/app/fyle/view-expense/view-expense.page.ts Integrated new merchant info modal method.
src/app/shared/components/cc-expense-merchant-info-popover/* Created new component for merchant information popover.
src/app/shared/shared.module.ts Registered new merchant info popover component.
src/app/shared/components/transaction-status/* Updated transaction status display with new label.

Possibly related PRs

Suggested Reviewers

  • Chethan-Fyle
  • Dimple16
  • arjunaj5

Poem

Merchant secrets revealed with grace, 💡
A click that brings info to embrace, 🖱️
Corporate cards dance with might, 💳
Expenses now shine so bright! ✨
Rajini's style in code's embrace! 🌟


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4668e12 and 741a539.

📒 Files selected for processing (4)
  • src/app/fyle/add-edit-expense/add-edit-expense-6.spec.ts (2 hunks)
  • src/app/fyle/view-expense/view-expense.page.spec.ts (2 hunks)
  • src/app/shared/components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.spec.ts (1 hunks)
  • src/app/shared/shared.module.ts (3 hunks)
👮 Files not reviewed due to content moderation or server errors (3)
  • src/app/shared/components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.spec.ts
  • src/app/shared/shared.module.ts
  • src/app/fyle/view-expense/view-expense.page.spec.ts
🔇 Additional comments (2)
src/app/fyle/add-edit-expense/add-edit-expense-6.spec.ts (2)

90-90: Mind-blowing! The import statement is perfectly placed, like a well-choreographed action sequence!

The import for CCExpenseMerchantInfoPopoverComponent follows the established pattern and maintains code organization.


1228-1241: Superstar! This test case is a blockbuster performance!

The test implementation:

  • Creates proper spy objects
  • Verifies component creation with correct parameters
  • Ensures the popover is presented
  • Maintains consistent style with other test cases

Like my signature moves, this test covers all the right steps!


🪧 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 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 17, 2024
Copy link
Contributor

@Dimple16 Dimple16 left a comment

Choose a reason for hiding this comment

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

minor comment

templateUrl: './cc-expense-merchant-info-popover.component.html',
styleUrls: ['./cc-expense-merchant-info-popover.component.scss'],
})
export class CcExpenseMerchantInfoPopoverComponent {
Copy link
Contributor

Choose a reason for hiding this comment

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

update the name CCExpenseMerchantInfoPopoverComponent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

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

🔭 Outside diff range comments (1)
src/app/shared/components/transaction-status/transaction-status.component.html (1)

Line range hint 10-16: The click handler needs some keyboard love, machan!

Let's make it keyboard-friendly with proper semantic HTML and keyboard support!

-<div (click)="statusClick.emit(transactionStatus)" class="transaction-status__status-value-container">
+<button
+  (click)="statusClick.emit(transactionStatus)"
+  (keydown.enter)="statusClick.emit(transactionStatus)"
+  class="transaction-status__status-value-container"
+  role="button"
+  tabindex="0"
+  aria-label="View transaction status details">
   <span class="transaction-status__status-value" data-testid="status-value">{{ transactionStatus | titlecase }}</span>
   <ion-icon
     src="../../../assets/svg/info-circle-outline.svg"
     class="transaction-status__info-icon"
     data-testid="info-icon"
+    aria-hidden="true"
   ></ion-icon>
-</div>
+</button>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 160753f and 5351bad.

📒 Files selected for processing (13)
  • src/app/fyle/add-edit-expense/add-edit-expense.page.html (1 hunks)
  • src/app/fyle/add-edit-expense/add-edit-expense.page.scss (1 hunks)
  • src/app/fyle/add-edit-expense/add-edit-expense.page.ts (2 hunks)
  • src/app/fyle/view-expense/view-expense.page.html (1 hunks)
  • src/app/fyle/view-expense/view-expense.page.scss (1 hunks)
  • src/app/fyle/view-expense/view-expense.page.ts (2 hunks)
  • src/app/shared/components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.html (1 hunks)
  • src/app/shared/components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.scss (1 hunks)
  • src/app/shared/components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.spec.ts (1 hunks)
  • src/app/shared/components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.ts (1 hunks)
  • src/app/shared/components/transaction-status/transaction-status.component.html (1 hunks)
  • src/app/shared/components/transaction-status/transaction-status.component.scss (1 hunks)
  • src/app/shared/shared.module.ts (3 hunks)
🔇 Additional comments (7)
src/app/shared/components/transaction-status/transaction-status.component.scss (1)

41-41: Superstar styling, perfectly balanced!

The font-size addition maintains visual harmony with the status label. When I make a style statement, it's always consistent!

src/app/fyle/view-expense/view-expense.page.scss (1)

59-86: Mind it! These styles are perfectly structured!

The merchant block styles are well-organized with:

  • Proper BEM naming convention
  • Consistent use of color variables
  • Clean flex layout structure
  • Proper spacing and alignment
src/app/fyle/view-expense/view-expense.page.ts (1)

41-41: Clean import, like my entry in a movie!

The component import is properly placed with other imports.

src/app/shared/shared.module.ts (1)

156-156: Listen up, folks! These module changes are spot on!

The CcExpenseMerchantInfoPopoverComponent is properly declared and exported, following the Angular way like a boss! 🎭

Also applies to: 286-286, 422-422

src/app/fyle/view-expense/view-expense.page.html (1)

103-116: Superb structure, partner! This merchant info block is perfectly placed!

The conditional rendering, styling classes, and test attributes are all in perfect harmony! 🌟

src/app/fyle/add-edit-expense/add-edit-expense.page.html (1)

191-204: Magnificent implementation, my friend! The consistency is legendary!

The merchant info block perfectly mirrors the view-expense page implementation, maintaining a consistent user experience across the app! 🌟

src/app/fyle/add-edit-expense/add-edit-expense.page.ts (1)

143-143: Mind it! Import statement looks perfect!

The import for CcExpenseMerchantInfoPopoverComponent follows proper Angular conventions and is well-placed with other component imports.

Comment on lines +3 to +5
.header {
border-radius: 10px;
}
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 header needs more style, machan!

The border-radius of 10px is playing too safe. For a more modern look, let's make it more stylish!

.header {
-  border-radius: 10px;
+  border-radius: 16px;
+  overflow: hidden;
}
📝 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
.header {
border-radius: 10px;
}
.header {
border-radius: 16px;
overflow: hidden;
}

Comment on lines +17 to +19
&__toolbar-close-btn {
position: absolute;
}
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Ey! The close button needs some style-u, style-u!

The close button's position is absolute but missing proper coordinates and transitions for smooth animation.

&__toolbar-close-btn {
  position: absolute;
+  top: 12px;
+  right: 12px;
+  transition: transform 0.2s ease;
+  &:hover {
+    transform: scale(1.1);
+  }
}
📝 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
&__toolbar-close-btn {
position: absolute;
}
&__toolbar-close-btn {
position: absolute;
top: 12px;
right: 12px;
transition: transform 0.2s ease;
&:hover {
transform: scale(1.1);
}
}

Comment on lines +12 to +14
closePopover(): void {
this.popoverController.dismiss();
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

When something goes wrong, handle it with style!

The closePopover method needs proper error handling, just like how I handle villains in my movies!

async closePopover(): Promise<void> {
-  this.popoverController.dismiss();
+  try {
+    await this.popoverController.dismiss();
+  } catch (error) {
+    console.error('Failed to dismiss popover:', error);
+  }
}
📝 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
closePopover(): void {
this.popoverController.dismiss();
}
async closePopover(): Promise<void> {
try {
await this.popoverController.dismiss();
} catch (error) {
console.error('Failed to dismiss popover:', error);
}
}

Comment on lines 9 to 11
export class CcExpenseMerchantInfoPopoverComponent {
constructor(private popoverController: PopoverController) {}

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Mind it! Where is the merchant data input, partner?

The component needs to receive merchant information from its parent. Let's add some proper inputs!

export class CcExpenseMerchantInfoPopoverComponent {
+  @Input() merchantName: string;
+  @Input() merchantId: string;
+  @Input() merchantCategory?: string;
  constructor(private popoverController: PopoverController) {}

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

@@ -6,8 +6,7 @@
posted: transactionStatus === TransactionStatus.POSTED
}"
></div>

Transaction Status:
<div class="transaction-status__status-label">Transaction Status:</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Make it accessible for everyone, that's my style!

The transaction status label needs proper accessibility attributes. Let's make it inclusive!

-<div class="transaction-status__status-label">Transaction Status:</div>
+<div class="transaction-status__status-label" aria-label="Transaction Status Label" role="heading">Transaction Status:</div>
📝 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
<div class="transaction-status__status-label">Transaction Status:</div>
<div class="transaction-status__status-label" aria-label="Transaction Status Label" role="heading">Transaction Status:</div>

Comment on lines +680 to +707
&__merchant_block {
display: flex;
gap: 6px;
border-top: 1px solid $grey;
padding-top: 12px;
margin-top: 12px;
align-items: center;
}

&__merchant_label {
color: $black-light;
font-size: 12px;
}

&__merchant_value {
display: flex;
align-items: center;
gap: 2px;
color: $blue-black;
font-weight: 500;
font-size: 12px;
}

&__merchant_info_icon {
color: $blue-black;
width: 16px;
height: 16px;
}
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 pannu, but don't repeat pannu!

These merchant-related styles are duplicated between view-expense and add-edit-expense pages. Let's make it more powerful!

Consider extracting these common styles into a shared SCSS file:

+ // src/theme/shared/_merchant.scss
+ %merchant-block {
+   display: flex;
+   gap: 6px;
+   border-top: 1px solid $grey;
+   padding-top: 12px;
+   margin-top: 12px;
+   align-items: center;
+ }
+ 
+ %merchant-label {
+   color: $black-light;
+   font-size: 12px;
+ }
+ 
+ %merchant-value {
+   display: flex;
+   align-items: center;
+   gap: 2px;
+   color: $blue-black;
+   font-weight: 500;
+   font-size: 12px;
+ }
+ 
+ %merchant-info-icon {
+   color: $blue-black;
+   width: 16px;
+   height: 16px;
+ }

Then in both SCSS files:

+ @import '../../../theme/shared/merchant';

  &__merchant_block {
-   display: flex;
-   gap: 6px;
-   border-top: 1px solid $grey;
-   padding-top: 12px;
-   margin-top: 12px;
-   align-items: center;
+   @extend %merchant-block;
  }
  // Similarly extend other merchant-related styles

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

Comment on lines 520 to 527
async openCCExpenseMerchantInfoModal(): Promise<void> {
const popover = await this.popoverController.create({
component: CcExpenseMerchantInfoPopoverComponent,
cssClass: 'fy-dialog-popover',
});

await popover.present();
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

The modal needs some error handling power!

The modal presentation needs to handle potential errors, just like how I handle villains in my movies!

Add error handling:

  async openCCExpenseMerchantInfoModal(): Promise<void> {
+   try {
      const popover = await this.popoverController.create({
        component: CcExpenseMerchantInfoPopoverComponent,
        cssClass: 'fy-dialog-popover',
      });

      await popover.present();
+   } catch (error) {
+     console.error('Failed to present merchant info modal:', error);
+     // Consider showing a user-friendly error message
+     throw error;
+   }
  }
📝 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 openCCExpenseMerchantInfoModal(): Promise<void> {
const popover = await this.popoverController.create({
component: CcExpenseMerchantInfoPopoverComponent,
cssClass: 'fy-dialog-popover',
});
await popover.present();
}
async openCCExpenseMerchantInfoModal(): Promise<void> {
try {
const popover = await this.popoverController.create({
component: CcExpenseMerchantInfoPopoverComponent,
cssClass: 'fy-dialog-popover',
});
await popover.present();
} catch (error) {
console.error('Failed to present merchant info modal:', error);
// Consider showing a user-friendly error message
throw error;
}
}

Comment on lines 109 to 110
(click)="(openCCExpenseMerchantInfoModal())"
src="../../../assets/svg/info-circle-outline.svg"
Copy link

@coderabbitai coderabbitai bot Dec 17, 2024

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Style, my friend! Let's make that click handler more stylish!

Remove those extra parentheses around the click handler - they're not needed! 🎬

-  (click)="(openCCExpenseMerchantInfoModal())"
+  (click)="openCCExpenseMerchantInfoModal()"
📝 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
(click)="(openCCExpenseMerchantInfoModal())"
src="../../../assets/svg/info-circle-outline.svg"
(click)="openCCExpenseMerchantInfoModal()"
src="../../../assets/svg/info-circle-outline.svg"

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link

Choose a reason for hiding this comment

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

@Chethan-Fyle, thank you for your feedback, boss! Much appreciated!

╔(_/)
║( •~•) ← So happy, kabali style!
╚(⌒⌒)づ

Comment on lines 197 to 198
(click)="(openCCExpenseMerchantInfoModal())"
src="../../../assets/svg/info-circle-outline.svg"
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Style encore! Same click handler needs the same style fix!

Let's keep our event handlers clean and crisp! 🎭

-  (click)="(openCCExpenseMerchantInfoModal())"
+  (click)="openCCExpenseMerchantInfoModal()"
📝 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
(click)="(openCCExpenseMerchantInfoModal())"
src="../../../assets/svg/info-circle-outline.svg"
(click)="openCCExpenseMerchantInfoModal()"
src="../../../assets/svg/info-circle-outline.svg"

Comment on lines 5245 to 5252
async openCCExpenseMerchantInfoModal(): Promise<void> {
const popover = await this.popoverController.create({
component: CcExpenseMerchantInfoPopoverComponent,
cssClass: 'fy-dialog-popover',
});

await popover.present();
}
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Magizhchi! The implementation looks good, but let's add error handling!

The popover implementation follows good practices, but could be more robust with error handling. Here's a suggested improvement:

  async openCCExpenseMerchantInfoModal(): Promise<void> {
+   try {
      const popover = await this.popoverController.create({
        component: CcExpenseMerchantInfoPopoverComponent,
        cssClass: 'fy-dialog-popover',
      });

      await popover.present();
+   } catch (error) {
+     console.error('Failed to present merchant info popover:', error);
+     // Handle the error appropriately, maybe show a fallback UI
+   }
  }
📝 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 openCCExpenseMerchantInfoModal(): Promise<void> {
const popover = await this.popoverController.create({
component: CcExpenseMerchantInfoPopoverComponent,
cssClass: 'fy-dialog-popover',
});
await popover.present();
}
async openCCExpenseMerchantInfoModal(): Promise<void> {
try {
const popover = await this.popoverController.create({
component: CcExpenseMerchantInfoPopoverComponent,
cssClass: 'fy-dialog-popover',
});
await popover.present();
} catch (error) {
console.error('Failed to present merchant info popover:', error);
// Handle the error appropriately, maybe show a fallback UI
}
}

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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5351bad and db1dcc2.

📒 Files selected for processing (6)
  • src/app/fyle/add-edit-expense/add-edit-expense.page.html (1 hunks)
  • src/app/fyle/add-edit-expense/add-edit-expense.page.ts (2 hunks)
  • src/app/fyle/view-expense/view-expense.page.html (1 hunks)
  • src/app/fyle/view-expense/view-expense.page.ts (2 hunks)
  • src/app/shared/components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.ts (1 hunks)
  • src/app/shared/shared.module.ts (3 hunks)
👮 Files not reviewed due to content moderation or server errors (2)
  • src/app/fyle/add-edit-expense/add-edit-expense.page.html
  • src/app/fyle/add-edit-expense/add-edit-expense.page.ts
🔇 Additional comments (6)
src/app/fyle/view-expense/view-expense.page.html (2)

109-109: Style, my friend! Let's make that click handler more stylish!

Remove those extra parentheses around the click handler - they're not needed! 🎬

-(click)="openCCExpenseMerchantInfoModal()"
+(click)="openCCExpenseMerchantInfoModal()"

103-116: The merchant block looks perfect, thalaiva! 🌟

The implementation aligns well with the PR objective of adding merchant name suggestions in the expense detail card. The conditional rendering, fallback text, and info icon integration are all properly implemented.

src/app/shared/components/cc-expense-merchant-info-popover/cc-expense-merchant-info-popover.component.ts (2)

9-11: ⚠️ Potential issue

Ey! Where is the merchant data input, macha?

Just like how I never enter a scene without my signature style, this component needs its essential inputs!

export class CCExpenseMerchantInfoPopoverComponent {
+  @Input() merchantName: string;
+  @Input() merchantId: string;
+  @Input() merchantCategory?: string;

  constructor(private popoverController: PopoverController) {}

Likely invalid or redundant comment.


12-14: ⚠️ Potential issue

Mind it! Your error handling needs some style, partner!

The closePopover method needs proper error handling, just like how I handle my stunts - with precision and safety!

-  closePopover(): void {
-    this.popoverController.dismiss();
+  async closePopover(): Promise<void> {
+    try {
+      await this.popoverController.dismiss();
+    } catch (error) {
+      console.error('Failed to dismiss popover:', error);
+    }
+  }

Likely invalid or redundant comment.

src/app/fyle/view-expense/view-expense.page.ts (1)

520-527: ⚠️ Potential issue

Style ah? Where is the error handling, thalaiva?

The modal presentation needs proper error handling and merchant data passing, just like how I handle my movie climax - with perfection!

  async openCCExpenseMerchantInfoModal(): Promise<void> {
+   try {
      const popover = await this.popoverController.create({
        component: CCExpenseMerchantInfoPopoverComponent,
        cssClass: 'fy-dialog-popover',
+       componentProps: {
+         merchantName: this.expense?.matched_corporate_card_transactions?.[0]?.merchant,
+         merchantId: this.expense?.matched_corporate_card_transactions?.[0]?.merchant_id,
+         merchantCategory: this.expense?.matched_corporate_card_transactions?.[0]?.merchant_category
+       }
      });

      await popover.present();
+   } catch (error) {
+     console.error('Failed to present merchant info modal:', error);
+     throw error;
+   }
  }

Likely invalid or redundant comment.

src/app/shared/shared.module.ts (1)

286-286: Superstar style! The module changes are perfect!

The component is properly declared and exported in the SharedModule. Mind-blowing implementation, just like my signature moves!

Also applies to: 422-422

Comment on lines +108 to +113
<ion-icon
(click)="openCCExpenseMerchantInfoModal()"
src="../../../assets/svg/info-circle-outline.svg"
class="view-expense--card-container__merchant_info_icon"
data-testid="merchant-info-icon"
></ion-icon>
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Listen up, macha! Let's make our app accessible to everyone!

The info icon needs an aria-label to help screen readers understand its purpose. Also, add a tooltip to provide visual hint to users.

 <ion-icon
   (click)="openCCExpenseMerchantInfoModal()"
   src="../../../assets/svg/info-circle-outline.svg"
   class="view-expense--card-container__merchant_info_icon"
   data-testid="merchant-info-icon"
+  aria-label="View merchant information"
+  matTooltip="Click for more details about the merchant"
 ></ion-icon>
📝 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
<ion-icon
(click)="openCCExpenseMerchantInfoModal()"
src="../../../assets/svg/info-circle-outline.svg"
class="view-expense--card-container__merchant_info_icon"
data-testid="merchant-info-icon"
></ion-icon>
<ion-icon
(click)="openCCExpenseMerchantInfoModal()"
src="../../../assets/svg/info-circle-outline.svg"
class="view-expense--card-container__merchant_info_icon"
data-testid="merchant-info-icon"
aria-label="View merchant information"
matTooltip="Click for more details about the merchant"
></ion-icon>

@github-actions github-actions bot added size/L Large PR and removed size/M Medium PR labels Dec 19, 2024
Copy link

Unit Test Coverage % values
Statements 95.98% ( 19311 / 20119 )
Branches 91.1% ( 10664 / 11705 )
Functions 94.25% ( 5744 / 6094 )
Lines 96.02% ( 18440 / 19204 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Large PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants