-
Notifications
You must be signed in to change notification settings - Fork 0
#EX-193: Change categories summary component button logic #25
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
base: develop
Are you sure you want to change the base?
Conversation
| this.dialog.open<CreateTransactionDialogComponent, CreateTransactionDialogData, Transaction>( | ||
| CreateTransactionDialogComponent, undefined | ||
| ).afterClosed().subscribe( | ||
| async (newTransaction?: Transaction) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fölösleges az async, nincs benne semmi asynchronous művelet.
| return this.categories().length > 0; | ||
| } | ||
|
|
||
| hasTransactions(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legyenek inkább getterek.
| <span class="">{{ category.emoji }}</span> | ||
| {{ category.name }} | ||
| </div> | ||
| @if (hasCategories()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mivel nem lehet transaction category nelkül, így ez a feltétel felesleges és csak az else ágat duplikálja. így ezt vegyük ki és alul pedig vonjuk össze egy else ágba a kettőt, akár ternary akár logikai operatorral.
| return Math.floor((amount / this.totalExpense()) * 100); | ||
| } | ||
|
|
||
| get hasCategories(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Az Exenceben mi követünk egy kód sorrendet ts fileok esetén amire van is eslint config, ami ahogy látom neked most nem nagyon akar működni.
fieldek (erre nincs külön, de itt is próbáljuk tartani a private readonly -> private -> readonly/public sorrendet tartani)
getterek, setterek
constructor
public methodok
private methodok
Próbáld meg, hogy Ctrl + Shift + P és Restart ESLint Server ezzel jónak kellene lennie.
- meggondoltam magam legyenek inkább computed valuek, jobbak mint a getterek mert nem számtjuk ki őket minden rerendernél, hanem cachelve vannak és csak akkor számítódnaki ki újra, ha az a dolog változik amit benne használunk (mondjuk itt a categories InputSignal)
| } | ||
|
|
||
| get hasTransactions(): boolean { | ||
| return this.categorySummaries().length > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nekem ez is megfelel, rád van bízva megváltoztatod-e de én a legtöbb helyen így csinálom:
| return this.categorySummaries().length > 0; | |
| return !!this.categorySummaries().length; |
| class="h-100" | ||
| [totalExpense]="totals.totalExpense" | ||
| [categories]="topCategories!" | ||
| [categorySummaries]="topCategories!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legyen konzisztensen topCategories.
No description provided.