diff --git a/src/app/features/home/components/presentationals/home-browsing-org-unit/home-browsing-org-unit.presentational.ts b/src/app/features/home/components/presentationals/home-browsing-org-unit/home-browsing-org-unit.presentational.ts index b5b2ceb005776241d55654b77654a4ce4a716141..602688c01c619ef21ec00a02ec64c3416332b348 100644 --- a/src/app/features/home/components/presentationals/home-browsing-org-unit/home-browsing-org-unit.presentational.ts +++ b/src/app/features/home/components/presentationals/home-browsing-org-unit/home-browsing-org-unit.presentational.ts @@ -2,7 +2,8 @@ import { ChangeDetectionStrategy, Component, Input, - Output, ViewChild, + Output, + ViewChild, } from "@angular/core"; import {AccessOrganizationalUnit} from "@app/generated-api"; import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational"; @@ -12,8 +13,11 @@ import { Observable, } from "rxjs"; import { - isUndefined, ObjectUtil, - ObservableUtil, Paging, QueryParameters, + isUndefined, + ObjectUtil, + ObservableUtil, + Paging, + QueryParameters, } from "solidify-frontend"; @Component({ @@ -26,6 +30,9 @@ export class HomeBrowsingOrgUnitPresentational extends SharedAbstractPresentatio @Input() listOrgUnit: AccessOrganizationalUnit[]; + @Input() + orgUnitIdSelected: string; + @Input() isLoading: boolean; @@ -60,10 +67,10 @@ export class HomeBrowsingOrgUnitPresentational extends SharedAbstractPresentatio } isSelected(orgUnit: AccessOrganizationalUnit): boolean { - if (isUndefined(this._navigateBS.value)) { + if (isUndefined(this.orgUnitIdSelected)) { return false; } - return orgUnit.resId === this._navigateBS.value.resId; + return orgUnit.resId === this.orgUnitIdSelected; } pageChange($event: Paging): void { diff --git a/src/app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable.scss b/src/app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable.scss index 7f09d23db01ff531d92c66900689f7d40badc84e..b476062d28c0dc5afda4a68482b1acf8bf776704 100644 --- a/src/app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable.scss +++ b/src/app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable.scss @@ -6,7 +6,6 @@ display: flex; flex-direction: column; padding: 20px; - flex-basis: 50%; overflow-y: auto; .close-button { @@ -22,16 +21,7 @@ width: 100%; } - @include respond-to-smaller-than-breakpoint('lg') { - flex-basis: 40%; - } - @include respond-to-smaller-than-breakpoint('md') { - flex-basis: 30%; - } - - @include respond-to-smaller-than-breakpoint('sm') { - flex-basis: 100%; padding-top: 50px; .close-button { diff --git a/src/app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable.ts b/src/app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable.ts index f677c925c6455eed810b77cc63b5fcb86367f266..6503efbb2430cf223ff98f2a83f8b15b8e80f822 100644 --- a/src/app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable.ts +++ b/src/app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable.ts @@ -38,8 +38,6 @@ export class HomeBrowsingListArchivesRoutable extends SharedAbstractRoutable imp @HostBinding("class.have-no-items") haveNoItems: boolean = false; - // @HostBinding("class.is-open") isOpen: boolean = false; - constructor(private _route: ActivatedRoute, private _store: Store, private _cd: ChangeDetectorRef) { diff --git a/src/app/features/home/components/routables/home-browsing/home-browsing.routable.html b/src/app/features/home/components/routables/home-browsing/home-browsing.routable.html index 33c7af47a577792cdf74672dc5efe057b8ca9b05..8efc99f0eb5b941248fe8c6d35e96ca30ffbf5e9 100644 --- a/src/app/features/home/components/routables/home-browsing/home-browsing.routable.html +++ b/src/app/features/home/components/routables/home-browsing/home-browsing.routable.html @@ -1,4 +1,5 @@ <dlcm-home-browsing-org-unit-presentational class="list-org-units" + [orgUnitIdSelected]="orgUnitId" [listOrgUnit]="listOrgUnitObs | async" [isLoading]="isLoadingOrgUnitObs | async" [queryParameters]="queryParametersObs | async" @@ -8,4 +9,13 @@ > </dlcm-home-browsing-org-unit-presentational> -<router-outlet></router-outlet> +<div class="content"> + <router-outlet></router-outlet> + + <div *ngIf="!isOrgUnitSelected" + class="no-org-unit-message" + > + <fa-icon icon="building"></fa-icon> + {{'homePage.browsing.archive.noOrgUnitSelected' | translate}} + </div> +</div> diff --git a/src/app/features/home/components/routables/home-browsing/home-browsing.routable.scss b/src/app/features/home/components/routables/home-browsing/home-browsing.routable.scss index 1ff08651423669caf647247d103d7fee21a96e14..7b8e5d0c36e141ba40798d626ae42ac52f2078a3 100644 --- a/src/app/features/home/components/routables/home-browsing/home-browsing.routable.scss +++ b/src/app/features/home/components/routables/home-browsing/home-browsing.routable.scss @@ -5,5 +5,46 @@ :host { display: flex; flex: 1; - width: 100%; + + .content { + display: flex; + justify-content: center; + width: 75%; + + @include respond-to-smaller-than-breakpoint('lg') { + width: 65%; + } + + @include respond-to-smaller-than-breakpoint('md') { + display: none; + } + } + + .no-org-unit-message { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + + fa-icon { + font-size: 40px; + color: $light-grey; + padding-bottom: 20px; + } + } +} + +:host(.is-org-unit-selected) { + .list-org-units { + @include respond-to-smaller-than-breakpoint('md') { + display: none; + } + } + + .content { + display: inherit; + @include respond-to-smaller-than-breakpoint('md') { + width: 100%; + } + } } diff --git a/src/app/features/home/components/routables/home-browsing/home-browsing.routable.ts b/src/app/features/home/components/routables/home-browsing/home-browsing.routable.ts index 515c861c8d2e9357a0d791ad9847cc3c8c4ff076..75a3d081c19e45adaa3fbc407060e336c962a66f 100644 --- a/src/app/features/home/components/routables/home-browsing/home-browsing.routable.ts +++ b/src/app/features/home/components/routables/home-browsing/home-browsing.routable.ts @@ -1,15 +1,16 @@ import { ChangeDetectionStrategy, + ChangeDetectorRef, Component, + HostBinding, OnInit, ViewChild, } from "@angular/core"; -import {Router} from "@angular/router"; +import {ActivatedRoute} from "@angular/router"; import {HomeBrowsingListArchivesRoutable} from "@app/features/home/components/routables/home-browsing-list-archives/home-browsing-list-archives.routable"; import {HomeOrgUnitAction} from "@app/features/home/stores/organizational-unit/home-organizational-unit.action"; import {AccessOrganizationalUnit} from "@app/generated-api"; import {SharedAbstractRoutable} from "@app/shared/components/routables/shared-abstract/shared-abstract.routable"; -import {RouterOutletEnum} from "@app/shared/enums/router-outlet.enum"; import {LocalStateModel} from "@app/shared/models/local-state.model"; import {Navigate} from "@ngxs/router-plugin"; import { @@ -18,9 +19,14 @@ import { } from "@ngxs/store"; import {RoutesEnum} from "@shared/enums/routes.enum"; import {Observable} from "rxjs"; -import {take, tap} from "rxjs/operators"; import { - isEmptyString, ObjectUtil, + take, + tap, +} from "rxjs/operators"; +import { + isEmptyString, + isNullOrUndefined, + ObjectUtil, QueryParameters, StoreUtil, } from "solidify-frontend"; @@ -39,22 +45,46 @@ export class HomeBrowsingRoutable extends SharedAbstractRoutable implements OnIn @ViewChild(HomeBrowsingListArchivesRoutable, {static: false}) archivesRoutable: HomeBrowsingListArchivesRoutable; - get routerOutletEnum(): typeof RouterOutletEnum { - return RouterOutletEnum; + @HostBinding("class.is-org-unit-selected") isOrgUnitSelected: boolean; + + private _orgUnitId: string = undefined; + + set orgUnitId(value: string) { + this._orgUnitId = value; + if (isNullOrUndefined(value)) { + this.isOrgUnitSelected = false; + } else { + this.isOrgUnitSelected = true; + } + this._changeDetector.detectChanges(); + } + + get orgUnitId(): string { + return this._orgUnitId; } - constructor(private _router: Router, - private store: Store) { - // http://localhost:16118/dlcm/access/organizational-units/bca58e86-7bea-471c-b03d-f425574d8971/archives + constructor(private _route: ActivatedRoute, + private _store: Store, + private _changeDetector: ChangeDetectorRef) { super(); } ngOnInit(): void { - this.store.dispatch(new HomeOrgUnitAction.GetAll()); + this._store.dispatch(new HomeOrgUnitAction.GetAll()); + + this.subscribe(this._route.url.pipe( + tap(param => { + if (this._route.snapshot.children.length > 0) { + this.orgUnitId = this._route.snapshot.children[0].url[0].path; + } else { + this.orgUnitId = undefined; + } + }), + )); } navigate($event: AccessOrganizationalUnit): void { - this.store.dispatch(new Navigate([RoutesEnum.homePageBrowsing, $event.resId])); + this._store.dispatch(new Navigate([RoutesEnum.homePageBrowsing, $event.resId])); } search(search: string): void { @@ -67,12 +97,12 @@ export class HomeBrowsingRoutable extends SharedAbstractRoutable implements OnIn map.set("name", search); } queryParameters.search = {searchItems: map}; - this.store.dispatch(new HomeOrgUnitAction.GetAll(queryParameters)); - }) + this._store.dispatch(new HomeOrgUnitAction.GetAll(queryParameters)); + }), )); } pagination($event: QueryParameters): void { - this.store.dispatch(new HomeOrgUnitAction.ChangeQueryParameters($event)); + this._store.dispatch(new HomeOrgUnitAction.ChangeQueryParameters($event)); } } diff --git a/src/app/shared/enums/router-outlet.enum.ts b/src/app/shared/enums/router-outlet.enum.ts index 1ee581f0552364d4ca1e7a5b4e520df34bacc75c..2d95d15c5b5483824faa21b9f412e722e88fecd1 100644 --- a/src/app/shared/enums/router-outlet.enum.ts +++ b/src/app/shared/enums/router-outlet.enum.ts @@ -1,3 +1,2 @@ export enum RouterOutletEnum { - archiveBrowsing = "archiveBrowsing", }