-
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
Open
tamibalogh
wants to merge
2
commits into
develop
Choose a base branch
from
EX-193-change-categories-summary-button-logic
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| import { Component, inject, input } from '@angular/core'; | ||||||
| import { Component, inject, input, output } from '@angular/core'; | ||||||
| import { MatCardModule } from '@angular/material/card'; | ||||||
| import { MatDialog } from '@angular/material/dialog'; | ||||||
| import { MatProgressBarModule } from '@angular/material/progress-bar'; | ||||||
|
|
@@ -9,6 +9,8 @@ import { ButtonComponent } from '../../../shared/button/button.component'; | |||||
| import { DisplaySizeService } from '../../../shared/display-size.service'; | ||||||
| import { SnackbarService } from '../../../shared/snackbar/snackbar.service'; | ||||||
| import { CreateCategoryDialogComponent } from '../../transactions-and-categories/create-category-dialog/create-category-dialog.component'; | ||||||
| import { CreateTransactionDialogComponent, CreateTransactionDialogData } from '../../transactions-and-categories/create-transaction-dialog/create-transaction-dialog.component'; | ||||||
| import { Transaction } from 'src/app/data-model/modules/transaction/Transaction'; | ||||||
|
|
||||||
| // TODO move to interval filter component when created | ||||||
| export enum DateInterval { | ||||||
|
|
@@ -34,19 +36,44 @@ export class CategoriesComponent extends BaseComponent { | |||||
| private readonly dialog = inject(MatDialog); | ||||||
|
|
||||||
| totalExpense = input.required<number>(); | ||||||
| categories = input.required<CategorySummaryResponse[]>(); | ||||||
| categorySummaries = input.required<CategorySummaryResponse[]>(); | ||||||
| categories = input.required<Category[]>(); | ||||||
|
|
||||||
| openCreateCategoryDialog(): void { | ||||||
| dataChangedEvent = output<void>(); | ||||||
|
|
||||||
| public openCreateCategoryDialog(): void { | ||||||
| this.dialog.open<CreateCategoryDialogComponent, undefined, Category>( | ||||||
| CreateCategoryDialogComponent, undefined | ||||||
| ).afterClosed().subscribe((newCategory) => { | ||||||
| ).afterClosed().subscribe((newCategory?: Category) => { | ||||||
| if (newCategory) { | ||||||
| this.snackbarService.showSuccess(`Category '${newCategory.emoji}' created successfully!`); | ||||||
| this.dataChangedEvent.emit(); | ||||||
| } | ||||||
| }); | ||||||
| } | ||||||
|
|
||||||
| public openCreateTransactionDialog(): void { | ||||||
| this.dialog.open<CreateTransactionDialogComponent, CreateTransactionDialogData, Transaction>( | ||||||
| CreateTransactionDialogComponent, undefined | ||||||
| ).afterClosed().subscribe( | ||||||
| (newTransaction?: Transaction) => { | ||||||
| if (newTransaction) { | ||||||
| this.snackbarService.showSuccess(`Transaction '${newTransaction.title.slice(0, 10)}${newTransaction.title.length > 10 ? '...' : ''}' created successfully!`); | ||||||
| this.dataChangedEvent.emit(); | ||||||
| } | ||||||
| } | ||||||
| ); | ||||||
| } | ||||||
|
|
||||||
| calcPercentage(amount: number): number { | ||||||
| return Math.floor((amount / this.totalExpense()) * 100); | ||||||
| } | ||||||
|
|
||||||
| get hasCategories(): boolean { | ||||||
| return this.categories().length > 0; | ||||||
| } | ||||||
|
|
||||||
| get hasTransactions(): boolean { | ||||||
| return this.categorySummaries().length > 0; | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
Suggested change
|
||||||
| } | ||||||
| } | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,9 @@ | |
| <ex-categories | ||
| class="h-100" | ||
| [totalExpense]="totals.totalExpense" | ||
| [categories]="topCategories!" | ||
| [categorySummaries]="topCategories!" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Legyen konzisztensen |
||
| [categories]="categories" | ||
| (dataChangedEvent)="onDataChanged()" | ||
| /> | ||
| </div> | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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ésRestart ESLint Serverezzel jónak kellene lennie.