From 65f63770de12ec49c28b610a6e6de9ce8c5949c8 Mon Sep 17 00:00:00 2001 From: SahilK-027 Date: Tue, 17 Dec 2024 14:46:14 +0530 Subject: [PATCH] feat: Dashboard > Home: Expense and Report Stats display the exact amount --- .../stat-badge/stat-badge.component.html | 11 ++++++++--- .../stat-badge/stat-badge.component.scss | 9 +++------ .../stat-badge/stat-badge.component.spec.ts | 3 ++- .../stat-badge/stat-badge.component.ts | 17 +++++++++++++++-- .../fyle/dashboard/stats/stats.component.scss | 8 +++----- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/app/fyle/dashboard/stat-badge/stat-badge.component.html b/src/app/fyle/dashboard/stat-badge/stat-badge.component.html index bc4e4ceaff..1ffe9e36d8 100644 --- a/src/app/fyle/dashboard/stat-badge/stat-badge.component.html +++ b/src/app/fyle/dashboard/stat-badge/stat-badge.component.html @@ -2,7 +2,7 @@
- +
- + @@ -44,7 +44,12 @@ {{ currencySymbol }} - {{ value | humanizeCurrency: currency:true }} + + {{ { value: value, currencyCode: currency, skipSymbol: true } | exactCurrency }} + + + {{ value | humanizeCurrency : currency : true }} +
{ beforeEach(waitForAsync(() => { const fyCurrencyPipeSpy = jasmine.createSpyObj('FyCurrencyPipe', ['transform']); TestBed.configureTestingModule({ - declarations: [StatBadgeComponent, HumanizeCurrencyPipe, FyCurrencyPipe], + declarations: [StatBadgeComponent, HumanizeCurrencyPipe, ExactCurrencyPipe, FyCurrencyPipe], imports: [IonicModule.forRoot()], providers: [ { diff --git a/src/app/fyle/dashboard/stat-badge/stat-badge.component.ts b/src/app/fyle/dashboard/stat-badge/stat-badge.component.ts index de97bf0f6d..1d44bebc8d 100644 --- a/src/app/fyle/dashboard/stat-badge/stat-badge.component.ts +++ b/src/app/fyle/dashboard/stat-badge/stat-badge.component.ts @@ -1,12 +1,13 @@ -import { Component, Input, Output, EventEmitter } from '@angular/core'; +import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core'; import { ReportStates } from './report-states'; +import { HostListener } from '@angular/core'; @Component({ selector: 'app-stat-badge', templateUrl: './stat-badge.component.html', styleUrls: ['./stat-badge.component.scss'], }) -export class StatBadgeComponent { +export class StatBadgeComponent implements OnInit { @Input() reportState: ReportStates; @Input() name: string; @@ -25,6 +26,14 @@ export class StatBadgeComponent { @Output() badgeClicked = new EventEmitter(); + // To track if the screen is small (360px or below) + isSmallScreen: boolean = false; + + @HostListener('window:resize', ['$event']) + onResize(event: Event) { + this.isSmallScreen = window.innerWidth <= 360; + } + onBadgeClicked() { if (!this.loading) { this.badgeClicked.emit(this.reportState); @@ -33,4 +42,8 @@ export class StatBadgeComponent { } } } + + ngOnInit() { + this.isSmallScreen = window.innerWidth <= 360; + } } diff --git a/src/app/fyle/dashboard/stats/stats.component.scss b/src/app/fyle/dashboard/stats/stats.component.scss index 6de58c3d98..309386f265 100644 --- a/src/app/fyle/dashboard/stats/stats.component.scss +++ b/src/app/fyle/dashboard/stats/stats.component.scss @@ -20,7 +20,7 @@ $ccc-bank-name: #c4cae8; &--header { font-size: 14px; line-height: 18px; - color: $grey-light; + color: $black-light; font-weight: 500; } @@ -87,14 +87,12 @@ $ccc-bank-name: #c4cae8; } &--report-stats-row { - padding-bottom: 18px; - padding-top: 18px; + padding: 24px 0 20px 0; --ion-grid-column-padding: 0; } &--expenses-stats-row { - padding-bottom: 18px; - padding-top: 8px; + padding: 24px 0 20px 0; --ion-grid-column-padding: 0; } }