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: Expense and Report Stats display the exact amount #3365

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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">
SahilK-027 marked this conversation as resolved.
Show resolved Hide resolved
<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 }}
SahilK-027 marked this conversation as resolved.
Show resolved Hide resolved
</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';
SahilK-027 marked this conversation as resolved.
Show resolved Hide resolved
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;
SahilK-027 marked this conversation as resolved.
Show resolved Hide resolved
}

&--expenses-stats-row {
padding-bottom: 18px;
padding-top: 8px;
padding: 24px 0 20px 0;
--ion-grid-column-padding: 0;
}
}
Loading