minor web cleanup chores

This commit is contained in:
Matt Hill
2025-04-13 13:03:51 -06:00
parent 2e6e9635c3
commit 03f8b73627
9 changed files with 17 additions and 53 deletions

View File

@@ -1,18 +1,9 @@
import { Injectable } from '@angular/core'
import { ReplaySubject, Subject } from 'rxjs'
import { WorkspaceConfig } from '../../../../shared/src/types/workspace-config'
import { ReplaySubject } from 'rxjs'
import { StorageService } from './storage.service'
const SHOW_DEV_TOOLS = 'SHOW_DEV_TOOLS'
const SHOW_DISK_REPAIR = 'SHOW_DISK_REPAIR'
const WIDGET_DRAWER = 'WIDGET_DRAWER'
const { enableWidgets } =
require('../../../../../config.json') as WorkspaceConfig
export type WidgetDrawer = {
open: boolean
width: 400 | 600
}
@Injectable({
providedIn: 'root',
@@ -20,24 +11,12 @@ export type WidgetDrawer = {
export class ClientStorageService {
readonly showDevTools$ = new ReplaySubject<boolean>(1)
readonly showDiskRepair$ = new ReplaySubject<boolean>(1)
readonly widgetDrawer$ = new ReplaySubject<WidgetDrawer>(1)
constructor(private readonly storage: StorageService) {}
init() {
this.showDevTools$.next(!!this.storage.get(SHOW_DEV_TOOLS))
this.showDiskRepair$.next(!!this.storage.get(SHOW_DISK_REPAIR))
this.widgetDrawer$.next(
enableWidgets
? this.storage.get(WIDGET_DRAWER) || {
open: true,
width: 600,
}
: {
open: false,
width: 600,
},
)
}
toggleShowDevTools(): boolean {
@@ -53,9 +32,4 @@ export class ClientStorageService {
this.showDiskRepair$.next(newVal)
return newVal
}
updateWidgetDrawer(drawer: WidgetDrawer) {
this.widgetDrawer$.next(drawer)
this.storage.set(WIDGET_DRAWER, drawer)
}
}

View File

@@ -35,9 +35,9 @@ export class ConfigService {
}
isLocal(): boolean {
return (
this.hostname.endsWith('.local') || (useMocks && mocks.maskAs === 'local')
)
return useMocks
? mocks.maskAs === 'local'
: this.hostname.endsWith('.local')
}
isLocalhost(): boolean {