-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Communication: Improve unread messages count view on sidebar (#9522)
(cherry picked from commit 6e64f08)
- Loading branch information
1 parent
459b606
commit 0599b70
Showing
7 changed files
with
76 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 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
24 changes: 22 additions & 2 deletions
24
src/main/webapp/app/shared/sidebar/sidebar-card-item/sidebar-card-item.component.ts
This file contains 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,13 +1,33 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { Component, Input, OnChanges, OnInit, SimpleChanges, input } from '@angular/core'; | ||
import { SidebarCardElement, SidebarTypes } from 'app/types/sidebar'; | ||
|
||
@Component({ | ||
selector: 'jhi-sidebar-card-item', | ||
templateUrl: './sidebar-card-item.component.html', | ||
styleUrls: ['./sidebar-card-item.component.scss', '../sidebar.component.scss'], | ||
}) | ||
export class SidebarCardItemComponent { | ||
export class SidebarCardItemComponent implements OnInit, OnChanges { | ||
@Input() sidebarItem: SidebarCardElement; | ||
@Input() sidebarType?: SidebarTypes; | ||
@Input() groupKey?: string; | ||
unreadCount = input<number>(0); | ||
|
||
formattedUnreadCount: string = ''; | ||
|
||
ngOnInit(): void { | ||
this.formattedUnreadCount = this.getFormattedUnreadCount(); | ||
} | ||
|
||
ngOnChanges(changes: SimpleChanges): void { | ||
if (changes['unreadCount']) { | ||
this.formattedUnreadCount = this.getFormattedUnreadCount(); | ||
} | ||
} | ||
|
||
private getFormattedUnreadCount(): string { | ||
if (this.unreadCount() > 99) { | ||
return '99+'; | ||
} | ||
return this.unreadCount().toString() || ''; | ||
} | ||
} |
This file contains 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 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 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