Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/OpenClaw.Tray.WinUI/Helpers/NavOriginLabels.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
namespace OpenClawTray.Helpers;

/// <summary>
/// Maps HubWindow nav tags to localised page labels for cross-page
/// "Back to {origin}" affordances. Reuses the sidebar
/// <c>HubWindow_NavigationViewItem_*.Content</c> resw entries so page names
/// are translated once and stay in sync with the sidebar.
/// </summary>
internal static class NavOriginLabels
{
public static string DisplayLabel(string? tag)
{
if (string.IsNullOrWhiteSpace(tag)) return string.Empty;
var resourceKey = tag switch
{
"chat" => "HubWindow_NavigationViewItem_82.Content",
"connection" => "HubWindow_NavigationViewItem_88.Content",
"sessions" => "HubWindow_NavigationViewItem_91.Content",
"skills" => "HubWindow_NavigationViewItem_97.Content",
"channels" => "HubWindow_NavigationViewItem_109.Content",
"instances" or "nodes" => "HubWindow_NavigationViewItem_112.Content",
"agentevents" => "HubWindow_NavigationViewItem_94.Content",
"bindings" => "HubWindow_NavigationViewItem_115.Content",
"config" => "HubWindow_NavigationViewItem_118.Content",
"usage" => "HubWindow_NavigationViewItem_121.Content",
"cron" => "HubWindow_NavigationViewItem_124.Content",
"voice" => "HubWindow_NavigationViewItem_Voice.Content",
"settings" => "HubWindow_NavigationViewItem_133.Content",
"permissions" => "HubWindow_NavigationViewItem_136.Content",
"sandbox" => "HubWindow_NavigationViewItem_Sandbox.Content",
"debug" => "HubWindow_NavigationViewItem_145.Content",
"info" or "about" => "HubWindow_NavigationViewItem_148.Content",
_ => null,
};
return resourceKey == null
? char.ToUpperInvariant(tag![0]) + tag.Substring(1)
: LocalizationHelper.GetString(resourceKey);
}

public static string BackToLabel(string? tag) =>
LocalizationHelper.Format("BackToOriginFormat", DisplayLabel(tag));
}



2 changes: 1 addition & 1 deletion src/OpenClaw.Tray.WinUI/Pages/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private void OnCheckUpdatesClick(object sender, RoutedEventArgs e)

private void OnMoreDiagnosticsClick(object sender, RoutedEventArgs e)
{
((IAppCommands)CurrentApp).Navigate("debug");
((IAppCommands)CurrentApp).Navigate("debug", "info");
}

private void OnDocumentationClick(object sender, RoutedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion src/OpenClaw.Tray.WinUI/Pages/BindingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void Initialize()
}

private void OnOpenConnectionClick(object sender, RoutedEventArgs e)
=> ((IAppCommands)CurrentApp).Navigate("connection");
=> ((IAppCommands)CurrentApp).Navigate("connection", "bindings");

private void OnAppStateChanged(object? sender, PropertyChangedEventArgs e)
{
Expand Down
4 changes: 2 additions & 2 deletions src/OpenClaw.Tray.WinUI/Pages/ChannelsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ private FrameworkElement BuildInlineConfigForm(ChannelRecord record)
{
Content = "Open Config page",
};
openConfigBtn.Click += (_, _) => ((IAppCommands)CurrentApp).Navigate("config");
openConfigBtn.Click += (_, _) => ((IAppCommands)CurrentApp).Navigate("config", "channels");
actionRow.Children.Add(saveBtn);
actionRow.Children.Add(openConfigBtn);
stack.Children.Add(actionRow);
Expand Down Expand Up @@ -1946,7 +1946,7 @@ private FrameworkElement BuildConfigPlaceholder(ChannelRecord record)
};
btn.Click += (_, _) =>
{
((IAppCommands)CurrentApp).Navigate("config");
((IAppCommands)CurrentApp).Navigate("config", "channels");
};
stack.Children.Add(btn);
return stack;
Expand Down
4 changes: 2 additions & 2 deletions src/OpenClaw.Tray.WinUI/Pages/ChatPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ private void ShowFunctionalSurface()
onStopSpeaking: () => app?.StopChatSpeaking(),
onVoiceRequest: VoiceTranscribeAsync,
onAttachClick: OnAttachClicked,
onSettingsClick: () => _hub?.NavigateTo("voice"),
onSettingsClick: () => _hub?.NavigateTo("voice", "chat"),
onSpeakerMuteChanged: muted => (App.Current as App)?.SetChatSpeakerMuted(muted),
initialMuted: CurrentApp.Settings?.VoiceTtsEnabled == false,
suppressAutoDispose: true);
Expand Down Expand Up @@ -771,7 +771,7 @@ private async Task ShowVoiceSettingsDialogAsync(string title, string message, Ac
private void NavigateToVoiceSettings()
{
if (_hub is not null)
_hub.NavigateTo("voice");
_hub.NavigateTo("voice", "chat");
else
(App.Current as App)?.ShowHub("voice");
}
Expand Down
16 changes: 14 additions & 2 deletions src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,19 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<!-- Page header -->
<Grid Grid.Row="0" ColumnSpacing="16">
<!-- Page header (with optional back-link when arriving via cross-page nav) -->
<StackPanel Grid.Row="0" Spacing="4">
<HyperlinkButton x:Name="BackOriginLink"
Click="OnBackOriginClicked"
Padding="0" Margin="0"
Visibility="Collapsed"
AutomationProperties.AutomationId="BackOriginLink">
<StackPanel Orientation="Horizontal" Spacing="6">
<FontIcon Glyph="&#xE72B;" FontSize="12"/>
<TextBlock x:Uid="BackToOriginGeneric" x:Name="BackOriginText" Text="Back"/>
</StackPanel>
</HyperlinkButton>
<Grid ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
Expand All @@ -45,6 +56,7 @@
</StackPanel>
</Button>
</Grid>
</StackPanel>

<StackPanel Grid.Row="1" Spacing="8">
<InfoBar x:Name="ConnectionInfoBar"
Expand Down
27 changes: 26 additions & 1 deletion src/OpenClaw.Tray.WinUI/Pages/ConfigPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using OpenClawTray.Controls;
using OpenClawTray.Helpers;
using OpenClawTray.Services;
using OpenClawTray.Windows;
using System;
using System.Collections.Generic;
using System.ComponentModel;
Expand All @@ -34,6 +35,8 @@ public sealed partial class ConfigPage : Page
private ConfigEditorSnapshot _editSnapshot = ConfigEditorSnapshot.Empty;
private IOperatorGatewayClient? _permissionClient;

private string? _backOriginTag;

private string _selectedPath = "";
private string _searchText = "";
private bool _showSchemaFallback;
Expand Down Expand Up @@ -106,6 +109,7 @@ public void Initialize()

_appState = CurrentApp.AppState!;
_appState.PropertyChanged += OnAppStateChanged;
RefreshBackOriginLink();
SubscribePermissionClient(CurrentApp.GatewayClient);
Logger.Info("[ConfigPage] Initialize");
if (CompleteReconnectIfReady())
Expand All @@ -124,6 +128,27 @@ public void Initialize()
}
}

private void RefreshBackOriginLink()
{
var hub = CurrentApp.ActiveHubWindow as HubWindow;
var origin = hub?.LastNavigationOrigin;
if (string.IsNullOrEmpty(origin))
{
_backOriginTag = null;
BackOriginLink.Visibility = Visibility.Collapsed;
return;
}
_backOriginTag = origin;
BackOriginText.Text = NavOriginLabels.BackToLabel(origin);
BackOriginLink.Visibility = Visibility.Visible;
}

private void OnBackOriginClicked(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(_backOriginTag))
((IAppCommands)CurrentApp).Navigate(_backOriginTag);
}

public void UpdateConfig(JsonElement config)
{
var configSnapshot = config.Clone();
Expand Down Expand Up @@ -650,7 +675,7 @@ private void OnResetSection(object sender, RoutedEventArgs e)

private void OnOpenConnection(object sender, RoutedEventArgs e)
{
((IAppCommands)CurrentApp).Navigate("connection");
((IAppCommands)CurrentApp).Navigate("connection", "config");
}

private void OnOpenDashboard(object sender, RoutedEventArgs e)
Expand Down
12 changes: 12 additions & 0 deletions src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@
<StackPanel Padding="24" Spacing="8"
HorizontalAlignment="Stretch" MaxWidth="900">

<!-- Inline "Back to {origin}" link; visible only when arriving via a cross-page link. -->
<HyperlinkButton x:Name="BackOriginLink"
Click="OnBackOriginClicked"
Padding="0" Margin="0,0,0,0"
Visibility="Collapsed"
AutomationProperties.AutomationId="BackOriginLink">
<StackPanel Orientation="Horizontal" Spacing="6">
<FontIcon Glyph="{x:Bind helpers:FluentIconCatalog.Back, Mode=OneTime}" FontSize="12"/>
<TextBlock x:Uid="BackToOriginGeneric" x:Name="BackOriginText" Text="Back"/>
</StackPanel>
</HyperlinkButton>

<!-- ═════════════════════════════════════════════════════════
PINNED MODIFIERS — render across every mode
═════════════════════════════════════════════════════════ -->
Expand Down
25 changes: 25 additions & 0 deletions src/OpenClaw.Tray.WinUI/Pages/ConnectionPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,31 @@ public void Initialize()
UpdatePairingRequests(existingNode);
if (_appState?.DevicePairList is { } existingDevice)
UpdateDevicePairingRequests(existingDevice);

RefreshBackOriginLink();
}

private string? _backOriginTag;

private void RefreshBackOriginLink()
{
var hub = CurrentApp.ActiveHubWindow as OpenClawTray.Windows.HubWindow;
var origin = hub?.LastNavigationOrigin;
if (string.IsNullOrEmpty(origin))
{
_backOriginTag = null;
BackOriginLink.Visibility = Visibility.Collapsed;
return;
}
_backOriginTag = origin;
BackOriginText.Text = Helpers.NavOriginLabels.BackToLabel(origin);
BackOriginLink.Visibility = Visibility.Visible;
}

private void OnBackOriginClicked(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(_backOriginTag))
((IAppCommands)CurrentApp).Navigate(_backOriginTag);
}

private void OnPageUnloaded(object sender, RoutedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion src/OpenClaw.Tray.WinUI/Pages/CronPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void Initialize()
}

private void OnOpenConnectionClick(object sender, RoutedEventArgs e)
=> ((IAppCommands)CurrentApp).Navigate("connection");
=> ((IAppCommands)CurrentApp).Navigate("connection", "cron");

private void OnRefreshClick(object sender, RoutedEventArgs e)
{
Expand Down
12 changes: 12 additions & 0 deletions src/OpenClaw.Tray.WinUI/Pages/DebugPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@
Padding="24,24,24,24"
Spacing="{StaticResource DiagSettingsCardSpacing}">

<!-- Inline "Back to {origin}" link; visible only when arriving via a cross-page link. -->
<HyperlinkButton x:Name="BackOriginLink"
Click="OnBackOriginClicked"
Padding="0" Margin="0,0,0,4"
Visibility="Collapsed"
AutomationProperties.AutomationId="BackOriginLink">
<StackPanel Orientation="Horizontal" Spacing="6">
<FontIcon Glyph="{x:Bind helpers:FluentIconCatalog.Back, Mode=OneTime}" FontSize="12"/>
<TextBlock x:Uid="BackToOriginGeneric" x:Name="BackOriginText" Text="Back"/>
</StackPanel>
</HyperlinkButton>

<!-- Title block (in-stack, same column as cards). -->
<TextBlock x:Uid="DiagnosticsPage_Title"
Text="Diagnostics"
Expand Down
26 changes: 25 additions & 1 deletion src/OpenClaw.Tray.WinUI/Pages/DebugPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,35 @@ public void Initialize()
// the top InfoBar updates without waiting for a Status flip
// (per docs/DATA_FLOW_ARCHITECTURE.md reactive-by-default ethos).
CurrentApp.SettingsChanged += OnSettingsChanged;
RefreshBackOriginLink();
UpdateStatusInfoBar();
LoadDeviceIdentity();
LoadChatSurfaceOverrides();
}

private string? _backOriginTag;

private void RefreshBackOriginLink()
{
var hub = CurrentApp.ActiveHubWindow as HubWindow;
var origin = hub?.LastNavigationOrigin;
if (string.IsNullOrEmpty(origin))
{
_backOriginTag = null;
BackOriginLink.Visibility = Visibility.Collapsed;
return;
}
_backOriginTag = origin;
BackOriginText.Text = NavOriginLabels.BackToLabel(origin);
BackOriginLink.Visibility = Visibility.Visible;
}

private void OnBackOriginClicked(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(_backOriginTag))
((IAppCommands)CurrentApp).Navigate(_backOriginTag);
}

private void OnAppStateChanged(object? sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
Expand Down Expand Up @@ -177,7 +201,7 @@ private void UpdateStatusInfoBar()
}

private void OnManageOnConnection(object sender, RoutedEventArgs e)
=> ((IAppCommands)CurrentApp).Navigate("connection");
=> ((IAppCommands)CurrentApp).Navigate("connection", "debug");

// ── Detail view (recent log) ─────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion src/OpenClaw.Tray.WinUI/Pages/InstancesPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void UpdatePendingPairBanner()
}

private void OnPendingPairBannerClicked(object sender, RoutedEventArgs e)
=> ((IAppCommands)CurrentApp).Navigate("connection");
=> ((IAppCommands)CurrentApp).Navigate("connection", "instances");

public void UpdateNodes(GatewayNodeInfo[] nodes)
{
Expand Down
2 changes: 1 addition & 1 deletion src/OpenClaw.Tray.WinUI/Pages/PermissionsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ private void UpdateSttEngineHint()

private void OnSttMoreSettingsClick(object sender, RoutedEventArgs e)
{
((IAppCommands)CurrentApp).Navigate("voice");
((IAppCommands)CurrentApp).Navigate("voice", "permissions");
}

// ── Text-to-Speech card ──────────────────────────────────────────
Expand Down
3 changes: 2 additions & 1 deletion src/OpenClaw.Tray.WinUI/Pages/SessionsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ private void OnOpenChat(object sender, RoutedEventArgs e)
{
hub.PendingChatSessionKey = key;
}
((IAppCommands)CurrentApp).Navigate("chat", "sessions");
// No origin tag: opening chat should not surface a "Back to Sessions" link.
((IAppCommands)CurrentApp).Navigate("chat");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/OpenClaw.Tray.WinUI/Pages/UsagePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private void RequestRefresh(IOperatorGatewayClient client)
}

private void OnOpenConnectionClick(object sender, RoutedEventArgs e)
=> ((IAppCommands)CurrentApp).Navigate("connection");
=> ((IAppCommands)CurrentApp).Navigate("connection", "usage");

private void OnAppStateChanged(object? sender, PropertyChangedEventArgs e)
{
Expand Down
12 changes: 12 additions & 0 deletions src/OpenClaw.Tray.WinUI/Pages/VoiceSettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
<Grid HorizontalAlignment="Stretch">
<StackPanel Padding="24" Spacing="8" HorizontalAlignment="Stretch" MaxWidth="900">

<!-- Inline "Back to {origin}" link; visible only when arriving via a cross-page link. -->
<HyperlinkButton x:Name="BackOriginLink"
Click="OnBackOriginClicked"
Padding="0" Margin="0,0,0,-8"
Visibility="Collapsed"
AutomationProperties.AutomationId="BackOriginLink">
<StackPanel Orientation="Horizontal" Spacing="6">
<FontIcon Glyph="&#xE72B;" FontSize="12"/>
<TextBlock x:Uid="BackToOriginGeneric" x:Name="BackOriginText" Text="Back"/>
</StackPanel>
</HyperlinkButton>

<TextBlock x:Uid="VoiceSettingsPage_PageTitle" x:Name="PageTitleText" Text="Voice &amp; Audio" Style="{StaticResource TitleTextBlockStyle}"/>
<TextBlock x:Uid="VoiceSettingsPage_PageDescription" x:Name="PageDescriptionText"
Text="Configure speech-to-text and voice interaction settings. All speech processing runs locally on your device."
Expand Down
Loading
Loading