Fix bottom-widget display/hide logic

This commit is contained in:
Clemente Raposo 2024-12-05 00:44:11 +00:00 committed by Jack Anderson
parent 66e5463c15
commit 567d034c24
4 changed files with 19 additions and 1 deletions

View file

@ -108,6 +108,7 @@ export class CreateViewStore extends RecordViewStore {
this.parseParams(params);
this.calculateShowWidgets();
this.showTopWidget = false;
this.showBottomWidgets = false;
this.showSubpanels = false;
const isDuplicate = this.params.isDuplicate ?? false;

View file

@ -34,7 +34,7 @@ import {RecordViewStore} from '../store/record-view/record-view.store';
export class BottomWidgetAdapter {
config$ = this.metadata.recordViewMetadata$.pipe(
combineLatestWith(this.store.widgets$),
combineLatestWith(this.store.showBottomWidgets$),
map(([metadata, show]: [RecordViewMetadata, boolean]) => {
if (metadata.bottomWidgets && metadata.bottomWidgets.length) {

View file

@ -49,6 +49,7 @@ export interface RecordViewState {
loading: boolean;
widgets: boolean;
showSidebarWidgets: boolean;
showBottomWidgets: boolean;
showTopWidget: boolean;
showSubpanels: boolean;
mode: ViewMode;

View file

@ -75,6 +75,7 @@ const initialState: RecordViewState = {
loading: false,
widgets: false,
showSidebarWidgets: false,
showBottomWidgets: false,
showTopWidget: false,
showSubpanels: false,
mode: 'detail',
@ -96,6 +97,7 @@ export class RecordViewStore extends ViewStore implements StateStore {
loading$: Observable<boolean>;
widgets$: Observable<boolean>;
showSidebarWidgets$: Observable<boolean>;
showBottomWidgets$: Observable<boolean>;
showTopWidget$: Observable<boolean>;
showSubpanels$: Observable<boolean>;
mode$: Observable<ViewMode>;
@ -161,6 +163,7 @@ export class RecordViewStore extends ViewStore implements StateStore {
this.loading$ = this.state$.pipe(map(state => state.loading));
this.widgets$ = this.state$.pipe(map(state => state.widgets));
this.showSidebarWidgets$ = this.state$.pipe(map(state => state.showSidebarWidgets));
this.showBottomWidgets$ = this.state$.pipe(map(state => state.showBottomWidgets));
this.showTopWidget$ = this.state$.pipe(map(state => state.showTopWidget));
this.showSubpanels$ = this.state$.pipe(map(state => state.showSubpanels));
this.mode$ = this.state$.pipe(map(state => state.mode));
@ -214,6 +217,17 @@ export class RecordViewStore extends ViewStore implements StateStore {
});
}
get showBottomWidgets(): boolean {
return this.internalState.showBottomWidgets;
}
set showBottomWidgets(show: boolean) {
this.updateState({
...this.internalState,
showBottomWidgets: show
});
}
get showTopWidget(): boolean {
return this.internalState.showTopWidget;
}
@ -664,6 +678,8 @@ export class RecordViewStore extends ViewStore implements StateStore {
this.showSidebarWidgets = show;
}
this.showBottomWidgets = true;
this.widgets = show;
}