diff --git a/apps/chrome-devtools/src/app-devtools/debug-panel/debug-panel-pres.component.ts b/apps/chrome-devtools/src/app-devtools/debug-panel/debug-panel-pres.component.ts index 3f7ea24a46..bcee90120a 100644 --- a/apps/chrome-devtools/src/app-devtools/debug-panel/debug-panel-pres.component.ts +++ b/apps/chrome-devtools/src/app-devtools/debug-panel/debug-panel-pres.component.ts @@ -1,7 +1,11 @@ -import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core'; +import { AsyncPipe, TitleCasePipe } from '@angular/common'; +import { ChangeDetectionStrategy, Component, type OnDestroy, ViewEncapsulation } from '@angular/core'; +import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { Subscription } from 'rxjs'; import { ChromeExtensionConnectionService } from '../../services/connection.service'; import { DebugPanelService } from './debug-panel.service'; -import { AsyncPipe } from '@angular/common'; + +type PlaceholderMode = 'normal' | 'debug' | 'pending'; @Component({ selector: 'o3r-debug-panel-pres', @@ -10,14 +14,58 @@ import { AsyncPipe } from '@angular/common'; encapsulation: ViewEncapsulation.None, standalone: true, imports: [ - AsyncPipe + ReactiveFormsModule, + FormsModule, + AsyncPipe, + TitleCasePipe ] }) -export class DebugPanelPresComponent { +export class DebugPanelPresComponent implements OnDestroy { + public readonly form = new FormGroup({ + visualTesting: new FormControl(false), + placeholderMode: new FormControl('normal') + }); + + public placeholderModes: PlaceholderMode[] = ['normal', 'debug', 'pending']; + /** Application information stream */ - public applicationInformation$ = this.service.applicationInformation$; + public readonly applicationInformation$ = this.service.applicationInformation$; + + private readonly subscription = new Subscription(); + + constructor( + private readonly service: DebugPanelService, + private readonly connection: ChromeExtensionConnectionService + ) { + this.subscription.add( + this.form.controls.visualTesting.valueChanges.subscribe((value) => { + this.toggleVisualTestingRender(!!value); + }) + ); + this.subscription.add( + this.form.controls.placeholderMode.valueChanges.subscribe((value) => { + if (value) { + this.togglePlaceholderMode(value); + } + }) + ); + } + + /** + * Toggle visual testing mode + * @param toggle + */ + private toggleVisualTestingRender(toggle: boolean) { + this.connection.sendMessage('toggleVisualTesting', { toggle }); + } - constructor(private readonly service: DebugPanelService, private readonly connection: ChromeExtensionConnectionService) {} + /** + * Toggle placeholder mode + * @param mode + */ + private togglePlaceholderMode(mode: PlaceholderMode) { + this.connection.sendMessage('placeholderMode', { mode }); + } /** Refresh Application information */ public refreshInfo() { @@ -26,13 +74,7 @@ export class DebugPanelPresComponent { }); } - /** - * Toggle visual testing mode - * @param event - */ - public toggleVisualTestingRender(event: UIEvent) { - this.connection.sendMessage('toggleVisualTesting', { - toggle: (event.target as HTMLInputElement).checked - }); + public ngOnDestroy() { + this.subscription.unsubscribe(); } } diff --git a/apps/chrome-devtools/src/app-devtools/debug-panel/debug-panel-pres.template.html b/apps/chrome-devtools/src/app-devtools/debug-panel/debug-panel-pres.template.html index ddd9071e8a..13d47c1946 100644 --- a/apps/chrome-devtools/src/app-devtools/debug-panel/debug-panel-pres.template.html +++ b/apps/chrome-devtools/src/app-devtools/debug-panel/debug-panel-pres.template.html @@ -19,12 +19,24 @@

Information

}

Actions

-
-
- -
+
+
Placeholder mode
+
+ @for (mode of placeholderModes; track mode) { + + + } +
+
+
diff --git a/apps/chrome-devtools/src/app-devtools/localization-panel/localization-panel-pres.template.html b/apps/chrome-devtools/src/app-devtools/localization-panel/localization-panel-pres.template.html index c265d81ccd..9dcf483eeb 100644 --- a/apps/chrome-devtools/src/app-devtools/localization-panel/localization-panel-pres.template.html +++ b/apps/chrome-devtools/src/app-devtools/localization-panel/localization-panel-pres.template.html @@ -14,7 +14,7 @@
} -
+