Skip to content

Commit dd1c791

Browse files
bkudiessCopilotCopilot
authored
Redesign Hub title bar notifications and status (#870)
Move notifications from the footer rail into a title-bar bell flyout and replace the compact connection status dots with a status pill plus detail flyout. Keep the status presentation aligned with the Connection page by deriving node state from shared presenter logic and the node-mode/capability settings. Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent acfbf62 commit dd1c791

15 files changed

Lines changed: 1135 additions & 215 deletions

‎src/OpenClaw.Tray.WinUI/Helpers/FluentIconCatalog.cs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public static class FluentIconCatalog
4949
public const string Settings = "\uE713"; // Settings
5050
public const string Setup = "\uE825"; // Bank — Reconfigure / Setup wizard launcher
5151
public const string About = "\uE946"; // Info
52+
public const string Notifications = "\uE7E7"; // Ringer — title-bar notifications bell
5253
public const string Exit = "\uE711"; // Cancel (X) — used for "Close" menu item
5354
public const string Add = "\uE710"; // Add — "+ Add gateway" header button
5455
public const string Back = "\uE72B"; // Back — leading chevron on Back hyperlink

‎src/OpenClaw.Tray.WinUI/Pages/NotificationsPage.xaml.cs‎

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
using Microsoft.UI.Xaml;
22
using Microsoft.UI.Xaml.Controls;
3-
using OpenClawTray.Helpers;
43
using OpenClawTray.Services;
5-
using System;
4+
using OpenClawTray.ViewModels;
65
using System.Collections.ObjectModel;
7-
using System.Globalization;
8-
using System.Linq;
96

107
namespace OpenClawTray.Pages;
118

@@ -98,82 +95,4 @@ private void OnNotificationActionClick(object sender, RoutedEventArgs e)
9895
((IAppCommands)CurrentApp).Navigate(item.ActionRoute);
9996
_notificationService?.Dismiss(item.Id);
10097
}
101-
102-
private sealed record NotificationItemViewModel(
103-
string Id,
104-
string SeverityGlyph,
105-
string Title,
106-
string Message,
107-
string Metadata,
108-
string? ActionLabel,
109-
string? ActionRoute,
110-
Visibility ActionVisibility,
111-
string OccurrenceText,
112-
Visibility OccurrenceVisibility,
113-
string DismissAutomationName)
114-
{
115-
public static NotificationItemViewModel From(AppNotification notification)
116-
{
117-
var metadata = new[]
118-
{
119-
LocalizeMetadataValue(notification.Source),
120-
LocalizeMetadataValue(notification.Category),
121-
notification.CreatedAt.ToLocalTime().ToString("g", CultureInfo.CurrentCulture)
122-
}
123-
.Where(value => !string.IsNullOrWhiteSpace(value));
124-
125-
var occurrenceText = LocalizationHelper.Format(
126-
"AppNotification_RepeatedBadgeFormat",
127-
notification.OccurrenceCount);
128-
129-
return new(
130-
notification.Id,
131-
ToSeverityGlyph(notification.Severity),
132-
notification.Title,
133-
notification.Message,
134-
string.Join(" - ", metadata),
135-
notification.ActionLabel,
136-
notification.ActionRoute,
137-
!string.IsNullOrWhiteSpace(notification.ActionLabel) &&
138-
!string.IsNullOrWhiteSpace(notification.ActionRoute)
139-
? Visibility.Visible
140-
: Visibility.Collapsed,
141-
occurrenceText,
142-
notification.OccurrenceCount > 1 ? Visibility.Visible : Visibility.Collapsed,
143-
LocalizationHelper.Format("NotificationsPage_DismissAutomationNameFormat", notification.Title));
144-
}
145-
146-
private static string ToSeverityGlyph(AppNotificationSeverity severity) => severity switch
147-
{
148-
AppNotificationSeverity.Success => "\uE930",
149-
AppNotificationSeverity.Warning => "\uE7BA",
150-
AppNotificationSeverity.Error => "\uE783",
151-
_ => "\uE946"
152-
};
153-
154-
private static string? LocalizeMetadataValue(string? value) => value switch
155-
{
156-
null or "" => null,
157-
"authentication" => LocalizationHelper.GetString("NotificationsPage_MetadataAuthentication"),
158-
"bindings" => LocalizationHelper.GetString("NotificationsPage_MetadataBindings"),
159-
"channels" => LocalizationHelper.GetString("NotificationsPage_MetadataChannels"),
160-
"config" => LocalizationHelper.GetString("NotificationsPage_MetadataConfig"),
161-
"connection" => LocalizationHelper.GetString("NotificationsPage_MetadataConnection"),
162-
"cron" => LocalizationHelper.GetString("NotificationsPage_MetadataCron"),
163-
"exec-approval" => LocalizationHelper.GetString("NotificationsPage_MetadataSourceExecApproval"),
164-
"gateway" => LocalizationHelper.GetString("NotificationsPage_MetadataGateway"),
165-
"jobs" => LocalizationHelper.GetString("NotificationsPage_MetadataJobs"),
166-
"load" => LocalizationHelper.GetString("NotificationsPage_MetadataLoad"),
167-
"lifecycle" => LocalizationHelper.GetString("NotificationsPage_MetadataLifecycle"),
168-
"local-gateway" => LocalizationHelper.GetString("NotificationsPage_MetadataLocalGateway"),
169-
"node.invoke" => LocalizationHelper.GetString("NotificationsPage_MetadataCategoryNodeInvoke"),
170-
"node" => LocalizationHelper.GetString("NotificationsPage_MetadataNode"),
171-
"pairing" => LocalizationHelper.GetString("NotificationsPage_MetadataPairing"),
172-
"sandbox" => LocalizationHelper.GetString("NotificationsPage_MetadataSandbox"),
173-
"settings" => LocalizationHelper.GetString("NotificationsPage_MetadataSettings"),
174-
"status" => LocalizationHelper.GetString("NotificationsPage_MetadataStatus"),
175-
"system.run" => LocalizationHelper.GetString("NotificationsPage_MetadataSystemRun"),
176-
_ => value
177-
};
178-
}
17998
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using OpenClaw.Connection;
2+
3+
namespace OpenClawTray.Services;
4+
5+
internal enum ConnectionStatusAccent
6+
{
7+
Neutral,
8+
Success,
9+
Caution,
10+
Critical,
11+
}
12+
13+
internal static class ConnectionStatusPresenter
14+
{
15+
public static (string LabelKey, ConnectionStatusAccent Accent) Pill(OverallConnectionState overall) => overall switch
16+
{
17+
OverallConnectionState.Connected or OverallConnectionState.Ready =>
18+
("StatusDisplay_Connected", ConnectionStatusAccent.Success),
19+
OverallConnectionState.Connecting =>
20+
("StatusDisplay_Connecting", ConnectionStatusAccent.Caution),
21+
OverallConnectionState.Degraded =>
22+
("HubWindow_Pill_Degraded", ConnectionStatusAccent.Caution),
23+
OverallConnectionState.PairingRequired =>
24+
("HubWindow_Pill_PairingRequired", ConnectionStatusAccent.Caution),
25+
OverallConnectionState.Error =>
26+
("StatusDisplay_Error", ConnectionStatusAccent.Critical),
27+
_ => ("StatusDisplay_Disconnected", ConnectionStatusAccent.Neutral),
28+
};
29+
30+
public static ConnectionStatusAccent RoleAccent(RoleConnectionState state) => state switch
31+
{
32+
RoleConnectionState.Connected => ConnectionStatusAccent.Success,
33+
RoleConnectionState.Connecting => ConnectionStatusAccent.Caution,
34+
RoleConnectionState.PairingRequired => ConnectionStatusAccent.Caution,
35+
RoleConnectionState.Error or
36+
RoleConnectionState.PairingRejected or
37+
RoleConnectionState.RateLimited => ConnectionStatusAccent.Critical,
38+
_ => ConnectionStatusAccent.Neutral,
39+
};
40+
41+
public static string RoleStateLabelKey(RoleConnectionState state) => state switch
42+
{
43+
RoleConnectionState.Connected => "StatusDisplay_Connected",
44+
RoleConnectionState.Connecting => "StatusDisplay_Connecting",
45+
RoleConnectionState.PairingRequired => "HubWindow_Role_PairingRequired",
46+
RoleConnectionState.PairingRejected => "HubWindow_Role_PairingRejected",
47+
RoleConnectionState.RateLimited => "HubWindow_Role_RateLimited",
48+
RoleConnectionState.Error => "StatusDisplay_Error",
49+
RoleConnectionState.Disabled => "HubWindow_Role_Disabled",
50+
_ => "HubWindow_Role_Off",
51+
};
52+
53+
public static (string LabelKey, ConnectionStatusAccent Accent) NodeRow(
54+
GatewayConnectionSnapshot snapshot, bool nodeModeEnabled, int enabledCapabilityCount)
55+
{
56+
if (!nodeModeEnabled || snapshot.OperatorState != RoleConnectionState.Connected)
57+
return ("HubWindow_Role_Disabled", ConnectionStatusAccent.Neutral);
58+
59+
return snapshot.NodeState switch
60+
{
61+
RoleConnectionState.PairingRequired => (RoleStateLabelKey(snapshot.NodeState), ConnectionStatusAccent.Caution),
62+
RoleConnectionState.PairingRejected or
63+
RoleConnectionState.RateLimited or
64+
RoleConnectionState.Error => (RoleStateLabelKey(snapshot.NodeState), ConnectionStatusAccent.Critical),
65+
_ when enabledCapabilityCount == 0 => ("HubWindow_Role_PermissionsIncomplete", ConnectionStatusAccent.Caution),
66+
_ => (RoleStateLabelKey(snapshot.NodeState), RoleAccent(snapshot.NodeState)),
67+
};
68+
}
69+
70+
public static bool NodeNeedsApproval(GatewayConnectionSnapshot snapshot, bool nodeModeEnabled) =>
71+
nodeModeEnabled
72+
&& snapshot.OperatorState == RoleConnectionState.Connected
73+
&& snapshot.NodeState == RoleConnectionState.PairingRequired;
74+
}

‎src/OpenClaw.Tray.WinUI/Strings/en-us/Resources.resw‎

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,9 +2421,6 @@ On your gateway host (Mac/Linux), run:
24212421
<data name="HubWindow_NavigationViewItem_136.Content" xml:space="preserve">
24222422
<value>Permissions</value>
24232423
</data>
2424-
<data name="HubWindow_NavigationViewItem_Notifications.Content" xml:space="preserve">
2425-
<value>Notifications</value>
2426-
</data>
24272424
<data name="HubWindow_NavigationViewItem_145.Content" xml:space="preserve">
24282425
<value>Diagnostics</value>
24292426
</data>
@@ -5029,12 +5026,6 @@ Commands are blocked while sandboxing is unavailable because strict fallback blo
50295026
<data name="HubWindow_Disconnected.Text" xml:space="preserve">
50305027
<value>Disconnected</value>
50315028
</data>
5032-
<data name="HubWindow_Op.Text" xml:space="preserve">
5033-
<value>Op</value>
5034-
</data>
5035-
<data name="HubWindow_Node.Text" xml:space="preserve">
5036-
<value>Node</value>
5037-
</data>
50385029
<data name="HubWindow_Advanced.Content" xml:space="preserve">
50395030
<value>Advanced</value>
50405031
</data>
@@ -5065,9 +5056,6 @@ Commands are blocked while sandboxing is unavailable because strict fallback blo
50655056
<data name="VoiceSettingsPage_PreviewVoice.Text" xml:space="preserve">
50665057
<value>Preview Voice</value>
50675058
</data>
5068-
<data name="HubWindow_TitleStatus.Text" xml:space="preserve">
5069-
<value>Disconnected</value>
5070-
</data>
50715059
<data name="SandboxPage_GatewayCommandsNote.Text" xml:space="preserve">
50725060
<value>Commands the agent runs directly on the gateway aren't. If the gateway is on this PC they may still be able to reach your Windows files, clipboard, and network — check your gateway's configuration.</value>
50735061
</data> <data name="AgentEventsPage_AllAgents" xml:space="preserve">
@@ -6706,4 +6694,70 @@ Make sure the gateway is running.</value>
67066694
<data name="ConnectionPage_RemoteSetupHelpAuthTitle.Text" xml:space="preserve">
67076695
<value>Auth</value>
67086696
</data>
6697+
<data name="HubWindow_StatusFlyout_Title.Text" xml:space="preserve">
6698+
<value>Connection</value>
6699+
</data>
6700+
<data name="HubWindow_StatusFlyout_OpenConnection.Content" xml:space="preserve">
6701+
<value>Open Connection</value>
6702+
</data>
6703+
<data name="HubWindow_StatusFlyout_GatewayLabel.Text" xml:space="preserve">
6704+
<value>Gateway</value>
6705+
</data>
6706+
<data name="HubWindow_StatusFlyout_Reconnect.Content" xml:space="preserve">
6707+
<value>Reconnect</value>
6708+
</data>
6709+
<data name="HubWindow_StatusFlyout_OperatorLabel.Text" xml:space="preserve">
6710+
<value>Operator</value>
6711+
</data>
6712+
<data name="HubWindow_StatusFlyout_NodeLabel.Text" xml:space="preserve">
6713+
<value>Node</value>
6714+
</data>
6715+
<data name="HubWindow_StatusFlyout_Approve.Content" xml:space="preserve">
6716+
<value>Approve…</value>
6717+
</data>
6718+
<data name="HubWindow_StatusPill_Tooltip" xml:space="preserve">
6719+
<value>Connection status</value>
6720+
</data>
6721+
<data name="HubWindow_Bell_Tooltip" xml:space="preserve">
6722+
<value>Notifications</value>
6723+
</data>
6724+
<data name="HubWindow_Pill_Ready" xml:space="preserve">
6725+
<value>Ready</value>
6726+
</data>
6727+
<data name="HubWindow_Pill_PairingRequired" xml:space="preserve">
6728+
<value>Pairing required</value>
6729+
</data>
6730+
<data name="HubWindow_Pill_Degraded" xml:space="preserve">
6731+
<value>Degraded</value>
6732+
</data>
6733+
<data name="HubWindow_Role_Off" xml:space="preserve">
6734+
<value>Off</value>
6735+
</data>
6736+
<data name="HubWindow_Role_PairingRequired" xml:space="preserve">
6737+
<value>Pairing required</value>
6738+
</data>
6739+
<data name="HubWindow_Role_PairingRejected" xml:space="preserve">
6740+
<value>Pairing rejected</value>
6741+
</data>
6742+
<data name="HubWindow_Role_RateLimited" xml:space="preserve">
6743+
<value>Rate limited</value>
6744+
</data>
6745+
<data name="HubWindow_Role_Disabled" xml:space="preserve">
6746+
<value>Disabled</value>
6747+
</data>
6748+
<data name="NotificationsFlyout_ClearAll.Content" xml:space="preserve">
6749+
<value>Clear all</value>
6750+
</data>
6751+
<data name="NotificationsFlyout_EmptyTitle.Text" xml:space="preserve">
6752+
<value>No notifications</value>
6753+
</data>
6754+
<data name="NotificationsFlyout_OpenPage.Content" xml:space="preserve">
6755+
<value>Open notifications</value>
6756+
</data>
6757+
<data name="NotificationsFlyout_ActiveCountFormat" xml:space="preserve">
6758+
<value>{0} active</value>
6759+
</data>
6760+
<data name="HubWindow_Role_PermissionsIncomplete" xml:space="preserve">
6761+
<value>Permissions incomplete</value>
6762+
</data>
67096763
</root>

‎src/OpenClaw.Tray.WinUI/Strings/fr-fr/Resources.resw‎

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,9 +2376,6 @@ Sur votre hôte passerelle (Mac/Linux), exécutez :
23762376
<data name="HubWindow_NavigationViewItem_145.Content" xml:space="preserve">
23772377
<value>Débogage</value>
23782378
</data>
2379-
<data name="HubWindow_NavigationViewItem_Notifications.Content" xml:space="preserve">
2380-
<value>Alertes</value>
2381-
</data>
23822379
<data name="HubWindow_NavigationViewItem_148.Content" xml:space="preserve">
23832380
<value>Informations</value>
23842381
</data>
@@ -4981,12 +4978,6 @@ Les commandes sont bloquées tant que le sandboxing est indisponible, car le blo
49814978
<data name="HubWindow_Disconnected.Text" xml:space="preserve">
49824979
<value>Déconnecté</value>
49834980
</data>
4984-
<data name="HubWindow_Op.Text" xml:space="preserve">
4985-
<value>Op.</value>
4986-
</data>
4987-
<data name="HubWindow_Node.Text" xml:space="preserve">
4988-
<value>Nœud</value>
4989-
</data>
49904981
<data name="HubWindow_Advanced.Content" xml:space="preserve">
49914982
<value>Avancé</value>
49924983
</data>
@@ -5017,9 +5008,6 @@ Les commandes sont bloquées tant que le sandboxing est indisponible, car le blo
50175008
<data name="VoiceSettingsPage_PreviewVoice.Text" xml:space="preserve">
50185009
<value>Aperçu de la voix</value>
50195010
</data>
5020-
<data name="HubWindow_TitleStatus.Text" xml:space="preserve">
5021-
<value>Déconnecté</value>
5022-
</data>
50235011
<data name="SandboxPage_GatewayCommandsNote.Text" xml:space="preserve">
50245012
<value>Les commandes que l'agent exécute directement sur la passerelle ne le sont pas. Si la passerelle se trouve sur ce PC, elles peuvent toujours accéder à vos fichiers Windows, au presse-papiers et au réseau — vérifiez la configuration de votre passerelle.</value>
50255013
</data> <data name="AgentEventsPage_AllAgents" xml:space="preserve">
@@ -6658,4 +6646,70 @@ Assurez-vous que la passerelle est en cours d'exécution.</value>
66586646
<data name="ConnectionPage_RemoteSetupHelpAuthTitle.Text" xml:space="preserve">
66596647
<value>Authentification</value>
66606648
</data>
6649+
<data name="HubWindow_StatusFlyout_Title.Text" xml:space="preserve">
6650+
<value>Connection</value>
6651+
</data>
6652+
<data name="HubWindow_StatusFlyout_OpenConnection.Content" xml:space="preserve">
6653+
<value>Open Connection</value>
6654+
</data>
6655+
<data name="HubWindow_StatusFlyout_GatewayLabel.Text" xml:space="preserve">
6656+
<value>Gateway</value>
6657+
</data>
6658+
<data name="HubWindow_StatusFlyout_Reconnect.Content" xml:space="preserve">
6659+
<value>Reconnect</value>
6660+
</data>
6661+
<data name="HubWindow_StatusFlyout_OperatorLabel.Text" xml:space="preserve">
6662+
<value>Operator</value>
6663+
</data>
6664+
<data name="HubWindow_StatusFlyout_NodeLabel.Text" xml:space="preserve">
6665+
<value>Node</value>
6666+
</data>
6667+
<data name="HubWindow_StatusFlyout_Approve.Content" xml:space="preserve">
6668+
<value>Approve…</value>
6669+
</data>
6670+
<data name="HubWindow_StatusPill_Tooltip" xml:space="preserve">
6671+
<value>Connection status</value>
6672+
</data>
6673+
<data name="HubWindow_Bell_Tooltip" xml:space="preserve">
6674+
<value>Notifications</value>
6675+
</data>
6676+
<data name="HubWindow_Pill_Ready" xml:space="preserve">
6677+
<value>Ready</value>
6678+
</data>
6679+
<data name="HubWindow_Pill_PairingRequired" xml:space="preserve">
6680+
<value>Pairing required</value>
6681+
</data>
6682+
<data name="HubWindow_Pill_Degraded" xml:space="preserve">
6683+
<value>Degraded</value>
6684+
</data>
6685+
<data name="HubWindow_Role_Off" xml:space="preserve">
6686+
<value>Off</value>
6687+
</data>
6688+
<data name="HubWindow_Role_PairingRequired" xml:space="preserve">
6689+
<value>Pairing required</value>
6690+
</data>
6691+
<data name="HubWindow_Role_PairingRejected" xml:space="preserve">
6692+
<value>Pairing rejected</value>
6693+
</data>
6694+
<data name="HubWindow_Role_RateLimited" xml:space="preserve">
6695+
<value>Rate limited</value>
6696+
</data>
6697+
<data name="HubWindow_Role_Disabled" xml:space="preserve">
6698+
<value>Disabled</value>
6699+
</data>
6700+
<data name="NotificationsFlyout_ClearAll.Content" xml:space="preserve">
6701+
<value>Clear all</value>
6702+
</data>
6703+
<data name="NotificationsFlyout_EmptyTitle.Text" xml:space="preserve">
6704+
<value>No notifications</value>
6705+
</data>
6706+
<data name="NotificationsFlyout_OpenPage.Content" xml:space="preserve">
6707+
<value>Open notifications</value>
6708+
</data>
6709+
<data name="NotificationsFlyout_ActiveCountFormat" xml:space="preserve">
6710+
<value>{0} active</value>
6711+
</data>
6712+
<data name="HubWindow_Role_PermissionsIncomplete" xml:space="preserve">
6713+
<value>Permissions incomplete</value>
6714+
</data>
66616715
</root>

0 commit comments

Comments
 (0)