Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

code maintenance/66397 Remove duplicate theme setting fn calls (#19960)

Kabiru Mwenja5cd292097e7d
diff --git a/frontend/src/app/core/setup/globals/theme-utils.ts b/frontend/src/app/core/setup/globals/theme-utils.ts
index d81c25a55c4..c19c8b45c55 100644
--- a/frontend/src/app/core/setup/globals/theme-utils.ts
+++ b/frontend/src/app/core/setup/globals/theme-utils.ts
@@ -30,7 +30,7 @@
export type OpColorMode = 'light' | 'dark';
-export type OpTheme = OpColorMode | `${OpColorMode}_high_contrast`;
+export type OpTheme = OpColorMode | `${OpColorMode}_high_contrast` | 'sync_with_os';
export class ThemeUtils {
public applySystemThemeImmediately():void {
diff --git a/frontend/src/stimulus/controllers/auto-theme-switcher.controller.ts b/frontend/src/stimulus/controllers/auto-theme-switcher.controller.ts
index f80e0af99fc..55b08efd8d9 100644
--- a/frontend/src/stimulus/controllers/auto-theme-switcher.controller.ts
+++ b/frontend/src/stimulus/controllers/auto-theme-switcher.controller.ts
@@ -30,9 +30,7 @@
import { Controller } from '@hotwired/stimulus';
import { useMatchMedia } from 'stimulus-use';
-import { type OpTheme } from 'core-app/core/setup/globals/theme-utils';
-
-type OpThemeMode = OpTheme | 'sync_with_os';
+import { OpTheme } from 'core-app/core/setup/globals/theme-utils';
export default class AutoThemeSwitcher extends Controller {
static values = {
@@ -42,7 +40,7 @@ export default class AutoThemeSwitcher extends Controller {
static targets = ['desktopLogo', 'mobileLogo'];
static classes = ['desktopLightHighContrastLogo', 'mobileWhiteLogo'];
- declare readonly modeValue:OpThemeMode;
+ declare readonly modeValue:OpTheme;
declare readonly desktopLogoTarget:HTMLLinkElement;
declare readonly mobileLogoTarget:HTMLLinkElement;
declare readonly desktopLightHighContrastLogoClass:string;
@@ -69,14 +67,6 @@ export default class AutoThemeSwitcher extends Controller {
this.applySystemTheme();
}
- isLightMode():void {
- window.OpenProject.theme.applyThemeToBody('light');
- }
-
- notLightMode():void {
- window.OpenProject.theme.applyThemeToBody('dark');
- }
-
private applySystemTheme():void {
window.OpenProject.theme.applySystemThemeImmediately();
this.updateOpLogoContrast();