refactor(ui): migrate MergeModal to ModalShell

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-05-30 16:44:04 +02:00
parent e1bfbb0fa6
commit 8d07fc298c
2 changed files with 68 additions and 117 deletions

View File

@@ -1,6 +1,7 @@
<Window xmlns="https://github.com/avaloniaui" <Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:ClaudeDo.Ui.ViewModels.Modals" xmlns:vm="clr-namespace:ClaudeDo.Ui.ViewModels.Modals"
xmlns:ctl="using:ClaudeDo.Ui.Views.Controls"
x:Class="ClaudeDo.Ui.Views.Modals.MergeModalView" x:Class="ClaudeDo.Ui.Views.Modals.MergeModalView"
x:DataType="vm:MergeModalViewModel" x:DataType="vm:MergeModalViewModel"
Title="Merge worktree" Title="Merge worktree"
@@ -15,49 +16,20 @@
<KeyBinding Gesture="Escape" Command="{Binding CancelCommand}"/> <KeyBinding Gesture="Escape" Command="{Binding CancelCommand}"/>
</Window.KeyBindings> </Window.KeyBindings>
<Window.Styles> <ctl:ModalShell Title="MERGE WORKTREE" CloseCommand="{Binding CancelCommand}">
<Style Selector="TextBlock.field-label"> <ctl:ModalShell.Footer>
<Setter Property="FontSize" Value="11"/> <StackPanel Orientation="Horizontal" Spacing="8"
<Setter Property="Foreground" Value="{DynamicResource TextDimBrush}"/> HorizontalAlignment="Right" VerticalAlignment="Center"
<Setter Property="Margin" Value="0,0,0,4"/> Margin="16,0">
</Style> <Button Content="Cancel" Command="{Binding CancelCommand}" MinWidth="90"/>
<Style Selector="Button.primary"> <Button Content="Merge" Classes="primary"
<Setter Property="Background" Value="{DynamicResource AccentBrush}"/> Command="{Binding SubmitCommand}"
<Setter Property="Foreground" Value="{DynamicResource DeepBrush}"/> IsDefault="True" MinWidth="90"/>
<Setter Property="FontWeight" Value="SemiBold"/> </StackPanel>
</Style> </ctl:ModalShell.Footer>
</Window.Styles>
<Border Background="{DynamicResource SurfaceBrush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="1">
<Grid RowDefinitions="36,*,52">
<!-- Title bar -->
<Border Grid.Row="0"
x:Name="TitleBar"
Background="{DynamicResource DeepBrush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,0,0,1"
PointerPressed="TitleBar_PointerPressed">
<Grid ColumnDefinitions="*,Auto" Margin="14,0">
<TextBlock Text="MERGE WORKTREE"
FontFamily="{DynamicResource MonoFont}"
FontSize="11"
LetterSpacing="1.4"
Foreground="{DynamicResource TextBrush}"
VerticalAlignment="Center"/>
<Button Grid.Column="1"
Classes="icon-btn"
Content="✕"
FontSize="12"
Command="{Binding CancelCommand}"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- Body --> <!-- Body -->
<ScrollViewer Grid.Row="1" Padding="20,16"> <ScrollViewer Padding="20,16">
<StackPanel Spacing="12"> <StackPanel Spacing="12">
<TextBlock Text="{Binding TaskTitle, StringFormat='Merging: {0}'}" <TextBlock Text="{Binding TaskTitle, StringFormat='Merging: {0}'}"
@@ -104,7 +76,7 @@
<DataTemplate> <DataTemplate>
<TextBlock Text="{Binding}" <TextBlock Text="{Binding}"
FontFamily="{DynamicResource MonoFont}" FontFamily="{DynamicResource MonoFont}"
FontSize="11" FontSize="{StaticResource FontSizeMono}"
Foreground="{DynamicResource TextDimBrush}" /> Foreground="{DynamicResource TextDimBrush}" />
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
@@ -118,21 +90,5 @@
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
<!-- Footer --> </ctl:ModalShell>
<Border Grid.Row="2"
Background="{DynamicResource DeepBrush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,1,0,0">
<StackPanel Orientation="Horizontal" Spacing="8"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="16,0">
<Button Content="Cancel" Command="{Binding CancelCommand}" MinWidth="90"/>
<Button Content="Merge" Classes="primary"
Command="{Binding SubmitCommand}"
IsDefault="True" MinWidth="90"/>
</StackPanel>
</Border>
</Grid>
</Border>
</Window> </Window>

View File

@@ -1,5 +1,4 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input;
using ClaudeDo.Ui.ViewModels.Modals; using ClaudeDo.Ui.ViewModels.Modals;
namespace ClaudeDo.Ui.Views.Modals; namespace ClaudeDo.Ui.Views.Modals;
@@ -18,9 +17,5 @@ public partial class MergeModalView : Window
}; };
} }
private void TitleBar_PointerPressed(object? sender, PointerPressedEventArgs e)
{
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
BeginMoveDrag(e);
}
} }