mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
rename frontend to web and update contributing guide (#2509)
* rename frontend to web and update contributing guide * rename this time * fix build * restructure rust code * update documentation * update descriptions * Update CONTRIBUTING.md Co-authored-by: J H <2364004+Blu-J@users.noreply.github.com> --------- Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com> Co-authored-by: J H <2364004+Blu-J@users.noreply.github.com>
This commit is contained in:
61
web/projects/ui/src/app/services/client-storage.service.ts
Normal file
61
web/projects/ui/src/app/services/client-storage.service.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ReplaySubject, Subject } from 'rxjs'
|
||||
import { WorkspaceConfig } from '../../../../shared/src/types/workspace-config'
|
||||
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',
|
||||
})
|
||||
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 {
|
||||
const newVal = !this.storage.get(SHOW_DEV_TOOLS)
|
||||
this.storage.set(SHOW_DEV_TOOLS, newVal)
|
||||
this.showDevTools$.next(newVal)
|
||||
return newVal
|
||||
}
|
||||
|
||||
toggleShowDiskRepair(): boolean {
|
||||
const newVal = !this.storage.get(SHOW_DISK_REPAIR)
|
||||
this.storage.set(SHOW_DISK_REPAIR, newVal)
|
||||
this.showDiskRepair$.next(newVal)
|
||||
return newVal
|
||||
}
|
||||
|
||||
updateWidgetDrawer(drawer: WidgetDrawer) {
|
||||
this.widgetDrawer$.next(drawer)
|
||||
this.storage.set(WIDGET_DRAWER, drawer)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user