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

Fix: fixed the zero state expense #3359

Merged
merged 1 commit into from
Dec 17, 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
9 changes: 8 additions & 1 deletion src/app/fyle/my-expenses/my-expenses.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,14 @@
</ng-container>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please share before and after screenshots.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

</app-fy-header>

<ion-content [ngClass]="{'d-none': isCameraPreviewStarted}" class="my-expenses--content" (click)="onPageClick()">
<ion-content
[ngClass]="{
'd-none': isCameraPreviewStarted,
'my-expenses--content-zero-state': ((pendingTransactions.length === 0) && ((count$ | async) === 0) && isConnected$ | async)
}"
class="my-expenses--content"
(click)="onPageClick()"
>
Comment on lines +94 to +101
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Listen here, partner! Let's make this template as powerful as a punch dialogue! 🌟

The template condition is getting more complex than my signature sunglasses collection! We should handle this logic in the component.

Here's a style that would make even the bad guys jealous:

-[ngClass]="{
-  'd-none': isCameraPreviewStarted,
-  'my-expenses--content-zero-state': ((pendingTransactions.length === 0) && ((count$ | async) === 0) && isConnected$ | async)
-}"
+[ngClass]="{
+  'd-none': isCameraPreviewStarted,
+  'my-expenses--content-zero-state': shouldShowZeroState$ | async
+}"

And in your component:

shouldShowZeroState$ = combineLatest([
  this.count$,
  this.isConnected$
]).pipe(
  map(([count, isConnected]) => 
    this.pendingTransactions.length === 0 && count === 0 && isConnected
  )
);

<div
class="my-expenses--body"
[ngClass]="{'my-expenses--zero-states-body': (((count$ | async) === 0) && isConnected$|async) || (pendingTransactions.length === 0 && !(isConnected$|async))}"
Expand Down
5 changes: 5 additions & 0 deletions src/app/fyle/my-expenses/my-expenses.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
--padding-bottom: 82px;
}

&--content-zero-state {
--padding-bottom: 0;
}

&--select-all-container {
--border-style: none;
}
Expand Down Expand Up @@ -280,6 +284,7 @@

&--zero-states-body {
height: 100%;
padding-top: 32px;
}

&--footer-toolbar {
Expand Down
Loading