From 03f8b73627e91099245be58d8ec7f637770bc3a2 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Sun, 13 Apr 2025 13:03:51 -0600 Subject: [PATCH] minor web cleanup chores --- web/.gitignore | 8 ----- web/.prettierrc | 7 ----- web/README.md | 6 ++-- web/config-sample.json | 1 - web/package.json | 8 +++++ web/patchdb-ui-seed.json | 3 +- .../shared/src/types/workspace-config.ts | 1 - .../app/services/client-storage.service.ts | 30 ++----------------- .../ui/src/app/services/config.service.ts | 6 ++-- 9 files changed, 17 insertions(+), 53 deletions(-) delete mode 100644 web/.prettierrc diff --git a/web/.gitignore b/web/.gitignore index 284e0a69e..e9d412917 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -13,17 +13,11 @@ Thumbs.db UserInterfaceState.xcuserstate $RECYCLE.BIN/ -start9-ambassador *.tar.gz -config.json - -ambassador.tar.gz *.log log.txt npm-debug.log* -postprocess.js - /.angular /.idea /.sass-cache @@ -34,8 +28,6 @@ postprocess.js /dist /out-tsc /node_modules -/platforms -/plugins config.json proxy.conf.json diff --git a/web/.prettierrc b/web/.prettierrc deleted file mode 100644 index 1091b889e..000000000 --- a/web/.prettierrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "singleQuote": true, - "semi": false, - "arrowParens": "avoid", - "trailingComma": "all", - "htmlWhitespaceSensitivity": "ignore" -} diff --git a/web/README.md b/web/README.md index 565d0f7d3..f6e43db19 100644 --- a/web/README.md +++ b/web/README.md @@ -27,12 +27,12 @@ node --version v20.17.0 npm --version -v10.8.2 +v11.1.0 ``` #### Install and enable the Prettier extension for your text editor -#### Clone StartOS and load the PatchDB submodule if you have not already +#### Clone StartOS and load submodules ```sh git clone https://github.com/Start9Labs/start-os.git @@ -57,7 +57,7 @@ cp config-sample.json config.json ``` - By default, "useMocks" is set to `true`. -- Use "maskAs" to mock the host from which the web UI is served. Valid values are `tor`, `local`, and `localhost`. +- Use "maskAs" to mock the host from which the web UI is served. Valid values are `tor`, `local`, `localhost`, `ipv4`, `ipv6`, and `clearnet`. - Use "maskAsHttps" to mock the protocol over which the web UI is served. `true` means https; `false` means http. ## Running the development server diff --git a/web/config-sample.json b/web/config-sample.json index 37d5ea038..b38effc8d 100644 --- a/web/config-sample.json +++ b/web/config-sample.json @@ -1,6 +1,5 @@ { "useMocks": true, - "enableWidgets": false, "ui": { "api": { "url": "rpc", diff --git a/web/package.json b/web/package.json index 872975986..1df95e03b 100644 --- a/web/package.json +++ b/web/package.json @@ -122,5 +122,13 @@ "hooks": { "pre-commit": "lint-staged --concurrent false" } + }, + "prettier": { + "singleQuote": true, + "semi": false, + "arrowParens": "avoid", + "trailingComma": "all", + "htmlWhitespaceSensitivity": "ignore", + "tabWidth": 2 } } diff --git a/web/patchdb-ui-seed.json b/web/patchdb-ui-seed.json index 13d3450b2..6e197c7a4 100644 --- a/web/patchdb-ui-seed.json +++ b/web/patchdb-ui-seed.json @@ -17,6 +17,5 @@ } }, "ackInstructions": {}, - "theme": "Dark", - "widgets": [] + "theme": "Dark" } diff --git a/web/projects/shared/src/types/workspace-config.ts b/web/projects/shared/src/types/workspace-config.ts index 745031170..c59f85ee5 100644 --- a/web/projects/shared/src/types/workspace-config.ts +++ b/web/projects/shared/src/types/workspace-config.ts @@ -1,7 +1,6 @@ export type WorkspaceConfig = { gitHash: string useMocks: boolean - enableWidgets: boolean // each key corresponds to a project and values adjust settings for that project, eg: ui, install-wizard, setup-wizard ui: { api: { diff --git a/web/projects/ui/src/app/services/client-storage.service.ts b/web/projects/ui/src/app/services/client-storage.service.ts index c1ffdb386..9f4f09da1 100644 --- a/web/projects/ui/src/app/services/client-storage.service.ts +++ b/web/projects/ui/src/app/services/client-storage.service.ts @@ -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(1) readonly showDiskRepair$ = new ReplaySubject(1) - readonly widgetDrawer$ = new ReplaySubject(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) - } } diff --git a/web/projects/ui/src/app/services/config.service.ts b/web/projects/ui/src/app/services/config.service.ts index 4c38e8ff8..9f2fa11a0 100644 --- a/web/projects/ui/src/app/services/config.service.ts +++ b/web/projects/ui/src/app/services/config.service.ts @@ -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 {