From 7739d68db7b5ba26e737d37a58f37d68728888e5 Mon Sep 17 00:00:00 2001 From: Yasa-Nataliya Date: Mon, 22 May 2023 14:12:12 +0000 Subject: [PATCH 1/3] Implemented changes as per requirement --- projects/aca-content/assets/i18n/en.json | 2 +- .../components/sidenav/components/expand-menu.component.html | 2 +- .../lib/components/sidenav/user-menu/user-menu.component.html | 3 ++- projects/aca-shared/src/lib/services/app.service.ts | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/aca-content/assets/i18n/en.json b/projects/aca-content/assets/i18n/en.json index 074c8b0709..caac8bf515 100644 --- a/projects/aca-content/assets/i18n/en.json +++ b/projects/aca-content/assets/i18n/en.json @@ -432,7 +432,7 @@ "COLLAPSE_NAVIGATION": "Collapse navigation menu", "OPTIONS_SETTINGS": "Options and settings", "MY_PROFILE": "My profile", - "EXPAND_NAVIGATION": "Expand navigation" + "EXPAND_NAVIGATION": "Expand navigation menu" } }, "NODE_SELECTOR": { diff --git a/projects/aca-content/src/lib/components/sidenav/components/expand-menu.component.html b/projects/aca-content/src/lib/components/sidenav/components/expand-menu.component.html index c7ad1830c2..2c79dfbfcc 100644 --- a/projects/aca-content/src/lib/components/sidenav/components/expand-menu.component.html +++ b/projects/aca-content/src/lib/components/sidenav/components/expand-menu.component.html @@ -18,7 +18,7 @@ + diff --git a/projects/aca-shared/src/lib/services/app.service.ts b/projects/aca-shared/src/lib/services/app.service.ts index ff0b80b68e..51b62df2dd 100644 --- a/projects/aca-shared/src/lib/services/app.service.ts +++ b/projects/aca-shared/src/lib/services/app.service.ts @@ -63,7 +63,7 @@ export class AppService implements OnDestroy { toggleAppNavBar$ = new Subject(); hideSidenavConditions = ['/preview/']; - minimizeSidenavConditions = ['search', 'about', 'profile']; + minimizeSidenavConditions = ['search']; onDestroy$ = new Subject(); From c6798a543fde647c90772292df80fb745f91078e Mon Sep 17 00:00:00 2001 From: Yasa-Nataliya Date: Mon, 22 May 2023 15:14:57 +0000 Subject: [PATCH 2/3] changes for view profile component --- .../view-profile/view-profile.component.html | 5 ++- .../view-profile/view-profile.component.scss | 42 ++++++++++--------- .../view-profile/view-profile.component.ts | 13 +++++- 3 files changed, 38 insertions(+), 22 deletions(-) diff --git a/projects/aca-content/src/lib/components/view-profile/view-profile.component.html b/projects/aca-content/src/lib/components/view-profile/view-profile.component.html index b30ed76b2b..4172a838b1 100644 --- a/projects/aca-content/src/lib/components/view-profile/view-profile.component.html +++ b/projects/aca-content/src/lib/components/view-profile/view-profile.component.html @@ -1,10 +1,13 @@
+ arrow_back

{{'APP.EDIT_PROFILE.MY_PROFILE' | translate}}

-
diff --git a/projects/aca-content/src/lib/components/view-profile/view-profile.component.scss b/projects/aca-content/src/lib/components/view-profile/view-profile.component.scss index 2d62438fb3..c6670ff68c 100644 --- a/projects/aca-content/src/lib/components/view-profile/view-profile.component.scss +++ b/projects/aca-content/src/lib/components/view-profile/view-profile.component.scss @@ -1,25 +1,30 @@ app-view-profile { - letter-spacing: .5px; + letter-spacing: 0.5px; .app-profile-container { - margin-top: 1rem; overflow: scroll; - height:100%; + height: 100%; width: 100%; } .app-profile-row { width: 100%; - margin: 2rem 0 0; + height: 32px; + padding: 32px 0; + border-bottom: 1px solid var(--theme-header-border-color); } .app-profile-title { display: flex; - margin-left: 2rem; + flex-direction: row; + align-items: center; + height: 32px; + padding: 0 24px; } .app-profile { cursor: pointer; + margin-top: 1rem; } .app-profile-general-row { @@ -31,7 +36,6 @@ app-view-profile { .app-profile-icon { margin-right: 1rem; - margin-top: 1rem; cursor: pointer; } @@ -40,7 +44,7 @@ app-view-profile { } .app-profile-text { - letter-spacing: .5px; + letter-spacing: 0.5px; } .app-profile-general { @@ -49,7 +53,7 @@ app-view-profile { } .app-profile-general-bottom-radius { - border-bottom-left-radius:0; + border-bottom-left-radius: 0; border-bottom-right-radius: 0; } @@ -63,11 +67,11 @@ app-view-profile { .app-general-title { margin-left: 0.6rem; margin-top: 4px; - letter-spacing: .5px; + letter-spacing: 0.5px; } .app-general-edit-btn { - width:60%; + width: 60%; text-align: end; } @@ -81,7 +85,7 @@ app-view-profile { .app-selected:focus { border: 2px solid var(--theme-blue-button-color) !important; border-radius: 6px; - outline : none !important; + outline: none !important; box-shadow: 0 0 2px (--theme-blue-button-color); } @@ -98,16 +102,16 @@ app-view-profile { .app-general-cancel-btn { height: 30px; margin: 1rem; - margin-left: .5rem; + margin-left: 0.5rem; background-color: var(--theme-grey-text-background-color); - padding-top: .25px; + padding-top: 0.25px; } .app-general-save-btn { width: 75px; height: 30px; margin: 1rem; - margin-left: .5rem; + margin-left: 0.5rem; color: white; background-color: var(--theme-blue-button-color); } @@ -128,12 +132,12 @@ app-view-profile { color: var(--theme-heading-color); width: 20%; font-weight: 400; - letter-spacing: .5px; + letter-spacing: 0.5px; } .app-profile-general-dropdown-details { margin-top: 1.3rem; - letter-spacing: .5px; + letter-spacing: 0.5px; } .app-profile-general-dropdown-input-details { @@ -161,7 +165,7 @@ app-view-profile { height: 25px; border: none; margin-top: 1.3rem; - background-color: var(--theme-dropdown-color) ; + background-color: var(--theme-dropdown-color); } .app-profile-login-dropdown-heading-forgot { @@ -183,6 +187,6 @@ app-view-profile { .app-error-message { padding-top: 2rem; - padding-left: .5rem; + padding-left: 0.5rem; } -} \ No newline at end of file +} diff --git a/projects/aca-content/src/lib/components/view-profile/view-profile.component.ts b/projects/aca-content/src/lib/components/view-profile/view-profile.component.ts index a5611755b0..d6808baa97 100644 --- a/projects/aca-content/src/lib/components/view-profile/view-profile.component.ts +++ b/projects/aca-content/src/lib/components/view-profile/view-profile.component.ts @@ -27,7 +27,9 @@ import { PeopleApi, Person } from '@alfresco/js-api'; import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; -import { throwError } from 'rxjs'; +import { Observable, Subject, throwError } from 'rxjs'; +import { AppService } from '@alfresco/aca-shared'; +import { takeUntil } from 'rxjs/operators'; @Component({ selector: 'app-view-profile', @@ -50,9 +52,12 @@ export class ViewProfileComponent implements OnInit { contactSectionDropdown = false; contactSectionButtonsToggle = true; + appNavNarMode$: Observable<'collapsed' | 'expanded'>; + private onDestroy$ = new Subject(); - constructor(private router: Router, apiService: AlfrescoApiService) { + constructor(private router: Router, apiService: AlfrescoApiService, private appService: AppService) { this.peopleApi = new PeopleApi(apiService.getInstance()); + this.appNavNarMode$ = appService.appNavNarMode$.pipe(takeUntil(this.onDestroy$)); } ngOnInit() { @@ -68,6 +73,10 @@ export class ViewProfileComponent implements OnInit { }); } + toggleClick() { + this.appService.toggleAppNavBar$.next(); + } + populateForm(userInfo: Person) { this.profileForm = new FormGroup({ jobTitle: new FormControl(userInfo?.jobTitle || ''), From f2d12a61af59347e0710509ad5c965fb8ec4e56d Mon Sep 17 00:00:00 2001 From: Yasa-Nataliya Date: Mon, 22 May 2023 15:51:40 +0000 Subject: [PATCH 3/3] added unit test cases --- .../view-profile.component.spec.ts | 20 ++++++++++++++++++- .../view-profile/view-profile.component.ts | 9 +++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/projects/aca-content/src/lib/components/view-profile/view-profile.component.spec.ts b/projects/aca-content/src/lib/components/view-profile/view-profile.component.spec.ts index 719f5bae08..2e7cd95ed2 100644 --- a/projects/aca-content/src/lib/components/view-profile/view-profile.component.spec.ts +++ b/projects/aca-content/src/lib/components/view-profile/view-profile.component.spec.ts @@ -30,16 +30,28 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { By } from '@angular/platform-browser'; import { Router } from '@angular/router'; import { MatDividerModule } from '@angular/material/divider'; +import { BehaviorSubject, Subject } from 'rxjs'; +import { AppService } from '@alfresco/aca-shared'; describe('ViewProfileComponent', () => { let fixture: ComponentFixture; let component: ViewProfileComponent; let router: Router; + const appServiceMock = { + toggleAppNavBar$: new Subject(), + appNavNarMode$: new BehaviorSubject<'collapsed' | 'expanded'>('expanded') + }; beforeEach(() => { TestBed.configureTestingModule({ imports: [AppTestingModule, AppConfigModule, FormsModule, ReactiveFormsModule, MatDividerModule], - declarations: [ViewProfileComponent] + declarations: [ViewProfileComponent], + providers: [ + { + provide: AppService, + useValue: appServiceMock + } + ] }); fixture = TestBed.createComponent(ViewProfileComponent); @@ -53,6 +65,12 @@ describe('ViewProfileComponent', () => { expect(component.contactSectionDropdown).toBe(false); }); + it('should toggle the appService toggleAppNavBar$ Subject', () => { + spyOn(appServiceMock.toggleAppNavBar$, 'next'); + component.toggleClick(); + expect(appServiceMock.toggleAppNavBar$.next).toHaveBeenCalled(); + }); + it('should save button is disabled if form has invalid mobile number', () => { component.ngOnInit(); const profileFormGroup = component.profileForm; diff --git a/projects/aca-content/src/lib/components/view-profile/view-profile.component.ts b/projects/aca-content/src/lib/components/view-profile/view-profile.component.ts index d6808baa97..39305256bd 100644 --- a/projects/aca-content/src/lib/components/view-profile/view-profile.component.ts +++ b/projects/aca-content/src/lib/components/view-profile/view-profile.component.ts @@ -24,7 +24,7 @@ import { AlfrescoApiService } from '@alfresco/adf-core'; import { PeopleApi, Person } from '@alfresco/js-api'; -import { Component, OnInit, ViewEncapsulation } from '@angular/core'; +import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { Observable, Subject, throwError } from 'rxjs'; @@ -37,7 +37,7 @@ import { takeUntil } from 'rxjs/operators'; styleUrls: ['./view-profile.component.scss'], encapsulation: ViewEncapsulation.None }) -export class ViewProfileComponent implements OnInit { +export class ViewProfileComponent implements OnInit, OnDestroy { peopleApi: PeopleApi; profileForm: FormGroup; @@ -197,4 +197,9 @@ export class ViewProfileComponent implements OnInit { isSaveButtonDisabled(): boolean { return this.profileForm.invalid; } + + ngOnDestroy() { + this.onDestroy$.next(true); + this.onDestroy$.complete(); + } }