Skip to content

Commit 95b041f

Browse files
tsp-1185/ fix chevron position and show tooltip for empty bias, step and sweep (#24)
This PR has changes made according to recommendation from UI team. Empty sections (bias, step and/or sweep) are unexpanded; chevrons are disabled with appropriate tooltip.
1 parent 7c0bf1f commit 95b041f

File tree

3 files changed

+133
-27
lines changed

3 files changed

+133
-27
lines changed

script-gen-ui/src/app/components/main-sweep/main-sweep.component.html

Lines changed: 94 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,36 @@
4343

4444
<div class="expander">
4545
<div style="display: flex">
46-
<button
47-
(click)="toggleBias()"
48-
class="h3-button"
49-
[attr.aria-label]="'BiasExpander'"
50-
>
51-
<mat-icon>{{
52-
isBiasExpanded ? "expand_more" : "chevron_right"
53-
}}</mat-icon>
54-
</button>
46+
<span style="position: relative; display: flex">
47+
<button
48+
(click)="toggleBias()"
49+
class="button-icon"
50+
[attr.aria-label]="'BiasExpander'"
51+
[disabled]="!hasBiasChannels()"
52+
(mouseenter)="showBiasExpanderTooltip = true"
53+
(mouseleave)="showBiasExpanderTooltip = false"
54+
>
55+
<mat-icon>{{
56+
biasChannels.length === 0
57+
? "chevron_right"
58+
: isBiasExpanded
59+
? "expand_more"
60+
: "chevron_right"
61+
}}</mat-icon>
62+
<app-tooltip
63+
class="biasExpander-tooltip"
64+
*ngIf="
65+
!hasBiasChannels() &&
66+
hasAvailableChannels() &&
67+
showBiasExpanderTooltip
68+
"
69+
text="No bias channels. Click + to add one"
70+
position="bottom"
71+
[visible]="showBiasExpanderTooltip"
72+
>
73+
</app-tooltip>
74+
</button>
75+
</span>
5576
<h3>Bias</h3>
5677
</div>
5778
<span style="position: relative; display: flex">
@@ -65,6 +86,7 @@ <h3>Bias</h3>
6586
>
6687
<mat-icon>add</mat-icon>
6788
<app-tooltip
89+
class="addBias-tooltip"
6890
*ngIf="!hasAvailableChannels() && showBiasTooltip"
6991
text="No channels available"
7092
position="bottom"
@@ -103,15 +125,36 @@ <h3>Bias</h3>
103125

104126
<div class="expander">
105127
<div style="display: flex">
106-
<button
107-
(click)="toggleStep()"
108-
class="h3-button"
109-
[attr.aria-label]="'StepExpander'"
110-
>
111-
<mat-icon>{{
112-
isStepExpanded ? "expand_more" : "chevron_right"
113-
}}</mat-icon>
114-
</button>
128+
<span style="position: relative; display: flex">
129+
<button
130+
(click)="toggleStep()"
131+
class="button-icon"
132+
[attr.aria-label]="'StepExpander'"
133+
[disabled]="!hasStepChannels()"
134+
(mouseenter)="showStepExpanderTooltip = true"
135+
(mouseleave)="showStepExpanderTooltip = false"
136+
>
137+
<mat-icon>{{
138+
stepChannels.length === 0
139+
? "chevron_right"
140+
: isStepExpanded
141+
? "expand_more"
142+
: "chevron_right"
143+
}}</mat-icon>
144+
<app-tooltip
145+
class="stepExpander-tooltip"
146+
*ngIf="
147+
!hasStepChannels() &&
148+
hasAvailableChannels() &&
149+
showStepExpanderTooltip
150+
"
151+
text="No step channels. Click + to add one"
152+
position="bottom"
153+
[visible]="showStepExpanderTooltip"
154+
>
155+
</app-tooltip>
156+
</button>
157+
</span>
115158
<h3>Step</h3>
116159
</div>
117160
<span style="position: relative; display: flex">
@@ -125,6 +168,7 @@ <h3>Step</h3>
125168
>
126169
<mat-icon>add</mat-icon>
127170
<app-tooltip
171+
class="addStep-tooltip"
128172
*ngIf="!hasAvailableChannels() && showStepTooltip"
129173
text="No channels available"
130174
position="bottom"
@@ -178,15 +222,37 @@ <h3>Step</h3>
178222

179223
<div class="expander">
180224
<div style="display: flex">
181-
<button
182-
(click)="toggleSweep()"
183-
class="h3-button"
184-
[attr.aria-label]="'SweepExpander'"
185-
>
186-
<mat-icon>{{
187-
isSweepExpanded ? "expand_more" : "chevron_right"
188-
}}</mat-icon>
189-
</button>
225+
<span style="position: relative; display: flex">
226+
<button
227+
(click)="toggleSweep()"
228+
class="button-icon"
229+
[attr.aria-label]="'SweepExpander'"
230+
[disabled]="!hasSweepChannels()"
231+
(mouseenter)="showSweepExpanderTooltip = true"
232+
(mouseleave)="showSweepExpanderTooltip = false"
233+
>
234+
<mat-icon>{{
235+
sweepChannels.length === 0
236+
? "chevron_right"
237+
: isSweepExpanded
238+
? "expand_more"
239+
: "chevron_right"
240+
}}</mat-icon>
241+
<app-tooltip
242+
class="sweepExpander-tooltip"
243+
*ngIf="
244+
!hasSweepChannels() &&
245+
hasAvailableChannels() &&
246+
showSweepExpanderTooltip
247+
"
248+
text="No sweep channels. Click + to add one"
249+
position="bottom"
250+
[visible]="showSweepExpanderTooltip"
251+
>
252+
</app-tooltip>
253+
</button>
254+
</span>
255+
190256
<h3>Sweep</h3>
191257
</div>
192258
<span style="position: relative; display: flex">
@@ -200,6 +266,7 @@ <h3>Sweep</h3>
200266
>
201267
<mat-icon>add</mat-icon>
202268
<app-tooltip
269+
class="addSweep-tooltip"
203270
*ngIf="!hasAvailableChannels() && showSweepTooltip"
204271
text="No channels available"
205272
position="bottom"

script-gen-ui/src/app/components/main-sweep/main-sweep.component.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,25 @@ input:focus {
363363
}
364364
}
365365

366+
.biasExpander-tooltip::ng-deep {
367+
&.bottom {
368+
transform: translateX(0%) translateY(1px)!important;
369+
}
370+
}
371+
372+
.stepExpander-tooltip::ng-deep {
373+
&.bottom {
374+
transform: translateX(0%) translateY(1px)!important;
375+
}
376+
}
377+
378+
.sweepExpander-tooltip::ng-deep {
379+
&.bottom {
380+
transform: translateX(0%) translateY(1px)!important;
381+
}
382+
}
383+
384+
366385
// mat-icon {
367386
// padding: 5px;
368387
// }

script-gen-ui/src/app/components/main-sweep/main-sweep.component.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ export class MainSweepComponent implements OnChanges {
108108
showBiasTooltip = false;
109109
showStepTooltip = false;
110110
showSweepTooltip = false;
111+
showBiasExpanderTooltip = false;
112+
showStepExpanderTooltip = false;
113+
showSweepExpanderTooltip = false;
111114
stepGlobalParameters: StepGlobalParameters | undefined;
112115
sweepGlobalParameters: SweepGlobalParameters | undefined;
113116

@@ -354,6 +357,23 @@ export class MainSweepComponent implements OnChanges {
354357
return this.channelsExpanderState.get(uuid) || false;
355358
}
356359

360+
hasBiasChannels(): boolean {
361+
return this.biasChannels.length > 0;
362+
}
363+
364+
hasStepChannels(): boolean {
365+
return this.stepChannels.length > 0;
366+
}
367+
368+
hasSweepChannels(): boolean {
369+
if (this.sweepChannels.length > 0) {
370+
return true;
371+
} else {
372+
this.isSweepExpanded = false; // if no sweep channels, close the expander
373+
return false;
374+
}
375+
}
376+
357377
updateTimingConfig() {
358378
const sweepTimingConfig =
359379
this.timingComponent.getSweepTimingConfigFromComponent();

0 commit comments

Comments
 (0)