Skip to content

Commit

Permalink
feat: Dashboard > Home: Expense and Report Stats display the exact am…
Browse files Browse the repository at this point in the history
…ount (#3365)
  • Loading branch information
SahilK-027 authored Dec 18, 2024
1 parent cb9cd69 commit 6aaac4c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
11 changes: 8 additions & 3 deletions src/app/fyle/dashboard/stat-badge/stat-badge.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="stat-badge--container">
<ion-grid class="stat-badge--grid">
<ion-row>
<ion-col class="stat-badge--count-col" size="4">
<ion-col class="stat-badge--count-col" size="3">
<div *ngIf="!loading && reportState">
<div
*ngIf="!loading"
Expand All @@ -23,7 +23,7 @@
<ion-skeleton-text animated></ion-skeleton-text>
</div>
</ion-col>
<ion-col class="stat-badge--grid-outer-col" size="8">
<ion-col class="stat-badge--grid-outer-col" size="9">
<ion-grid class="stat-badge--grid">
<ion-row>
<ion-col class="stat-badge--grid-col">
Expand All @@ -44,7 +44,12 @@
<span class="stat-badge--currency">
{{ currencySymbol }}
</span>
{{ value | humanizeCurrency: currency:true }}
<ng-container *ngIf="!isSmallScreen && value > -1000000000 && value < 1000000000; else humanize">
{{ { value: value, currencyCode: currency, skipSymbol: true } | exactCurrency }}
</ng-container>
<ng-template #humanize>
{{ value | humanizeCurrency : currency : true }}
</ng-template>
</div>
<div *ngIf="loading">
<ion-skeleton-text
Expand Down
9 changes: 3 additions & 6 deletions src/app/fyle/dashboard/stat-badge/stat-badge.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@
--ion-grid-column-padding: 4px;
}

&--count-col {
padding-left: 8px;
padding-right: 8px;
}

&--count {
min-width: 30px;
min-height: 30px;
Expand Down Expand Up @@ -81,10 +76,12 @@

&--amount {
font-weight: 500;
font-size: 12px;
color: $black;
}

&--name {
font-size: 14px;
font-size: 12px;
line-height: 18px;
color: $blue-black;
white-space: nowrap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IonicModule } from '@ionic/angular';
import { getElementBySelector, getTextContent } from 'src/app/core/dom-helpers';
import { FyCurrencyPipe } from 'src/app/shared/pipes/fy-currency.pipe';
import { HumanizeCurrencyPipe } from 'src/app/shared/pipes/humanize-currency.pipe';
import { ExactCurrencyPipe } from 'src/app/shared/pipes/exact-currency.pipe';
import { ReportStates } from './report-states';

import { StatBadgeComponent } from './stat-badge.component';
Expand All @@ -14,7 +15,7 @@ describe('StatBadgeComponent', () => {
beforeEach(waitForAsync(() => {
const fyCurrencyPipeSpy = jasmine.createSpyObj('FyCurrencyPipe', ['transform']);
TestBed.configureTestingModule({
declarations: [StatBadgeComponent, HumanizeCurrencyPipe, FyCurrencyPipe],
declarations: [StatBadgeComponent, HumanizeCurrencyPipe, ExactCurrencyPipe, FyCurrencyPipe],
imports: [IonicModule.forRoot()],
providers: [
{
Expand Down
5 changes: 4 additions & 1 deletion src/app/fyle/dashboard/stat-badge/stat-badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export class StatBadgeComponent {

@Output() badgeClicked = new EventEmitter();

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

onBadgeClicked(): void {
if (!this.loading) {
this.badgeClicked.emit(this.reportState);
if (this.expenseState) {
Expand Down
8 changes: 3 additions & 5 deletions src/app/fyle/dashboard/stats/stats.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ccc-bank-name: #c4cae8;
&--header {
font-size: 14px;
line-height: 18px;
color: $grey-light;
color: $black-light;
font-weight: 500;
}

Expand Down Expand Up @@ -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;
}
}

0 comments on commit 6aaac4c

Please sign in to comment.