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: Report card section display exact amount #3328

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

SahilK-027
Copy link
Contributor

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

Clickup

clickup link

UI Preview

Big screens
Screenshot 2024-12-11 at 2 49 02 PM

Small screens
Screenshot 2024-12-11 at 2 49 08 PM

Responsiveness
https://github.com/user-attachments/assets/cfe8a1a4-b90e-4d94-9b37-c98a6d00f87d

Summary by CodeRabbit

  • New Features

    • Introduced a new loading screen feature in the reports section.
    • Added a section for displaying the report date in report cards, enhancing visual organization.
  • Bug Fixes

    • Improved amount display logic for report cards with a new currency formatting method.
  • Style

    • Updated styling for report cards, including layout adjustments and font size modifications.
  • Tests

    • Added a new pipe for currency formatting in the report card component's test suite.

Copy link

coderabbitai bot commented Dec 11, 2024

Walkthrough

The pull request introduces modifications to the app-fy-loading-screen component and the reports-card component. The loading screen now includes a new input property to enable a new loader feature. In the reports card, the structure is enhanced with a new date display, updated layout, and styling adjustments. Additionally, a new pipe for currency formatting is integrated into the test suite for the reports card, ensuring that the component's functionality remains intact while improving its presentation.

Changes

File Path Change Summary
src/app/fyle/my-reports/my-reports.page.html Updated <app-fy-loading-screen> to include [isNewLoaderEnabled]="true" for the new loader feature.
src/app/shared/components/reports-card/reports-card.component.html Enhanced report card structure with a new date display, updated layout, and a new container class. Removed unnecessary blocks and modified amount display logic.
src/app/shared/components/reports-card/reports-card.component.scss Adjusted styles for report cards, including padding, margins, and font sizes. Introduced new classes for layout improvements.
src/app/shared/components/reports-card/reports-card.component.spec.ts Added ExactCurrencyPipe to the test suite for ReportsCardComponent, maintaining existing test structure.

Possibly related PRs

Suggested labels

size/M

Suggested reviewers

  • Dimple16
  • Chethan-Fyle

🎉 In the realm of code, changes take flight,
A loader shines bright, making things right.
Reports now gleam, with dates in their space,
Currency flows smoothly, a beautiful grace.
With styles refined, and tests standing tall,
Together we code, and together we enthrall! 🚀


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 11, 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: 4

🧹 Outside diff range comments (1)
src/app/shared/components/reports-card/reports-card.component.spec.ts (1)

Line range hint 41-50: Kabali style testing needed for the new features!

The test suite needs additional coverage for the new exactCurrency pipe and date display functionality.

Add these test cases:

it('should format currency correctly with exactCurrency pipe', () => {
  component.report.amount = 1234567.89;
  component.report.currency = 'USD';
  fixture.detectChanges();
  
  expect(getTextContent(getElementBySelector(fixture, '.reports-card--amount'))).toEqual('1,234,567.89');
});

it('should handle date display correctly when showDate is true/false', () => {
  component.showDate = true;
  fixture.detectChanges();
  expect(getElementBySelector(fixture, '.reports-card--date')).toBeTruthy();
  
  component.showDate = false;
  fixture.detectChanges();
  expect(getElementBySelector(fixture, '.reports-card--date')).toBeFalsy();
});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between 3f80c86 and 8783283.

📒 Files selected for processing (4)
  • src/app/fyle/my-reports/my-reports.page.html (1 hunks)
  • src/app/shared/components/reports-card/reports-card.component.html (1 hunks)
  • src/app/shared/components/reports-card/reports-card.component.scss (4 hunks)
  • src/app/shared/components/reports-card/reports-card.component.spec.ts (2 hunks)
🔇 Additional comments (3)
src/app/fyle/my-reports/my-reports.page.html (3)

Line range hint 1-136: Superstar approves this template structure!

Like a well-choreographed fight sequence, this template has everything in perfect order - error handling, loading states, and infinite scroll. Keep rocking, partner!


75-75: Kabali style verification needed for this loader, macha!

The new loader is like my entry scene - it needs to make an impact! But before we roll it out:

Let me check if this property is properly defined in the component:

✅ Verification successful

Mind it! The loader is perfectly set up and ready to rock, macha!

Listen here, style-u! The verification shows everything is in perfect order:

  • The isNewLoaderEnabled property is properly defined as an Input() in the component
  • The HTML template is using this property like a well-choreographed dance sequence, controlling:
    • Grid classes with ngClass
    • Column sizes with dynamic calculations
    • Icon container styling

The loader will make its grand entry with style, just like how I flip my cigarette! 🕶️

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the isNewLoaderEnabled property in the loading screen component

# Search for the property definition
ast-grep --pattern 'class $_ {
  $$$
  @Input() isNewLoaderEnabled: boolean;
  $$$
}'

# Search for any related tests
rg 'isNewLoaderEnabled.*=.*true' -g '*.spec.ts'

Length of output: 137


Script:

#!/bin/bash
# Let's search for the loading screen component with style!
fd "loading-screen.component.ts" --type f

# Time to check where this property is being used, mind it!
rg "isNewLoaderEnabled" --type ts -C 3

# Let's also check the HTML template of the loading screen component
fd "loading-screen.component.html" --type f --exec cat {}

Length of output: 2581


75-75: 🛠️ Refactor suggestion

Mind it! The new loader needs consistency across all instances, partner!

I notice you've enabled the new loader in one place, but what about the other loading screen at the bottom during infinite scroll? When you make a style change, it should be like my punch - consistent everywhere!

Let me verify this inconsistency with my signature style:

Make it consistent like this, partner:

- <app-fy-loading-screen class="my-reports--shimmers"></app-fy-loading-screen>
+ <app-fy-loading-screen [isNewLoaderEnabled]="true" class="my-reports--shimmers"></app-fy-loading-screen>

Copy link

Unit Test Coverage % values
Statements 96% ( 19246 / 20046 )
Branches 91.13% ( 10656 / 11692 )
Functions 94.34% ( 5743 / 6087 )
Lines 96.04% ( 18377 / 19133 )

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