File
Implements
Constructor
constructor(router: Router, layoutService: LayoutService)
|
|
Parameters :
Name |
Type |
Optional |
router |
Router
|
No
|
layoutService |
LayoutService
|
No
|
|
Methods
ngOnDestroy
|
ngOnDestroy()
|
|
|
FIRST_TO_PANEL_LAYOUT
|
Type : string
|
|
layoutConfiguration
|
Type : any
|
|
Public
router
|
Type : Router
|
|
SECOND_TO_PANEL_LAYOUT
|
Type : string
|
|
Public
unsubscribe$
|
Default value : new Subject<void>()
|
|
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Router } from '@angular/router';
import { LayoutService, COLUMN_TYPE } from '@sunbird/shared';
import { takeUntil } from 'rxjs/operators';
import { Subject } from 'rxjs';
@Component({
selector: 'app-workspace',
templateUrl: './workspace.component.html'
})
export class WorkspaceComponent implements OnInit, OnDestroy {
public unsubscribe$ = new Subject<void>();
layoutConfiguration: any;
FIRST_TO_PANEL_LAYOUT: string;
SECOND_TO_PANEL_LAYOUT: string;
constructor(public router: Router, public layoutService: LayoutService) {
window.scroll({
top: 0,
left: 0,
behavior: 'smooth'
});
}
ngOnInit() {
this.initLayout();
}
redoLayout() {
if (this.layoutConfiguration != null) {
this.FIRST_TO_PANEL_LAYOUT = this.layoutService.redoLayoutCSS(0, this.layoutConfiguration, COLUMN_TYPE.threeToNine);
this.SECOND_TO_PANEL_LAYOUT = this.layoutService.redoLayoutCSS(1, this.layoutConfiguration, COLUMN_TYPE.threeToNine);
} else {
this.FIRST_TO_PANEL_LAYOUT = this.layoutService.redoLayoutCSS(0, null, COLUMN_TYPE.threeToNine);
this.SECOND_TO_PANEL_LAYOUT = this.layoutService.redoLayoutCSS(1, null, COLUMN_TYPE.threeToNine);
}
}
initLayout() {
this.layoutConfiguration = this.layoutService.initlayoutConfig();
this.redoLayout();
this.layoutService.switchableLayout().
pipe(takeUntil(this.unsubscribe$)).subscribe(layoutConfig => {
if (layoutConfig != null) {
this.layoutConfiguration = layoutConfig.layout;
this.redoLayout();
}
});
}
ngOnDestroy() {
this.unsubscribe$.next();
this.unsubscribe$.complete();
}
}
<app-landing-section [textToDisplay]=""
[layoutConfiguration]="layoutConfiguration" [noTitle]="true"></app-landing-section>
<div class="ui container" *ngIf="false">
<div class="ui stackable grid mt-30">
<div class="three wide column pt-0">
<app-workspacesidebar ></app-workspacesidebar>
</div>
<div class="nine wide column workspacesegment" >
<router-outlet></router-outlet>
</div>
</div>
<app-browser-compatibility [showModal]="true"></app-browser-compatibility>
</div>
<div class="sbt-fluid-content-bg">
<div class="sb-g" [ngClass]="layoutConfiguration ? 'sbt-container sbt-page-content relative9' : 'stackable mt-30 mg-pad'">
<div class="relative9" [ngClass]="FIRST_TO_PANEL_LAYOUT">
<app-workspacesidebar ></app-workspacesidebar>
</div>
<div [ngClass]="SECOND_TO_PANEL_LAYOUT" class="w-100">
<div [ngClass]="layoutConfiguration ? 'sbt-page-content-area' : 'workspacesegment'">
<router-outlet></router-outlet>
</div>
</div>
</div>
</div>
<app-browser-compatibility [showModal]="true"></app-browser-compatibility>
Legend
Html element with directive