Adrià Vilanova Martínez | 917797e | 2024-05-25 22:41:25 +0200 | [diff] [blame] | 1 | import { ScriptPage } from '../../../common/architecture/scripts/Script'; |
| 2 | import StylesheetScript from '../../../common/architecture/scripts/stylesheet/StylesheetScript'; |
| 3 | |
Adrià Vilanova Martínez | 6ecaa0d | 2024-10-26 17:04:32 +0200 | [diff] [blame^] | 4 | export default class CCDarkThemeInjectForcedDarkTheme extends StylesheetScript { |
Adrià Vilanova Martínez | 917797e | 2024-05-25 22:41:25 +0200 | [diff] [blame] | 5 | stylesheet = 'ccDarkTheme.bundle.css'; |
| 6 | page = ScriptPage.CommunityConsole; |
| 7 | |
| 8 | async shouldBeInjected(): Promise<boolean> { |
| 9 | const ccDarkThemeEnabled = |
| 10 | await this.optionsProvider.isEnabled('ccdarktheme'); |
| 11 | const ccDarkThemeMode = |
| 12 | await this.optionsProvider.getOptionValue('ccdarktheme_mode'); |
| 13 | const ccDarkThemeSwitchEnabled = await this.optionsProvider.isEnabled( |
| 14 | 'ccdarktheme_switch_status', |
| 15 | ); |
| 16 | |
| 17 | return ( |
| 18 | ccDarkThemeEnabled && |
| 19 | ccDarkThemeMode === 'switch' && |
| 20 | ccDarkThemeSwitchEnabled |
| 21 | ); |
| 22 | } |
| 23 | } |