refactor(ui): migrate ListSettingsModal to ModalShell

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-05-30 16:43:17 +02:00
parent b1006ac7b0
commit e1bfbb0fa6
2 changed files with 102 additions and 161 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.ListSettingsModalView" x:Class="ClaudeDo.Ui.Views.Modals.ListSettingsModalView"
x:DataType="vm:ListSettingsModalViewModel" x:DataType="vm:ListSettingsModalViewModel"
Title="List settings" Title="List settings"
@@ -18,18 +19,6 @@
</Window.KeyBindings> </Window.KeyBindings>
<Window.Styles> <Window.Styles>
<Style Selector="TextBlock.section-label">
<Setter Property="FontFamily" Value="{DynamicResource MonoFont}"/>
<Setter Property="FontSize" Value="10"/>
<Setter Property="LetterSpacing" Value="1.4"/>
<Setter Property="Foreground" Value="{DynamicResource TextFaintBrush}"/>
<Setter Property="Margin" Value="4,0,0,6"/>
</Style>
<Style Selector="TextBlock.field-label">
<Setter Property="FontSize" Value="11"/>
<Setter Property="Foreground" Value="{DynamicResource TextDimBrush}"/>
<Setter Property="Margin" Value="0,0,0,4"/>
</Style>
<Style Selector="Border.section"> <Style Selector="Border.section">
<Setter Property="BorderBrush" Value="{DynamicResource LineBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource LineBrush}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
@@ -37,47 +26,22 @@
<Setter Property="Padding" Value="14"/> <Setter Property="Padding" Value="14"/>
<Setter Property="Background" Value="{DynamicResource DeepBrush}"/> <Setter Property="Background" Value="{DynamicResource DeepBrush}"/>
</Style> </Style>
<Style Selector="Button.primary">
<Setter Property="Background" Value="{DynamicResource AccentBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource DeepBrush}"/>
<Setter Property="FontWeight" Value="SemiBold"/>
</Style>
<Style Selector="Button.danger">
<Setter Property="Background" Value="{DynamicResource BloodBrush}"/>
<Setter Property="Foreground" Value="White"/>
</Style>
</Window.Styles> </Window.Styles>
<Border Background="{DynamicResource SurfaceBrush}" <ctl:ModalShell Title="LIST SETTINGS" CloseCommand="{Binding CancelCommand}">
BorderBrush="{DynamicResource LineBrush}" <ctl:ModalShell.Footer>
BorderThickness="1"> <Grid ColumnDefinitions="Auto,*,Auto" VerticalAlignment="Center" Margin="16,0">
<Grid RowDefinitions="36,*,52"> <Button Grid.Column="0" Content="Delete list" Classes="danger"
Command="{Binding DeleteCommand}" MinWidth="90"/>
<!-- Title bar --> <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8">
<Border Grid.Row="0" <Button Content="Cancel" Command="{Binding CancelCommand}" MinWidth="90"/>
x:Name="TitleBar" <Button Content="Save" Classes="primary" Command="{Binding SaveCommand}" MinWidth="90"/>
Background="{DynamicResource DeepBrush}" </StackPanel>
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,0,0,1"
PointerPressed="TitleBar_PointerPressed">
<Grid ColumnDefinitions="*,Auto" Margin="14,0">
<TextBlock Text="LIST SETTINGS"
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> </Grid>
</Border> </ctl:ModalShell.Footer>
<!-- Body --> <!-- Body -->
<ScrollViewer Grid.Row="1" Padding="20,16"> <ScrollViewer Padding="20,16">
<StackPanel Spacing="18"> <StackPanel Spacing="18">
<!-- GENERAL --> <!-- GENERAL -->
@@ -145,7 +109,7 @@
Foreground="{DynamicResource TextBrush}"/> Foreground="{DynamicResource TextBrush}"/>
<TextBlock Text="{Binding Description}" <TextBlock Text="{Binding Description}"
Foreground="{DynamicResource TextMuteBrush}" Foreground="{DynamicResource TextMuteBrush}"
FontSize="11" /> FontSize="{StaticResource FontSizeMono}" />
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
@@ -155,7 +119,7 @@
</Grid> </Grid>
<TextBlock Text="{Binding SelectedAgent.Path}" <TextBlock Text="{Binding SelectedAgent.Path}"
FontFamily="{DynamicResource MonoFont}" FontFamily="{DynamicResource MonoFont}"
FontSize="11" FontSize="{StaticResource FontSizeMono}"
Foreground="{DynamicResource TextFaintBrush}" Foreground="{DynamicResource TextFaintBrush}"
TextTrimming="PrefixCharacterEllipsis" TextTrimming="PrefixCharacterEllipsis"
IsVisible="{Binding SelectedAgent.Path, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/> IsVisible="{Binding SelectedAgent.Path, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
@@ -167,21 +131,5 @@
</StackPanel> </StackPanel>
</ScrollViewer> </ScrollViewer>
<!-- Footer --> </ctl:ModalShell>
<Border Grid.Row="2"
Background="{DynamicResource DeepBrush}"
BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,1,0,0">
<Grid ColumnDefinitions="Auto,*,Auto" VerticalAlignment="Center" Margin="16,0">
<Button Grid.Column="0" Content="Delete list" Classes="danger"
Command="{Binding DeleteCommand}" MinWidth="90"/>
<StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8">
<Button Content="Cancel" Command="{Binding CancelCommand}" MinWidth="90"/>
<Button Content="Save" Classes="primary" Command="{Binding SaveCommand}" MinWidth="90"/>
</StackPanel>
</Grid>
</Border>
</Grid>
</Border>
</Window> </Window>

View File

@@ -1,5 +1,4 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Platform.Storage; using Avalonia.Platform.Storage;
using ClaudeDo.Data.Models; using ClaudeDo.Data.Models;
@@ -14,12 +13,6 @@ public partial class ListSettingsModalView : Window
InitializeComponent(); InitializeComponent();
} }
private void TitleBar_PointerPressed(object? sender, PointerPressedEventArgs e)
{
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
BeginMoveDrag(e);
}
private async void BrowseAgentClicked(object? sender, RoutedEventArgs e) private async void BrowseAgentClicked(object? sender, RoutedEventArgs e)
{ {
if (DataContext is not ListSettingsModalViewModel vm) return; if (DataContext is not ListSettingsModalViewModel vm) return;