Skip to content
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

[ACS-5288]Changes to improve user experience by changing navigation #3219

Merged
merged 3 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion projects/aca-content/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ng-container *ngIf="item.children && item.children.length">
<mat-expansion-panel
[expanded]="acaExpansionPanel.hasActiveLinks()"
[expanded]="true"
[acaExpansionPanel]="item"
#acaExpansionPanel="acaExpansionPanel"
[@.disabled]="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<button mat-button class="aca-user-menu-button" [matMenuTriggerFor]="menu">
<button mat-button class="aca-user-menu-button" [matMenuTriggerFor]="menu"
title="{{'APP.TOOLTIPS.OPTIONS_SETTINGS' | translate}}">
DenysVuika marked this conversation as resolved.
Show resolved Hide resolved
<div>{{ (displayName$ | async)?.initials }}</div>
</button>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<div class="app-profile-container">
<div class="app-profile-row">
<div class="app-profile-title">
<button *ngIf="(appNavNarMode$ | async) === 'collapsed'" mat-icon-button (click)="toggleClick()"
title="{{'APP.TOOLTIPS.EXPAND_NAVIGATION' | translate}}">
<mat-icon>menu</mat-icon>
</button>
<mat-icon class="app-profile-icon" (click)="navigateToPersonalFiles()" id="backButton">arrow_back</mat-icon>
<h3 class="app-profile">{{'APP.EDIT_PROFILE.MY_PROFILE' | translate}}</h3>
</div>
<mat-divider class="app-mat-divider"></mat-divider>
</div>
<div class="app-profile-general-row" [formGroup]="profileForm">
<div class="app-profile-general">
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -31,7 +36,6 @@ app-view-profile {

.app-profile-icon {
margin-right: 1rem;
margin-top: 1rem;
cursor: pointer;
}

Expand All @@ -40,7 +44,7 @@ app-view-profile {
}

.app-profile-text {
letter-spacing: .5px;
letter-spacing: 0.5px;
}

.app-profile-general {
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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);
}

Expand All @@ -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);
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -183,6 +187,6 @@ app-view-profile {

.app-error-message {
padding-top: 2rem;
padding-left: .5rem;
padding-left: 0.5rem;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<ViewProfileComponent>;
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);
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@

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 { 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',
templateUrl: './view-profile.component.html',
styleUrls: ['./view-profile.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class ViewProfileComponent implements OnInit {
export class ViewProfileComponent implements OnInit, OnDestroy {
peopleApi: PeopleApi;

profileForm: FormGroup;
Expand All @@ -50,9 +52,12 @@ export class ViewProfileComponent implements OnInit {

contactSectionDropdown = false;
contactSectionButtonsToggle = true;
appNavNarMode$: Observable<'collapsed' | 'expanded'>;
private onDestroy$ = new Subject<boolean>();

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() {
Expand All @@ -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 || ''),
Expand Down Expand Up @@ -188,4 +197,9 @@ export class ViewProfileComponent implements OnInit {
isSaveButtonDisabled(): boolean {
return this.profileForm.invalid;
}

ngOnDestroy() {
this.onDestroy$.next(true);
this.onDestroy$.complete();
}
}
2 changes: 1 addition & 1 deletion projects/aca-shared/src/lib/services/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class AppService implements OnDestroy {
toggleAppNavBar$ = new Subject();

hideSidenavConditions = ['/preview/'];
minimizeSidenavConditions = ['search', 'about', 'profile'];
minimizeSidenavConditions = ['search'];

onDestroy$ = new Subject<boolean>();

Expand Down