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

refactor(expansionPanel): handle 2 class simultanously base on expansion panel expanded and maximized #1023

Merged
merged 2 commits into from
Sep 22, 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
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class ExpansionPanelComponent {

@HostBinding('class.app-expansion-panel-expanded')
get hasExpandedClass() {
return this.expanded && !this.maximized;
return this.expanded;
}

@HostBinding('class.app-expansion-panel-expanded-maximized')
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/portal/portal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
*ngIf="hasExpansionPanel && (workspaceState.workspaceEnabled$ | async)"
[backdropShown]="expansionPanelBackdropShown"
[(expanded)]="expansionPanelExpanded"
[maximized]="workspaceMaximize$ | async"
[maximized]="workspaceState.workspaceMaximize$ | async"
[@expansionPanelSize]="getExpansionPanelStatus()"
[@toastOffsetY]="
isMobile() &&
Expand Down
18 changes: 5 additions & 13 deletions src/app/pages/portal/portal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export class PortalComponent implements OnInit, OnDestroy {

public fullExtent: boolean;
private workspaceMaximize$$: Subscription[] = [];
readonly workspaceMaximize$: BehaviorSubject<boolean>;

public matDialogRef$ = new BehaviorSubject<MatDialogRef<any>>(undefined);
public searchBarTerm = '';
Expand Down Expand Up @@ -347,9 +346,6 @@ export class PortalComponent implements OnInit, OnDestroy {
private configFileToGeoDBService: ConfigFileToGeoDBService
) {
this.fullExtent = this.storageService.get('fullExtent') as boolean;
this.workspaceMaximize$ = new BehaviorSubject(
this.storageService.get('workspaceMaximize') as boolean
);
this._toastPanelOpened =
(this.storageService.get('toastOpened') as boolean) !== false;
this.hasExpansionPanel = this.configService.getConfig('hasExpansionPanel');
Expand Down Expand Up @@ -492,13 +488,9 @@ export class PortalComponent implements OnInit, OnDestroy {

this.workspaceMaximize$$.push(
this.workspaceState.workspaceMaximize$.subscribe((workspaceMaximize) => {
this.workspaceMaximize$.next(workspaceMaximize);
this.updateMapBrowserClass();
})
);
this.workspaceMaximize$$.push(
this.workspaceMaximize$.subscribe(() => this.updateMapBrowserClass())
);

this.workspaceState.workspace$.subscribe(
(activeWks: WfsWorkspace | FeatureWorkspace | EditionWorkspace) => {
Expand Down Expand Up @@ -985,7 +977,7 @@ export class PortalComponent implements OnInit, OnDestroy {
}

if (this.hasExpansionPanel && this.expansionPanelExpanded) {
if (this.workspaceMaximize$.value) {
if (this.workspaceState.workspaceMaximize$.value) {
this.mapBrowser.nativeElement.classList.add(
'expansion-offset-maximized'
);
Expand All @@ -997,7 +989,7 @@ export class PortalComponent implements OnInit, OnDestroy {
);
}
} else {
if (this.workspaceMaximize$.value) {
if (this.workspaceState.workspaceMaximize$.value) {
this.mapBrowser.nativeElement.classList.remove(
'expansion-offset-maximized'
);
Expand Down Expand Up @@ -1092,7 +1084,7 @@ export class PortalComponent implements OnInit, OnDestroy {
getToastPanelOffsetY() {
let status = 'noExpansion';
if (this.expansionPanelExpanded) {
if (this.workspaceMaximize$.value) {
if (this.workspaceState.workspaceMaximize$.value) {
if (this.toastPanelOpened) {
status = 'expansionMaximizedAndToastOpened';
} else {
Expand Down Expand Up @@ -1124,7 +1116,7 @@ export class PortalComponent implements OnInit, OnDestroy {
}
getControlsOffsetY() {
return this.expansionPanelExpanded
? this.workspaceMaximize$.value
? this.workspaceState.workspaceMaximize$.value
? 'firstRowFromBottom-expanded-maximized'
: 'firstRowFromBottom-expanded'
: 'firstRowFromBottom';
Expand Down Expand Up @@ -1157,7 +1149,7 @@ export class PortalComponent implements OnInit, OnDestroy {
} else {
if (this.workspaceState.workspaceEnabled$.value) {
if (this.expansionPanelExpanded) {
if (this.workspaceMaximize$.value) {
if (this.workspaceState.workspaceMaximize$.value) {
status = 'firstRowFromBottom-expanded-maximized';
} else {
status = 'firstRowFromBottom-expanded';
Expand Down
Loading