remove unused codes and update
This commit is contained in:
@@ -1,36 +1,32 @@
|
||||
<div class="layout-wrapper" [ngClass]="containerClass">
|
||||
<app-topbar
|
||||
[showMenu]="showMenu()"
|
||||
[startTemplate]="topBarStartAction"
|
||||
[centerTemplate]="topBarCenterAction"
|
||||
[endTemplate]="topBarEndAction || topBarMoreAction"
|
||||
/>
|
||||
@if (fullLoading) {
|
||||
<div class="flex justify-center align-items-center grow items-center">
|
||||
<p-progressSpinner></p-progressSpinner>
|
||||
</div>
|
||||
} @else {
|
||||
@if (showMenu()) {
|
||||
<app-sidebar></app-sidebar>
|
||||
}
|
||||
<div [class]="`layout-main-container ${!showMenu() ? 'hideMenu' : ''} grow ${isFullPage ? 'isFullPage' : ''}`">
|
||||
<div class="layout-main flex flex-col gap-4">
|
||||
@if (showBreadcrumb) {
|
||||
<app-breadcrumb class="rounded-md overflow-hidden shrink-0" />
|
||||
}
|
||||
<div [class]="`rounded-md flex flex-col grow`">
|
||||
<!-- style="container-type: size" -->
|
||||
<div class="h-full">
|
||||
@if (content) {
|
||||
<ng-container [ngTemplateOutlet]="content"></ng-container>
|
||||
} @else {
|
||||
<router-outlet></router-outlet>
|
||||
}
|
||||
</div>
|
||||
@if (!fullPageLoading()) {
|
||||
<app-topbar
|
||||
[showMenu]="showMenu()"
|
||||
[startTemplate]="topBarStartAction"
|
||||
[centerTemplate]="topBarCenterAction"
|
||||
[endTemplate]="topBarEndAction || topBarMoreAction"
|
||||
/>
|
||||
}
|
||||
@if (showMenu()) {
|
||||
<app-sidebar></app-sidebar>
|
||||
}
|
||||
<div [class]="`layout-main-container ${!showMenu() ? 'hideMenu' : ''} grow ${isFullPage ? 'isFullPage' : ''}`">
|
||||
<div class="layout-main flex flex-col gap-4">
|
||||
@if (showBreadcrumb) {
|
||||
<app-breadcrumb class="rounded-md overflow-hidden shrink-0" />
|
||||
}
|
||||
<div [class]="`rounded-md flex flex-col grow`">
|
||||
<!-- style="container-type: size" -->
|
||||
<div class="h-full">
|
||||
@if (content) {
|
||||
<ng-container [ngTemplateOutlet]="content"></ng-container>
|
||||
} @else {
|
||||
<router-outlet></router-outlet>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<app-footer></app-footer>
|
||||
</div>
|
||||
}
|
||||
<app-footer></app-footer>
|
||||
</div>
|
||||
<div class="layout-mask animate-fadein"></div>
|
||||
</div>
|
||||
|
||||
@@ -2,15 +2,7 @@ import { Maybe } from '@/core';
|
||||
import { AuthService, BreadcrumbService } from '@/core/services';
|
||||
import { BreadcrumbComponent } from '@/shared/components';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
ContentChild,
|
||||
inject,
|
||||
Input,
|
||||
Renderer2,
|
||||
TemplateRef,
|
||||
} from '@angular/core';
|
||||
import { Component, computed, ContentChild, inject, Renderer2, TemplateRef } from '@angular/core';
|
||||
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
||||
import { ProgressSpinner } from 'primeng/progressspinner';
|
||||
import { filter, Subscription } from 'rxjs';
|
||||
@@ -38,8 +30,6 @@ export class AppLayout {
|
||||
|
||||
menuOutsideClickListener: any;
|
||||
|
||||
@Input() fullLoading: boolean = false;
|
||||
|
||||
@ContentChild('content', { static: true }) content?: TemplateRef<any> | null;
|
||||
// @ContentChild('topBarMoreAction', { static: true }) topBarMoreAction?: TemplateRef<any> | null;
|
||||
|
||||
@@ -75,6 +65,8 @@ export class AppLayout {
|
||||
});
|
||||
}
|
||||
|
||||
readonly fullPageLoading = computed(() => this.layoutService.layoutState().fullPageLoading);
|
||||
|
||||
isOutsideClicked(event: MouseEvent) {
|
||||
const sidebarEl = document.querySelector('.layout-sidebar');
|
||||
const topbarEl = document.querySelector('.layout-menu-button');
|
||||
|
||||
@@ -15,6 +15,7 @@ interface IPanelInfo {
|
||||
}
|
||||
|
||||
interface LayoutState {
|
||||
fullPageLoading?: boolean;
|
||||
staticMenuDesktopInactive?: boolean;
|
||||
overlayMenuActive?: boolean;
|
||||
configSidebarVisible?: boolean;
|
||||
@@ -42,6 +43,7 @@ export class LayoutService {
|
||||
};
|
||||
|
||||
_state: LayoutState = {
|
||||
fullPageLoading: false,
|
||||
staticMenuDesktopInactive: false,
|
||||
overlayMenuActive: false,
|
||||
configSidebarVisible: false,
|
||||
@@ -154,6 +156,13 @@ export class LayoutService {
|
||||
}));
|
||||
}
|
||||
|
||||
changeFullPageLoading(status: boolean) {
|
||||
this.layoutState.update((prev) => ({
|
||||
...prev,
|
||||
fullPageLoading: status,
|
||||
}));
|
||||
}
|
||||
|
||||
toggleDarkMode(config?: layoutConfig): void {
|
||||
const _config = config || this.layoutConfig();
|
||||
localStorage.setItem('isDarkTheme', JSON.stringify(_config.darkTheme));
|
||||
|
||||
Reference in New Issue
Block a user