Skip to content

Commit

Permalink
hide the eco mode container behind the ecoMode flag when creating the…
Browse files Browse the repository at this point in the history
… new layout
  • Loading branch information
stonko1994 committed Dec 10, 2024
1 parent 0dff63a commit ad708ce
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/ts/uifactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ export namespace UIFactory {
});
}

export function superModernUI() {
export function superModernUI(config: UIConfig) {
let subtitleOverlay = new SubtitleOverlay();

let mainSettingsPanelPage: SettingsPanelPage;
Expand Down Expand Up @@ -603,14 +603,16 @@ export namespace UIFactory {
}),
];

const ecoModeContainer = new EcoModeContainer();
if (config.ecoMode) {
const ecoModeContainer = new EcoModeContainer();

ecoModeContainer.setOnToggleCallback(() => {
// forces the browser to re-calculate the height of the settings panel when adding/removing elements
settingsPanel.getDomElement().css({ width: '', height: '' });
});
ecoModeContainer.setOnToggleCallback(() => {
// forces the browser to re-calculate the height of the settings panel when adding/removing elements
settingsPanel.getDomElement().css({ width: '', height: '' });
});

components.unshift(ecoModeContainer);
components.unshift(ecoModeContainer);
}

mainSettingsPanelPage = new SettingsPanelPage({
components,
Expand Down Expand Up @@ -734,7 +736,7 @@ export namespace UIFactory {
},
},
{
ui: superModernUI(),
ui: superModernUI(config),
condition: (context: UIConditionContext) => {
return !context.isAd && !context.adRequiresUi;
},
Expand Down

0 comments on commit ad708ce

Please sign in to comment.