refactor(ui): migrate MergeModal to ModalShell
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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,124 +16,79 @@
|
|||||||
<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}"
|
<!-- Body -->
|
||||||
BorderBrush="{DynamicResource LineBrush}"
|
<ScrollViewer Padding="20,16">
|
||||||
BorderThickness="1">
|
<StackPanel Spacing="12">
|
||||||
<Grid RowDefinitions="36,*,52">
|
|
||||||
|
|
||||||
<!-- Title bar -->
|
<TextBlock Text="{Binding TaskTitle, StringFormat='Merging: {0}'}"
|
||||||
<Border Grid.Row="0"
|
FontWeight="SemiBold"
|
||||||
x:Name="TitleBar"
|
Foreground="{DynamicResource TextBrush}" />
|
||||||
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 -->
|
<StackPanel Spacing="4">
|
||||||
<ScrollViewer Grid.Row="1" Padding="20,16">
|
<TextBlock Classes="field-label" Text="Target branch"/>
|
||||||
<StackPanel Spacing="12">
|
<ComboBox ItemsSource="{Binding Branches}"
|
||||||
|
SelectedItem="{Binding SelectedBranch}"
|
||||||
<TextBlock Text="{Binding TaskTitle, StringFormat='Merging: {0}'}"
|
HorizontalAlignment="Stretch"
|
||||||
FontWeight="SemiBold"
|
|
||||||
Foreground="{DynamicResource TextBrush}" />
|
|
||||||
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock Classes="field-label" Text="Target branch"/>
|
|
||||||
<ComboBox ItemsSource="{Binding Branches}"
|
|
||||||
SelectedItem="{Binding SelectedBranch}"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
IsEnabled="{Binding !IsBusy}" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<CheckBox Content="Remove worktree after merge"
|
|
||||||
IsChecked="{Binding RemoveWorktree}"
|
|
||||||
IsEnabled="{Binding !IsBusy}" />
|
IsEnabled="{Binding !IsBusy}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<CheckBox Content="Remove worktree after merge"
|
||||||
|
IsChecked="{Binding RemoveWorktree}"
|
||||||
|
IsEnabled="{Binding !IsBusy}" />
|
||||||
|
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<TextBlock Classes="field-label" Text="Commit message"/>
|
||||||
|
<TextBox Text="{Binding CommitMessage}"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Height="70"
|
||||||
|
IsEnabled="{Binding !IsBusy}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding ErrorMessage}"
|
||||||
|
Foreground="{DynamicResource BloodBrush}"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
IsVisible="{Binding ErrorMessage, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
|
|
||||||
|
<Border BorderBrush="{DynamicResource BloodBrush}"
|
||||||
|
BorderThickness="1"
|
||||||
|
CornerRadius="6"
|
||||||
|
Padding="12,10"
|
||||||
|
IsVisible="{Binding HasConflict}">
|
||||||
<StackPanel Spacing="4">
|
<StackPanel Spacing="4">
|
||||||
<TextBlock Classes="field-label" Text="Commit message"/>
|
<TextBlock Text="Conflicted files:"
|
||||||
<TextBox Text="{Binding CommitMessage}"
|
FontWeight="SemiBold"
|
||||||
AcceptsReturn="True"
|
Foreground="{DynamicResource TextBrush}" />
|
||||||
TextWrapping="Wrap"
|
<ItemsControl ItemsSource="{Binding ConflictFiles}">
|
||||||
Height="70"
|
<ItemsControl.ItemTemplate>
|
||||||
IsEnabled="{Binding !IsBusy}" />
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding}"
|
||||||
|
FontFamily="{DynamicResource MonoFont}"
|
||||||
|
FontSize="{StaticResource FontSizeMono}"
|
||||||
|
Foreground="{DynamicResource TextDimBrush}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<TextBlock Text="{Binding ErrorMessage}"
|
<TextBlock Text="{Binding SuccessMessage}"
|
||||||
Foreground="{DynamicResource BloodBrush}"
|
Foreground="{DynamicResource MossBrightBrush}"
|
||||||
TextWrapping="Wrap"
|
IsVisible="{Binding SuccessMessage, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||||
IsVisible="{Binding ErrorMessage, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
<Border BorderBrush="{DynamicResource BloodBrush}"
|
</ctl:ModalShell>
|
||||||
BorderThickness="1"
|
|
||||||
CornerRadius="6"
|
|
||||||
Padding="12,10"
|
|
||||||
IsVisible="{Binding HasConflict}">
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock Text="Conflicted files:"
|
|
||||||
FontWeight="SemiBold"
|
|
||||||
Foreground="{DynamicResource TextBrush}" />
|
|
||||||
<ItemsControl ItemsSource="{Binding ConflictFiles}">
|
|
||||||
<ItemsControl.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding}"
|
|
||||||
FontFamily="{DynamicResource MonoFont}"
|
|
||||||
FontSize="11"
|
|
||||||
Foreground="{DynamicResource TextDimBrush}" />
|
|
||||||
</DataTemplate>
|
|
||||||
</ItemsControl.ItemTemplate>
|
|
||||||
</ItemsControl>
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<TextBlock Text="{Binding SuccessMessage}"
|
|
||||||
Foreground="{DynamicResource MossBrightBrush}"
|
|
||||||
IsVisible="{Binding SuccessMessage, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
|
||||||
</StackPanel>
|
|
||||||
</ScrollViewer>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<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>
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user