Skip to content

Commit b4a8d49

Browse files
bkudiessCopilotCopilotshanselman
authored
Improve Node capability summary UX (#891)
* Improve node capability summary UX Replace the Connection page Node card raw capability dump with stateful capability pills and a collapsed technical-details disclosure. Preserve raw gateway capability, command, and permission details for debugging while improving default scanability, theme handling, and accessibility. Co-authored-by: Copilot <[email protected]> * Expose node capability pill state to accessibility Move the capability pill automation name onto the visible TextBlock so screen readers can announce the capability label and state through a real text peer instead of relying on a named Border container. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Scott Hanselman <[email protected]>
1 parent a3c5e0b commit b4a8d49

10 files changed

Lines changed: 518 additions & 125 deletions

File tree

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using System;
2+
using Microsoft.UI.Xaml;
3+
using Microsoft.UI.Xaml.Controls;
4+
using Windows.Foundation;
5+
6+
namespace OpenClawTray.Helpers;
7+
8+
/// <summary>
9+
/// Minimal left-to-right wrapping panel for compact chip rows.
10+
/// </summary>
11+
public sealed class WrapPanel : Panel
12+
{
13+
public double HorizontalSpacing { get; set; }
14+
15+
public double VerticalSpacing { get; set; }
16+
17+
protected override Size MeasureOverride(Size availableSize)
18+
{
19+
var available = double.IsInfinity(availableSize.Width)
20+
? double.PositiveInfinity
21+
: availableSize.Width;
22+
23+
double lineWidth = 0, lineHeight = 0, totalHeight = 0, maxWidth = 0;
24+
25+
foreach (var child in Children)
26+
{
27+
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
28+
var size = child.DesiredSize;
29+
30+
if (lineWidth > 0 && lineWidth + HorizontalSpacing + size.Width > available)
31+
{
32+
totalHeight += lineHeight + VerticalSpacing;
33+
maxWidth = Math.Max(maxWidth, lineWidth);
34+
lineWidth = size.Width;
35+
lineHeight = size.Height;
36+
}
37+
else
38+
{
39+
lineWidth += (lineWidth > 0 ? HorizontalSpacing : 0) + size.Width;
40+
lineHeight = Math.Max(lineHeight, size.Height);
41+
}
42+
}
43+
44+
totalHeight += lineHeight;
45+
maxWidth = Math.Max(maxWidth, lineWidth);
46+
47+
return new Size(
48+
double.IsInfinity(available) ? maxWidth : Math.Min(maxWidth, available),
49+
totalHeight);
50+
}
51+
52+
protected override Size ArrangeOverride(Size finalSize)
53+
{
54+
double x = 0, y = 0, lineHeight = 0;
55+
56+
foreach (var child in Children)
57+
{
58+
var size = child.DesiredSize;
59+
60+
if (x > 0 && x + size.Width > finalSize.Width)
61+
{
62+
x = 0;
63+
y += lineHeight + VerticalSpacing;
64+
lineHeight = 0;
65+
}
66+
67+
child.Arrange(new Rect(x, y, size.Width, size.Height));
68+
x += size.Width + HorizontalSpacing;
69+
lineHeight = Math.Max(lineHeight, size.Height);
70+
}
71+
72+
return finalSize;
73+
}
74+
}

‎src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml‎

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -410,30 +410,52 @@
410410
Glyph="{x:Bind helpers:FluentIconCatalog.StatusOk, Mode=OneTime}"
411411
FontSize="14"
412412
Foreground="{ThemeResource SystemFillColorNeutralBrush}"
413-
VerticalAlignment="Center" HorizontalAlignment="Center"
413+
VerticalAlignment="Top" HorizontalAlignment="Center"
414+
Margin="0,2,0,0"
414415
AutomationProperties.AccessibilityView="Raw"/>
415-
<StackPanel Grid.Column="1" VerticalAlignment="Center" Spacing="2">
416+
<StackPanel Grid.Column="1" Spacing="2">
416417
<TextBlock x:Uid="ConnectionPage_NodeModeDisabled" x:Name="NodeStatusText"
417418
Text="Node mode disabled"
418419
Style="{StaticResource BodyTextBlockStyle}"/>
419-
<!-- Canonical capability list per design naming.md:
420-
"Providing N capabilities: browser, camera, …"
421-
Replaces the prior chip strip. -->
420+
<!-- MCP-only reachability line. Active node uses pills below. -->
422421
<TextBlock x:Name="NodeCapabilityText"
423422
Style="{StaticResource CaptionTextBlockStyle}"
424423
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
425424
TextWrapping="Wrap"
426425
Visibility="Collapsed"/>
427-
<TextBlock x:Name="NodeCommandText"
428-
Style="{StaticResource CaptionTextBlockStyle}"
429-
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
430-
TextWrapping="Wrap"
431-
Visibility="Collapsed"/>
432-
<TextBlock x:Name="NodePermissionText"
433-
Style="{StaticResource CaptionTextBlockStyle}"
434-
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
435-
TextWrapping="Wrap"
436-
Visibility="Collapsed"/>
426+
<Border x:Name="NodeCapabilityPillsHost"
427+
Margin="0,2,0,0"
428+
Visibility="Collapsed"/>
429+
<Expander x:Name="NodeTechnicalDetailsExpander"
430+
Margin="0,6,0,0"
431+
HorizontalAlignment="Stretch"
432+
HorizontalContentAlignment="Stretch"
433+
IsExpanded="False"
434+
Visibility="Collapsed">
435+
<Expander.Header>
436+
<TextBlock x:Uid="ConnectionPage_NodeTechnicalDetails" Text="Show technical details"
437+
Style="{StaticResource CaptionTextBlockStyle}"
438+
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
439+
VerticalAlignment="Center"/>
440+
</Expander.Header>
441+
<StackPanel Spacing="6" Padding="0,4,0,0">
442+
<TextBlock x:Name="NodeTechCapabilityText"
443+
Style="{StaticResource CaptionTextBlockStyle}"
444+
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
445+
IsTextSelectionEnabled="True"
446+
TextWrapping="Wrap"/>
447+
<TextBlock x:Name="NodeTechCommandText"
448+
Style="{StaticResource CaptionTextBlockStyle}"
449+
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
450+
IsTextSelectionEnabled="True"
451+
TextWrapping="Wrap"/>
452+
<TextBlock x:Name="NodeTechPermissionText"
453+
Style="{StaticResource CaptionTextBlockStyle}"
454+
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
455+
IsTextSelectionEnabled="True"
456+
TextWrapping="Wrap"/>
457+
</StackPanel>
458+
</Expander>
437459
<StackPanel x:Name="NodePendingDeclarationsPanel"
438460
Spacing="2"
439461
Visibility="Collapsed">
@@ -519,15 +541,6 @@
519541
Margin="0,4,0,0"
520542
AutomationProperties.AutomationId="NodeReconnect"/>
521543

522-
<!-- Capability chips removed in favor of NodeCapabilityText
523-
above. Element kept for back-compat with code-behind
524-
that may still reference it (currently inert). -->
525-
<ItemsRepeater x:Name="NodeCapabilityChipsHost" Visibility="Collapsed">
526-
<ItemsRepeater.Layout>
527-
<StackLayout Orientation="Horizontal" Spacing="6"/>
528-
</ItemsRepeater.Layout>
529-
</ItemsRepeater>
530-
531544
<!-- Deep link to per-capability config -->
532545
<StackPanel x:Name="NodeDeepLinks" Orientation="Horizontal" Spacing="12">
533546
<HyperlinkButton x:Uid="ConnectionPage_ManagePermissions" x:Name="NodePermissionsLink"

0 commit comments

Comments
 (0)