Skip to content

Commit

Permalink
fix: hide dashboard banner after opt in from card addition (#3129)
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashpatil78 authored Jul 1, 2024
1 parent 14ccfd1 commit 3d9ee43
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/fyle/dashboard/dashboard.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<app-card-stats (cardAdded)="onCardAdded()"></app-card-stats>
</mat-tab>
<mat-tab label="tasks">
<app-tasks></app-tasks>
<app-tasks (optedIn)="hideOptInDashboardBanner()"></app-tasks>
</mat-tab>
</mat-tab-group>
</ion-content>
Expand Down
7 changes: 7 additions & 0 deletions src/app/fyle/dashboard/dashboard.page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,4 +807,11 @@ describe('DashboardPage', () => {
expect(component.tasksComponent.doRefresh).not.toHaveBeenCalled();
});
});

it('hideOptInDashboardBanner(): should set canShowOptInBanner$ to false', () => {
component.hideOptInDashboardBanner();
component.canShowOptInBanner$.subscribe((res) => {
expect(res).toBeFalse();
});
});
});
5 changes: 5 additions & 0 deletions src/app/fyle/dashboard/dashboard.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ export class DashboardPage {
} else {
this.trackingService.optInFromPostPostCardAdditionInDashboard();
this.tasksComponent.doRefresh();
this.canShowOptInBanner$ = of(false);
}
});
}
Expand Down Expand Up @@ -438,4 +439,8 @@ export class DashboardPage {
this.trackingService.skipOptInFromDashboardBanner();
}
}

hideOptInDashboardBanner(): void {
this.canShowOptInBanner$ = of(false);
}
}
5 changes: 4 additions & 1 deletion src/app/fyle/dashboard/tasks/tasks.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, OnInit } from '@angular/core';
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { MatBottomSheet } from '@angular/material/bottom-sheet';
import { MatSnackBar } from '@angular/material/snack-bar';
import { ActivatedRoute, Router } from '@angular/router';
Expand Down Expand Up @@ -44,6 +44,8 @@ import { TransactionStatus } from 'src/app/core/models/platform/v1/expense.model
styleUrls: ['./tasks.component.scss'],
})
export class TasksComponent implements OnInit {
@Output() optedIn = new EventEmitter<void>();

tasks$: Observable<DashboardTask[]>;

loadData$: BehaviorSubject<TaskFilters> = new BehaviorSubject({
Expand Down Expand Up @@ -416,6 +418,7 @@ export class TasksComponent implements OnInit {

if (data && data.action === 'SUCCESS') {
this.doRefresh();
this.optedIn.emit();
}
});
}
Expand Down

0 comments on commit 3d9ee43

Please sign in to comment.