Skip to content

Commit

Permalink
onThemeChanged order change
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeyaprakash-NK committed Oct 9, 2023
1 parent bdedb8e commit 8430206
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,24 @@ const extension: JupyterFrontEndPlugin<void> = {
onPreviewEnabledChanged();
});

/**
* Handler for when the Jupyter Lab theme changes.
*/
const onThemeChanged = () => {
if (!panelDpms || !panelGcs) return;
const isLightTheme = themeManager.theme
? themeManager.isLight(themeManager.theme)
: true;
if (isLightTheme) {
panelDpms.title.icon = iconDpms;
panelGcs.title.icon = iconStorage;
} else {
panelDpms.title.icon = iconDpmsDark;
panelGcs.title.icon = iconStorageDark;
}
};
themeManager.themeChanged.connect(onThemeChanged);

/**
* Helper method for when the preview flag gets updated. This reads the
* previewEnabled flag and hides or shows the GCS browser or DPMS explorer
Expand Down Expand Up @@ -163,23 +181,7 @@ const extension: JupyterFrontEndPlugin<void> = {
new NotebookButtonExtension(app as JupyterLab, launcher, themeManager)
);

/**
* Handler for when the Jupyter Lab theme changes.
*/
const onThemeChanged = () => {
if (!panelDpms || !panelGcs) return;
const isLightTheme = themeManager.theme
? themeManager.isLight(themeManager.theme)
: true;
if (isLightTheme) {
panelDpms.title.icon = iconDpms;
panelGcs.title.icon = iconStorage;
} else {
panelDpms.title.icon = iconDpmsDark;
panelGcs.title.icon = iconStorageDark;
}
};
themeManager.themeChanged.connect(onThemeChanged);


const loadDpmsWidget = (value: string) => {
// If DPMS is not enabled, no-op.
Expand Down

0 comments on commit 8430206

Please sign in to comment.