fix(ui): toggle expand on full folder row click

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-05-19 11:48:07 +02:00
parent 6c8048d0be
commit 232d7cb647
2 changed files with 13 additions and 0 deletions

View File

@@ -59,6 +59,7 @@
<TreeView.ItemTemplate> <TreeView.ItemTemplate>
<TreeDataTemplate DataType="vm:WorktreeNodeViewModel" <TreeDataTemplate DataType="vm:WorktreeNodeViewModel"
ItemsSource="{Binding Children}"> ItemsSource="{Binding Children}">
<Border Background="Transparent" Tapped="OnNodeTapped" Cursor="Hand">
<StackPanel Orientation="Horizontal" Spacing="8"> <StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="{Binding Name}" <TextBlock Text="{Binding Name}"
FontFamily="{DynamicResource MonoFont}" FontSize="12" FontFamily="{DynamicResource MonoFont}" FontSize="12"
@@ -71,6 +72,7 @@
Foreground="{DynamicResource TextBrush}"/> Foreground="{DynamicResource TextBrush}"/>
</Border> </Border>
</StackPanel> </StackPanel>
</Border>
</TreeDataTemplate> </TreeDataTemplate>
</TreeView.ItemTemplate> </TreeView.ItemTemplate>
</TreeView> </TreeView>

View File

@@ -5,6 +5,7 @@ using Avalonia.Controls;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Media; using Avalonia.Media;
using Avalonia.Styling; using Avalonia.Styling;
using Avalonia.VisualTree;
using ClaudeDo.Ui.ViewModels.Modals; using ClaudeDo.Ui.ViewModels.Modals;
namespace ClaudeDo.Ui.Views.Modals; namespace ClaudeDo.Ui.Views.Modals;
@@ -56,6 +57,16 @@ public partial class WorktreeModalView : Window
RenderTransform = new ScaleTransform(1.0, 1.0); RenderTransform = new ScaleTransform(1.0, 1.0);
} }
private void OnNodeTapped(object? sender, Avalonia.Input.TappedEventArgs e)
{
if (sender is not Control c) return;
if (c.DataContext is not WorktreeNodeViewModel node) return;
if (!node.IsDirectory) return;
var tvi = c.FindAncestorOfType<TreeViewItem>();
if (tvi is null) return;
tvi.IsExpanded = !tvi.IsExpanded;
}
private void OnTitleBarPressed(object? sender, PointerPressedEventArgs e) private void OnTitleBarPressed(object? sender, PointerPressedEventArgs e)
{ {
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)