refactor(ui): migrate ListSettingsModal 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.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,151 +26,110 @@
|
|||||||
<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}"
|
|
||||||
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>
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- Body -->
|
|
||||||
<ScrollViewer Grid.Row="1" Padding="20,16">
|
|
||||||
<StackPanel Spacing="18">
|
|
||||||
|
|
||||||
<!-- GENERAL -->
|
|
||||||
<StackPanel Spacing="0">
|
|
||||||
<TextBlock Classes="section-label" Text="GENERAL"/>
|
|
||||||
<Border Classes="section">
|
|
||||||
<StackPanel Spacing="12">
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock Classes="field-label" Text="Name"/>
|
|
||||||
<TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock Classes="field-label" Text="Working directory"/>
|
|
||||||
<Grid ColumnDefinitions="*,Auto">
|
|
||||||
<TextBox Grid.Column="0" Text="{Binding WorkingDir}" PlaceholderText="(none)" />
|
|
||||||
<Button Grid.Column="1" Content="Browse..." Margin="8,0,0,0" Click="BrowseClicked" />
|
|
||||||
</Grid>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock Classes="field-label" Text="Default commit type"/>
|
|
||||||
<ComboBox ItemsSource="{Binding CommitTypeOptions}"
|
|
||||||
SelectedItem="{Binding DefaultCommitType, Mode=TwoWay}"
|
|
||||||
HorizontalAlignment="Left" MinWidth="160" />
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<!-- AGENT -->
|
|
||||||
<StackPanel Spacing="0">
|
|
||||||
<Grid ColumnDefinitions="*,Auto" Margin="4,0,0,6">
|
|
||||||
<TextBlock Classes="section-label" Text="AGENT" Margin="0"/>
|
|
||||||
<Button Grid.Column="1" Content="Reset agent settings"
|
|
||||||
Command="{Binding ResetAgentSettingsCommand}" />
|
|
||||||
</Grid>
|
|
||||||
<Border Classes="section">
|
|
||||||
<StackPanel Spacing="12">
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock Classes="field-label" Text="Model"/>
|
|
||||||
<ComboBox ItemsSource="{Binding ModelOptions}"
|
|
||||||
SelectedItem="{Binding SelectedModel, Mode=TwoWay}"
|
|
||||||
HorizontalAlignment="Left" MinWidth="160" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock Classes="field-label" Text="System prompt (appended)"/>
|
|
||||||
<TextBox Text="{Binding SystemPrompt, Mode=TwoWay}"
|
|
||||||
AcceptsReturn="True" TextWrapping="Wrap"
|
|
||||||
MinHeight="80" />
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel Spacing="4">
|
|
||||||
<TextBlock Classes="field-label" Text="Agent file"/>
|
|
||||||
<Grid ColumnDefinitions="*,Auto">
|
|
||||||
<ComboBox Grid.Column="0"
|
|
||||||
ItemsSource="{Binding Agents}"
|
|
||||||
SelectedItem="{Binding SelectedAgent, Mode=TwoWay}"
|
|
||||||
HorizontalAlignment="Stretch">
|
|
||||||
<ComboBox.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<StackPanel>
|
|
||||||
<TextBlock Text="{Binding Name}"
|
|
||||||
Foreground="{DynamicResource TextBrush}"/>
|
|
||||||
<TextBlock Text="{Binding Description}"
|
|
||||||
Foreground="{DynamicResource TextMuteBrush}"
|
|
||||||
FontSize="11" />
|
|
||||||
</StackPanel>
|
|
||||||
</DataTemplate>
|
|
||||||
</ComboBox.ItemTemplate>
|
|
||||||
</ComboBox>
|
|
||||||
<Button Grid.Column="1" Content="Browse..."
|
|
||||||
Margin="8,0,0,0" Click="BrowseAgentClicked" />
|
|
||||||
</Grid>
|
|
||||||
<TextBlock Text="{Binding SelectedAgent.Path}"
|
|
||||||
FontFamily="{DynamicResource MonoFont}"
|
|
||||||
FontSize="11"
|
|
||||||
Foreground="{DynamicResource TextFaintBrush}"
|
|
||||||
TextTrimming="PrefixCharacterEllipsis"
|
|
||||||
IsVisible="{Binding SelectedAgent.Path, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</Grid>
|
||||||
|
</ctl:ModalShell.Footer>
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Body -->
|
||||||
<Border Grid.Row="2"
|
<ScrollViewer Padding="20,16">
|
||||||
Background="{DynamicResource DeepBrush}"
|
<StackPanel Spacing="18">
|
||||||
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>
|
<!-- GENERAL -->
|
||||||
</Border>
|
<StackPanel Spacing="0">
|
||||||
|
<TextBlock Classes="section-label" Text="GENERAL"/>
|
||||||
|
<Border Classes="section">
|
||||||
|
<StackPanel Spacing="12">
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<TextBlock Classes="field-label" Text="Name"/>
|
||||||
|
<TextBox Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<TextBlock Classes="field-label" Text="Working directory"/>
|
||||||
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
|
<TextBox Grid.Column="0" Text="{Binding WorkingDir}" PlaceholderText="(none)" />
|
||||||
|
<Button Grid.Column="1" Content="Browse..." Margin="8,0,0,0" Click="BrowseClicked" />
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<TextBlock Classes="field-label" Text="Default commit type"/>
|
||||||
|
<ComboBox ItemsSource="{Binding CommitTypeOptions}"
|
||||||
|
SelectedItem="{Binding DefaultCommitType, Mode=TwoWay}"
|
||||||
|
HorizontalAlignment="Left" MinWidth="160" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- AGENT -->
|
||||||
|
<StackPanel Spacing="0">
|
||||||
|
<Grid ColumnDefinitions="*,Auto" Margin="4,0,0,6">
|
||||||
|
<TextBlock Classes="section-label" Text="AGENT" Margin="0"/>
|
||||||
|
<Button Grid.Column="1" Content="Reset agent settings"
|
||||||
|
Command="{Binding ResetAgentSettingsCommand}" />
|
||||||
|
</Grid>
|
||||||
|
<Border Classes="section">
|
||||||
|
<StackPanel Spacing="12">
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<TextBlock Classes="field-label" Text="Model"/>
|
||||||
|
<ComboBox ItemsSource="{Binding ModelOptions}"
|
||||||
|
SelectedItem="{Binding SelectedModel, Mode=TwoWay}"
|
||||||
|
HorizontalAlignment="Left" MinWidth="160" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<TextBlock Classes="field-label" Text="System prompt (appended)"/>
|
||||||
|
<TextBox Text="{Binding SystemPrompt, Mode=TwoWay}"
|
||||||
|
AcceptsReturn="True" TextWrapping="Wrap"
|
||||||
|
MinHeight="80" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<TextBlock Classes="field-label" Text="Agent file"/>
|
||||||
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
|
<ComboBox Grid.Column="0"
|
||||||
|
ItemsSource="{Binding Agents}"
|
||||||
|
SelectedItem="{Binding SelectedAgent, Mode=TwoWay}"
|
||||||
|
HorizontalAlignment="Stretch">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Text="{Binding Name}"
|
||||||
|
Foreground="{DynamicResource TextBrush}"/>
|
||||||
|
<TextBlock Text="{Binding Description}"
|
||||||
|
Foreground="{DynamicResource TextMuteBrush}"
|
||||||
|
FontSize="{StaticResource FontSizeMono}" />
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
<Button Grid.Column="1" Content="Browse..."
|
||||||
|
Margin="8,0,0,0" Click="BrowseAgentClicked" />
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Text="{Binding SelectedAgent.Path}"
|
||||||
|
FontFamily="{DynamicResource MonoFont}"
|
||||||
|
FontSize="{StaticResource FontSizeMono}"
|
||||||
|
Foreground="{DynamicResource TextFaintBrush}"
|
||||||
|
TextTrimming="PrefixCharacterEllipsis"
|
||||||
|
IsVisible="{Binding SelectedAgent.Path, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
</ctl:ModalShell>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user