From 382de37b16864e7b24ee70c132a786186a0ee115 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Tue, 5 May 2026 12:34:26 +0300 Subject: [PATCH] feat(widget-select): add icons to top-level Installed / IoT Hub toggle - Add a `template?: TemplateRef` slot to ToggleHeaderOption + ToggleOption so callers can render arbitrary content inside a toggle (the existing string label / error icon path stays the default). - Use it in the dashboard widget-select header to render a tb-icon next to each label: now_widgets for Installed, hub for IoT Hub. - Style the top-level toggle with a 42px pill (8px radius, white-15 border, 40px buttons, 36px line-height, 500 weight) so the icon + label sit comfortably and contrast against the primary toolbar. --- .../dashboard-widget-select.component.html | 19 ++++++++-- .../dashboard-widget-select.component.scss | 35 +++++++++++++++++++ .../components/toggle-header.component.html | 20 ++++++----- .../components/toggle-header.component.ts | 6 +++- 4 files changed, 68 insertions(+), 12 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html index 6719d02eb7..8918a2f8c5 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html @@ -19,13 +19,26 @@
@if (showTopLevelWidgetModeToggle()) { - - {{ 'widget.installed' | translate }} - {{ 'iot-hub.iot-hub' | translate }} + + + +
+ now_widgets +
{{ 'widget.installed' | translate }}
+
+
+ +
+ hub +
{{ 'iot-hub.iot-hub' | translate }}
+
+
} @else if (showBackButton()) {
diff --git a/ui-ngx/src/app/shared/components/toggle-header.component.ts b/ui-ngx/src/app/shared/components/toggle-header.component.ts index c60faf810a..53b000d429 100644 --- a/ui-ngx/src/app/shared/components/toggle-header.component.ts +++ b/ui-ngx/src/app/shared/components/toggle-header.component.ts @@ -33,7 +33,7 @@ import { OnInit, Output, QueryList, - SimpleChanges, + SimpleChanges, TemplateRef, ViewChild } from '@angular/core'; import { PageComponent } from '@shared/components/page.component'; @@ -50,6 +50,7 @@ import { MatButtonToggle, MatButtonToggleGroup } from '@angular/material/button- export interface ToggleHeaderOption { name: string; value: any; + template?: TemplateRef; error$?: Observable; } @@ -69,6 +70,8 @@ export class ToggleOption implements OnChanges, OnDestroy { @Input() value: any; + @Input() template: TemplateRef; + @Input() error: string; currentError = new ReplaySubject(1); @@ -127,6 +130,7 @@ export abstract class _ToggleBase extends PageComponent implements AfterContentI { name: option.viewValue, value: option.value, + template: option.template, error$: option.currentError.asObservable() } );