-
Notifications
You must be signed in to change notification settings - Fork 3
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
Smyk / 2583 The button '+Додати ще дитину' should be disabled if the parent already has 20 children #2585
base: develop
Are you sure you want to change the base?
Conversation
…ildren. Added information button with pop-up message when the parent already has 20 children.
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.
I think we can make a property that will show that the child limit is reached and reuse it inside the template instead of checking the number of children 5 times
@@ -99,6 +100,7 @@ export class CreateApplicationComponent implements OnInit, OnDestroy { | |||
this.children$.pipe(filter(Boolean), takeUntil(this.destroy$)).subscribe((children: SearchResponse<Child[]>) => { | |||
this.parentCard = children.entities.find((child: Child) => child.isParent); | |||
this.children = children.entities.filter((child: Child) => !child.isParent); | |||
this.has20Children = this.children.length >= 20; |
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.
A magic number in the property name is not the best option.
It is better to name it something like isChildLimitReached
and create a constant MAX_CHILD or similar
…dBeDisabledIfTheParentAlreadyHas20Children
…omparing to 20 with CHILDREN_AMOUNT_MAX constant
|
#2583
Disabled 'Add another child' button when the parent already has 20 children.
Added information button with pop-up message when the parent already has 20 children.