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: Dashboard > Home: Card expenses section display exact amount #3367

Merged
merged 5 commits into from
Dec 18, 2024

Conversation

SahilK-027
Copy link
Contributor

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

Clickup

clickup link

UI Preview

Screen.Recording.2024-12-17.at.3.31.35.PM.mov

Summary by CodeRabbit

  • New Features

    • Enhanced display logic for total draft and amount values based on screen size.
  • Style

    • Updated typography for various classes in the Card Detail component for improved visual consistency.
  • Tests

    • Added ExactCurrencyPipe to the test suite for enhanced testing capabilities of the Card Detail component.
  • Chores

    • Introduced a new property to manage screen size conditions in the Card Detail component.

Copy link

coderabbitai bot commented Dec 17, 2024

Walkthrough

Listen up, superstar! This pull request brings a stylish transformation to the card detail component. The changes focus on smart currency display, using conditional rendering to showcase exact currency values based on screen size. New properties and styling adjustments enhance the visual consistency and responsiveness, ensuring every pixel tells a vibrant story!

Changes

File Change Summary
src/app/shared/components/spent-cards/card-detail/card-detail.component.html Added conditional rendering for currency values using exactCurrency pipe based on screen size.
src/app/shared/components/spent-cards/card-detail/card-detail.component.scss Adjusted font sizes and alignment for various stats classes for visual consistency.
src/app/shared/components/spent-cards/card-detail/card-detail.component.ts Introduced isSmallScreen property for screen size detection.
src/app/shared/components/spent-cards/card-detail/card-detail.component.spec.ts Added ExactCurrencyPipe to test declarations for enhanced testing capabilities.

Possibly related PRs

Suggested reviewers

  • Dimple16

Poem

Currencies dance, pixels align,
Code transforms with style divine,
Responsive magic, screen so bright,
Rajinikanth's code takes flight! 💥🚀
Superstar style in every line! 🌟

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the size/M Medium PR label Dec 17, 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: 7

🔭 Outside diff range comments (1)
src/app/shared/components/spent-cards/card-detail/card-detail.component.ts (1)

Line range hint 1-58: Mind-blowing architectural suggestion coming your way!

Like how I handle multiple roles in my movies, this component is handling multiple responsibilities. Consider creating a dedicated screen size service for better reusability across components!

Create a new service:

@Injectable({
  providedIn: 'root'
})
export class ScreenSizeService {
  private readonly SMALL_SCREEN_WIDTH = 320;
  private screenSizeSubject = new BehaviorSubject<boolean>(false);
  
  isSmallScreen$ = this.screenSizeSubject.asObservable();

  constructor() {
    if (typeof window !== 'undefined') {
      this.checkScreenSize();
      fromEvent(window, 'resize')
        .pipe(debounceTime(200))
        .subscribe(() => this.checkScreenSize());
    }
  }

  private checkScreenSize(): void {
    this.screenSizeSubject.next(window.innerWidth <= this.SMALL_SCREEN_WIDTH);
  }
}

This way, other components can simply inject and subscribe to the service! What do you say, partner?

🧰 Tools
🪛 eslint

[error] 26-26: Member isSmallScreen should be declared before all public constructor definitions.

(@typescript-eslint/member-ordering)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cb9cd69 and ee3d1f9.

📒 Files selected for processing (4)
  • src/app/shared/components/spent-cards/card-detail/card-detail.component.html (2 hunks)
  • src/app/shared/components/spent-cards/card-detail/card-detail.component.scss (1 hunks)
  • src/app/shared/components/spent-cards/card-detail/card-detail.component.spec.ts (2 hunks)
  • src/app/shared/components/spent-cards/card-detail/card-detail.component.ts (4 hunks)
🧰 Additional context used
🪛 eslint
src/app/shared/components/spent-cards/card-detail/card-detail.component.ts

[error] 26-26: Member isSmallScreen should be declared before all public constructor definitions.

(@typescript-eslint/member-ordering)

🔇 Additional comments (2)
src/app/shared/components/spent-cards/card-detail/card-detail.component.scss (2)

44-44: Mind it! Perfect vertical alignment, just like my signature walk!

The addition of align-items: center brings perfect balance to the force... I mean, to the stats layout. When style meets precision, magic happens!


60-60: Thalaiva approves these precise measurements!

Reducing font sizes from 18px and 16px to 14px is like my perfect timing - small changes, big impact! These adjustments will make the numbers as clear as my famous sunglasses, even on the smallest screens!

Also applies to: 66-66

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

♻️ Duplicate comments (1)
src/app/shared/components/spent-cards/card-detail/card-detail.component.ts (1)

25-26: ⚠️ Potential issue

Kabali says: Let's maintain our style, thalaiva!

These style issues were mentioned in previous reviews, but they're still hanging around like villains in my movies!

Let's fix them with style:

+  private readonly SMALL_SCREEN_WIDTH = 320;
+  isSmallScreen: boolean = false;

   constructor(
🧰 Tools
🪛 eslint

[error] 26-26: Member isSmallScreen should be declared before all public constructor definitions.

(@typescript-eslint/member-ordering)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ee3d1f9 and b93d89c.

📒 Files selected for processing (1)
  • src/app/shared/components/spent-cards/card-detail/card-detail.component.ts (4 hunks)
🧰 Additional context used
🪛 eslint
src/app/shared/components/spent-cards/card-detail/card-detail.component.ts

[error] 26-26: Member isSmallScreen should be declared before all public constructor definitions.

(@typescript-eslint/member-ordering)

🔇 Additional comments (1)
src/app/shared/components/spent-cards/card-detail/card-detail.component.ts (1)

1-1: Mind it! The OnInit implementation is perfect, just like my signature style!

The way you've imported and implemented OnInit interface is spot on! That's how we roll in the Angular world, partner!

Also applies to: 12-12

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.

same comments as #3365 (review)

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 18, 2024 06:05
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b93d89c and 217164d.

📒 Files selected for processing (2)
  • src/app/shared/components/spent-cards/card-detail/card-detail.component.html (2 hunks)
  • src/app/shared/components/spent-cards/card-detail/card-detail.component.ts (1 hunks)
🔇 Additional comments (1)
src/app/shared/components/spent-cards/card-detail/card-detail.component.ts (1)

19-20: ⚠️ Potential issue

Listen up, partner! Your screen size check needs some style!

The screen size implementation needs more power, just like my signature moves! Here's what's cooking:

  1. Direct window access without safety check could crash in SSR
  2. No resize handling means the screen size won't update dynamically
  3. Magic number 320 should be a constant, like my punch dialogues - memorable and reusable!

Here's how to make it blockbuster worthy:

+  private readonly SMALL_SCREEN_WIDTH = 320;
+  isSmallScreen = false;
+
+  @HostListener('window:resize')
+  private checkScreenSize(): void {
+    if (typeof window !== 'undefined') {
+      this.isSmallScreen = window.innerWidth <= this.SMALL_SCREEN_WIDTH;
+    }
+  }
+
+  ngOnInit(): void {
+    this.checkScreenSize();
+  }

-  // To track if the screen is small (320px or below)
-  isSmallScreen = window.innerWidth <= 320;

Likely invalid or redundant comment.

Copy link

Unit Test Coverage % values
Statements 96% ( 19303 / 20106 )
Branches 91.12% ( 10664 / 11703 )
Functions 94.3% ( 5741 / 6088 )
Lines 96.04% ( 18433 / 19192 )

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