refactor(home): Adopt Angular Signals for reactive state management a… - #804
Conversation
Bug fix - 4408
Bug Fix Id :- 4411
Bug fix :- 4425
…nd template bindings.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| <div slot="start" class="img-mainDiv"> | ||
| @if (user()?.image) { | ||
| <div class="image-div"> | ||
| <img class="profile-image" src="{{user()?.image}}" /> |
There was a problem hiding this comment.
do property binding
There was a problem hiding this comment.
[src]="user()?.image"
| fullscreen | ||
| [ngClass]="{'disable-div': user?.profile_mandatory_fields.length || !user?.about}" | ||
| > | ||
| @if (user()) { |
| <ion-label class="username"><strong>{{user()?.name}}</strong></ion-label> | ||
| <div class="user-role-labels"> | ||
| @if (userRoles()) { | ||
| <ion-label>{{ isMentor() ? ('MENTOR' | translate): ('MENTEE' | translate)}} |
There was a problem hiding this comment.
However you are using signals, so here you can use computed signal like : in TS - roleLabel = computed(() =>
this.isMentor() ? 'MENTOR' : 'MENTEE'
); in HTML - {{ roleLabel() | translate }}
| user; | ||
| user = signal<any>(null); | ||
| PAGE_IDS = PAGE_IDS; | ||
| public appPages = [ |
There was a problem hiding this comment.
Move all these pages into a constant file, and fetch from there.
| @@ -32,13 +33,13 @@ import { | |||
There was a problem hiding this comment.
This component handling so many things, we are initializing everything in this component only so create a seperate service to initialize FrontendChatLibraryService,
RocketChatApiService, theme,initializeLanguage , load user , PermissionService and other things
| const response = await this.profile.getRequestCount(); | ||
| const { result = {} } = response || {}; | ||
| const { sessionRequestCount = 0, connectionRequestCount = 0 } = result || {}; | ||
| if (sessionRequestCount > 0 || connectionRequestCount > 0) { |
There was a problem hiding this comment.
this logic also you can move to the new service
| } catch (error) { | ||
| console.error("Error parsing theme from localStorage:", error); | ||
| getUser() { | ||
| let theme: any = localStorage.getItem('theme'); |
There was a problem hiding this comment.
Handle this as separate method
…als and introduce a new private module.
…p into release-3.4.0-21
01565fc
into
ELEVATE-Project:release-3.4.0_ng20
…nd template bindings.