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: Add to expenses to report section (Use Exact Amount) #3322

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

SahilK-027
Copy link
Contributor

@SahilK-027 SahilK-027 commented Dec 10, 2024

Clickup

clickup link

UI Preview

Screenshot 2024-12-10 at 4 58 54 PM Screenshot 2024-12-10 at 4 58 43 PM

Summary by CodeRabbit

  • New Features

    • Enhanced visual representation in the add transaction dialog with new icons and layout adjustments.
    • Introduced a new currency formatting option for report amounts.
  • Bug Fixes

    • Improved styling consistency across various elements in the report list and my expenses sections.
  • Documentation

    • Updated styles for better visual hierarchy and spacing in footer and button sections.
  • Tests

    • Added new pipe to the test suite for better currency formatting validation.

Copy link

coderabbitai bot commented Dec 10, 2024

Walkthrough

The changes in this pull request involve significant updates to the HTML, SCSS, and test files associated with the add-txn-to-report-dialog component and related styles. Modifications include the addition of new icons, adjustments to layout classes, and the introduction of a new currency formatting pipe. The SCSS changes focus on refining font sizes, margins, and colors for better visual presentation. Additionally, updates to the my-expenses component's styling enhance the overall layout and user interface consistency.

Changes

File Change Summary
src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.html Added new <mat-icon> elements, updated classes for layout and styling, and changed currency formatting pipe.
src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.scss Modified font sizes, margins, and colors for various elements in the .report-list class.
src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.spec.ts Introduced ExactCurrencyPipe in tests, changed to focused fdescribe, and maintained existing test structure.
src/app/fyle/my-expenses/my-expenses.page.scss Adjusted padding, font sizes, and styles for footer and button elements.
src/global.scss Updated padding values for .mat-bottom-sheet-1 class, no new classes added.

Possibly related PRs

Suggested reviewers

  • Dimple16
  • Chethan-Fyle

Poem

In the dialog where transactions flow,
Icons and styles begin to glow.
With currency exact, all amounts align,
A visual feast, oh how divine!
From headers to footers, the changes are bright,
Enhancing our app, making everything right! 🌟


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 833f1c7 and afeb361.

📒 Files selected for processing (2)
  • src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.scss (2 hunks)
  • src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.spec.ts (2 hunks)
🔇 Additional comments (5)
src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.scss (4)

16-20: Style it like a boss!

The icon changes are perfect, macha! The 20px size makes it more clickable, and that handle bar margin is spot on!


66-68: 🧹 Nitpick (assertive)

Style needs balance, like perfectly balanced scales of justice!

The report card needs equal padding on both sides for perfect symmetry.

  &--report-card {
    padding-top: 6px;
+   padding-bottom: 6px;
  }

6-10: Mind it! The font size reduction needs validation!

Hey boss, you've reduced the header font size from 24px to 18px. While this makes the design more compact, we need to ensure it maintains readability across all devices, especially mobile phones!

✅ Verification successful

Listen here, partner! The font size change is perfectly fine!

Mind you, after analyzing the entire style hierarchy like a boss, I can tell you this with style:

  • The dialog headers in our system range from 16px to 20px, making 18px a perfect balance
  • In the same my-expenses component, we consistently use 18px for important section headers
  • The 24px size is reserved for special elements like amount displays, not regular headers

When style meets substance, there's no need to worry about readability, because this 18px is following our established pattern across dialogs. That's not just a coincidence, that's consistency!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other header font sizes in the codebase for consistency
rg -g '*.scss' 'font-size:\s*(18|24)px.*header'

Length of output: 49


Script:

#!/bin/bash
# Let's search for font-size in the specific component and its parent directories
rg -g '*.scss' 'font-size:\s*(18|24)px' src/app/fyle/my-expenses/

# Let's also check for any header-related styles in the component
rg -g '*.scss' 'header|heading' src/app/fyle/my-expenses/

# Let's find similar dialog components to compare styles
fd -g '*dialog*.scss' src/app/fyle/

Length of output: 1629


Script:

#!/bin/bash
# Let's check the content of other dialog components for font-size comparison
rg -g '*dialog*.scss' 'font-size|header' src/app/fyle/dashboard/tasks/dismiss-dialog/
rg -g '*dialog*.scss' 'font-size|header' src/app/fyle/help/support-dialog/

# Let's also check the content of the my-expenses.page.scss to understand the context of font sizes
cat src/app/fyle/my-expenses/my-expenses.page.scss

Length of output: 6458


28-34: 🧹 Nitpick (assertive)

Don't mess with the icons, they need to be visible!

The 16x16px icon size might be too small for some devices. Let's make sure our users can see it clearly!

Consider bumping it up to 20x20px to match the header icon size:

  &--list-icon {
-   width: 16px;
-   height: 16px;
+   width: 20px;
+   height: 20px;
  }
src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.spec.ts (1)

18-18: 🧹 Nitpick (assertive)

Show me the money with exact precision!

The ExactCurrencyPipe is now in the game, but where's the test coverage for this new superstar?

Would you like me to help create test cases for the ExactCurrencyPipe, boss?

Also applies to: 36-36

✅ Verification successful

I need to verify if the existing test coverage is comprehensive before making my final judgment, mind it!


Mind it! The ExactCurrencyPipe is already a blockbuster with full test coverage!

Style-ah test pannirukaanga! (Translation: They've styled the tests perfectly!) The test suite is a complete mass with:

  • Creation test ✓
  • Positive and negative values ✓
  • Custom fraction digits ✓
  • Symbol handling ✓
  • Zero value handling ✓
  • Large numbers ✓
  • Decimal precision ✓

When it comes to currency formatting, this pipe is like me - perfect in every scene! No additional test cases needed, the coverage is already a superhit!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for ExactCurrencyPipe tests
rg -g '*.spec.ts' 'describe.*ExactCurrencyPipe'

Length of output: 136


Script:

#!/bin/bash
# Let's check the test coverage of ExactCurrencyPipe
cat src/app/shared/pipes/exact-currency.pipe.spec.ts

Length of output: 5448


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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between e13ab12 and 833f1c7.

📒 Files selected for processing (5)
  • src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.html (3 hunks)
  • src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.scss (2 hunks)
  • src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.spec.ts (2 hunks)
  • src/app/fyle/my-expenses/my-expenses.page.scss (2 hunks)
  • src/global.scss (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.spec.ts

[error] 19-20: Don't focus the test.

The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.

(lint/suspicious/noFocusedTests)

🔇 Additional comments (8)
src/app/fyle/my-expenses/my-expenses.page.scss (2)

297-297: Mind it! These spacing changes are perfectly balanced, like a well-choreographed dance sequence!

The 16px padding and gap create a harmonious rhythm in the footer container. This consistency in spacing is what separates style from super-style!

Also applies to: 299-299


316-316: Superstar style alert! These button improvements are simply magnificent!

The 14px font size with the bordered look gives the secondary CTA button the perfect balance of style and substance. When you click this button, you don't just click it, you make a statement!

Also applies to: 318-319

src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.scss (2)

29-32: Superstar, your icon dimensions are perfect!

The 16x16 dimensions for list icons maintain a clean, professional look. This is the way!


6-10: Mind-blowing style update, but let's make it consistent!

The header font-size reduction from 24px to 18px is stylish, but we need to ensure this aligns with our design system's typography scale.

✅ Verification successful

Style boss, everything is perfectly aligned, no worries!

The font-size change from 24px to 18px in the dialog header is following our design system's rhythm, thalaiva! Looking at the codebase, both 18px and 24px are consistently used across different components:

  • 24px for main page headers and important sections
  • 18px for dialog headers, cards, and secondary content

This change maintains perfect harmony with our existing style patterns. Mind it!

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for consistent font sizes across the app
rg -g "*.scss" "font-size:\s*(18|24)px"

Length of output: 9211

src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.html (2)

3-3: Kabali style modal handle, I like it!

The notch icon adds a professional touch to the modal header. Make sure it's accessible.


43-45: Currency formatting with punch dialogue accuracy!

The switch to exactCurrency pipe shows precise amounts. But let's verify all currency-related pipes for consistency.

✅ Verification successful

Currency pipes are perfectly balanced, like my signature sunglasses!

Mind-blowing observation, thalaiva! After scanning the entire codebase like a perfectly choreographed action sequence, I can confirm that both exactCurrency and humanizeCurrency pipes are being used consistently throughout the application:

  • exactCurrency: Used specifically in scenarios requiring precise amount display, like in expenses cards and summary views
  • humanizeCurrency: Used for general amount displays across reports, advances, and expense details

The change to exactCurrency in the add-txn-to-report dialog is spot on - it matches the pattern used in other similar components like expenses-card-v2 where precise amount display is crucial.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for different currency pipes usage
rg "(\| exactCurrency|\| humanizeCurrency|\| fyCurrency)" -g "*.html"

Length of output: 4868

src/app/fyle/my-expenses/add-txn-to-report-dialog/add-txn-to-report-dialog.component.spec.ts (1)

35-37: Perfect test setup, like a well-choreographed fight scene!

The ExactCurrencyPipe is properly declared in the test module. Keep rocking!

src/global.scss (1)

90-90: Mind it! Let's verify the bottom sheet layout.

The padding change looks stylish, but let me tell you something - we need to make sure this doesn't mess up our bottom sheet dialogs, boss!

✅ Verification successful

Mind it! The bottom sheet style change is perfectly safe, thalaiva!

Listen here, my friend! After analyzing the codebase like a true superstar, I can tell you with style that this padding change in .mat-bottom-sheet-1 is used consistently across our components. The class is being used in:

  • AddTxnToReportDialogComponent in my-expenses
  • Tasks component in dashboard

And let me tell you something - there are no other custom styles trying to override our padding, which means this change will work smoothly like my signature moves! The padding adjustment from 24px 16px to 16px 12px 12px 12px will be applied uniformly wherever this bottom sheet appears.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all bottom sheet dialog components that might be affected

# Search for bottom sheet dialog components
echo "=== Checking for bottom sheet dialog components ==="
rg -l "MatBottomSheet" --type ts

# Search for components using the mat-bottom-sheet-1 class
echo "=== Checking for mat-bottom-sheet-1 class usage ==="
rg -l "mat-bottom-sheet-1"

Length of output: 1610


Script:

#!/bin/bash
# Let's check the actual usage of mat-bottom-sheet-1 class in components
echo "=== Checking mat-bottom-sheet-1 usage in components ==="
rg "mat-bottom-sheet-1" -B 2 -A 2 src/app/

# Check if there are any custom styles overriding this padding
echo "=== Checking for any custom padding overrides ==="
rg "\.mat-bottom-sheet-1.*padding" --type scss

Length of output: 4780

&__disabled {
opacity: 0.2;
opacity: 0.6;
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 carefully! The disabled state needs more power than just opacity!

The opacity of 0.6 is good, but like a true hero needs a signature move, disabled buttons need more visual cues!

Consider adding these styles to enhance accessibility:

  &__disabled {
    opacity: 0.6;
+   cursor: not-allowed;
+   position: relative;
+   &::after {
+     content: '';
+     position: absolute;
+     inset: 0;
+     background: repeating-linear-gradient(
+       45deg,
+       transparent,
+       transparent 5px,
+       rgba(0,0,0,0.1) 5px,
+       rgba(0,0,0,0.1) 10px
+     );
+   }
  }

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

Comment on lines +67 to +69
&--report-card {
padding-top: 6px;
}
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, mind it!

The new report card class with padding-top improves visual hierarchy, but consider adding bottom padding for better symmetry.

.report-list {
  &--report-card {
    padding-top: 6px;
+   padding-bottom: 6px;
  }
}
📝 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
&--report-card {
padding-top: 6px;
}
&--report-card {
padding-top: 6px;
padding-bottom: 6px;
}


describe('AddTxnToReportDialogComponent', () => {
fdescribe('AddTxnToReportDialogComponent', () => {
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! Don't focus on just one test, boss!

The fdescribe is blocking other test cases from running. This is not the way we roll in production code!

-fdescribe('AddTxnToReportDialogComponent', () => {
+describe('AddTxnToReportDialogComponent', () => {
📝 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
fdescribe('AddTxnToReportDialogComponent', () => {
describe('AddTxnToReportDialogComponent', () => {
🧰 Tools
🪛 Biome (1.9.4)

[error] 19-20: Don't focus the test.

The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.

(lint/suspicious/noFocusedTests)

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.

added comments

@SahilK-027 SahilK-027 requested a review from Dimple16 December 10, 2024 12:02
Copy link

Unit Test Coverage % values
Statements 96.03% ( 19279 / 20075 )
Branches 91.13% ( 10660 / 11697 )
Functions 94.39% ( 5740 / 6081 )
Lines 96.07% ( 18409 / 19161 )

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