diff --git a/src/app/app.component.html b/src/app/app.component.html index 31b8a3073..4e942d8a6 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,5 +1,5 @@ @if (isShowUi$ | async) { - @if (globalThemeService.backgroundImg$ | async; as bgImage) { + @if (globalThemeService.backgroundImg(); as bgImage) {
} - @if (isShowFocusOverlay$ | async) { + @if (isShowFocusOverlay()) { } @else { diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 13d3a8af8..34aaae0bd 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -12,6 +12,7 @@ import { OnDestroy, ViewChild, } from '@angular/core'; +import { toSignal } from '@angular/core/rxjs-interop'; import { ChromeExtensionInterfaceService } from './core/chrome-extension-interface/chrome-extension-interface.service'; import { ShortcutService } from './core-ui/shortcut/shortcut.service'; import { GlobalConfigService } from './features/config/global-config.service'; @@ -189,9 +190,9 @@ export class AppComponent implements OnDestroy, AfterViewInit { ), ); - isShowFocusOverlay$: Observable = this._store.select( - selectIsFocusOverlayShown, - ); + isShowFocusOverlay = toSignal(this._store.select(selectIsFocusOverlayShown), { + initialValue: false, + }); private _subs: Subscription = new Subscription(); private _intervalTimer?: NodeJS.Timeout; @@ -432,53 +433,52 @@ export class AppComponent implements OnDestroy, AfterViewInit { } changeBackgroundFromUnsplash(): void { - this.globalThemeService.isDarkTheme$.pipe(take(1)).subscribe((isDarkMode) => { - const contextKey = isDarkMode ? 'backgroundImageDark' : 'backgroundImageLight'; + const isDarkMode = this.globalThemeService.isDarkTheme(); + const contextKey = isDarkMode ? 'backgroundImageDark' : 'backgroundImageLight'; - const dialogRef = this._matDialog.open(DialogUnsplashPickerComponent, { - width: '900px', - maxWidth: '95vw', - data: { - context: contextKey, - }, - }); + const dialogRef = this._matDialog.open(DialogUnsplashPickerComponent, { + width: '900px', + maxWidth: '95vw', + data: { + context: contextKey, + }, + }); - dialogRef.afterClosed().subscribe((result) => { - if (result) { - // Get current work context - this.workContextService.activeWorkContext$ - .pipe(take(1)) - .subscribe((activeContext) => { - if (!activeContext) { - this._snackService.open({ - type: 'ERROR', - msg: 'No active work context', - }); - return; - } + dialogRef.afterClosed().subscribe((result) => { + if (result) { + // Get current work context + this.workContextService.activeWorkContext$ + .pipe(take(1)) + .subscribe((activeContext) => { + if (!activeContext) { + this._snackService.open({ + type: 'ERROR', + msg: 'No active work context', + }); + return; + } - // Extract the URL from the result object - const backgroundUrl = result.url || result; + // Extract the URL from the result object + const backgroundUrl = result.url || result; - // Update the theme based on context type - if (activeContext.type === 'PROJECT') { - this._projectService.update(activeContext.id, { - theme: { - ...activeContext.theme, - [contextKey]: backgroundUrl, - }, - }); - } else if (activeContext.type === 'TAG') { - this._tagService.updateTag(activeContext.id, { - theme: { - ...activeContext.theme, - [contextKey]: backgroundUrl, - }, - }); - } - }); - } - }); + // Update the theme based on context type + if (activeContext.type === 'PROJECT') { + this._projectService.update(activeContext.id, { + theme: { + ...activeContext.theme, + [contextKey]: backgroundUrl, + }, + }); + } else if (activeContext.type === 'TAG') { + this._tagService.updateTag(activeContext.id, { + theme: { + ...activeContext.theme, + [contextKey]: backgroundUrl, + }, + }); + } + }); + } }); } diff --git a/src/app/core-ui/side-nav/side-nav.component.html b/src/app/core-ui/side-nav/side-nav.component.html index 01e1b9354..3237674aa 100644 --- a/src/app/core-ui/side-nav/side-nav.component.html +++ b/src/app/core-ui/side-nav/side-nav.component.html @@ -54,7 +54,7 @@ } -@if (nonHiddenProjects$ | async; as projectList) { +@if (nonHiddenProjects(); as projectList) {
- @if (!projectList.length && isProjectsExpanded) { + @if (!projectList.length && isProjectsExpanded()) {
{{ T.MH.NO_PROJECT_INFO | translate }}
}
} -@if (tagList$ | async; as tagList) { +@if (tagList(); as tagList) {
- @if (!(currentTask$ | async)) { + @if (!currentTask()) { - @if (isSearchIssueProvidersAvailable$ | async) { + @if (isSearchIssueProvidersAvailable()) {