Files
ClaudeDo/src/ClaudeDo.Ui/Views/TaskDetailView.axaml
Mika Kuns 9a407bde83 feat(ui): agent config inline in detail panel, file picker, subtask UI
TaskDetailView now edits Model / SystemPrompt / Agent inline (LostFocus
save), matching the modal editor. Both TaskEditorView and TaskDetailView
gain a Browse button that opens a .md file picker — external agent
paths are preserved on reload via a synthetic AgentInfo entry. Both
views also render the per-task subtask checklist (CheckBox + TextBox +
remove), with diff-on-save in the editor and inline-save in the detail
panel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 11:20:17 +02:00

226 lines
14 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:ClaudeDo.Ui.ViewModels"
xmlns:conv="using:ClaudeDo.Ui.Converters"
xmlns:m="using:ClaudeDo.Data.Models"
x:Class="ClaudeDo.Ui.Views.TaskDetailView"
x:DataType="vm:TaskDetailViewModel">
<ScrollViewer>
<StackPanel Margin="12" Spacing="8"
IsVisible="{Binding Title, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
<!-- Title (large, editable) -->
<TextBox x:Name="TitleBox"
Text="{Binding Title}"
FontWeight="Bold" FontSize="16"
Foreground="{StaticResource TextPrimaryBrush}"
BorderThickness="0" Background="Transparent"
Padding="0,4"
LostFocus="OnFieldLostFocus"/>
<!-- Status + Commit Type row -->
<Grid ColumnDefinitions="*,16,*" Margin="0,4,0,0">
<StackPanel Grid.Column="0" Spacing="4">
<TextBlock Text="Status" FontSize="12" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}"/>
<ComboBox ItemsSource="{Binding StatusChoices}"
SelectedItem="{Binding StatusChoice}"
MinWidth="100"
LostFocus="OnFieldLostFocus"/>
</StackPanel>
<StackPanel Grid.Column="2" Spacing="4">
<TextBlock Text="Commit Type" FontSize="12" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}"/>
<ComboBox ItemsSource="{Binding CommitTypes}"
SelectedItem="{Binding CommitType}"
MinWidth="100"
LostFocus="OnFieldLostFocus"/>
</StackPanel>
</Grid>
<!-- Tags -->
<StackPanel Spacing="4" Margin="0,8,0,0">
<TextBlock Text="Tags" FontSize="12" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}"/>
<WrapPanel Orientation="Horizontal">
<ItemsControl ItemsSource="{Binding Tags}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="m:TagEntity">
<Border CornerRadius="10" Padding="8,3" Margin="0,0,4,4"
Background="{StaticResource AccentSubtleBrush}">
<StackPanel Orientation="Horizontal" Spacing="4">
<TextBlock Text="{Binding Name}" FontSize="12"
Foreground="{StaticResource AccentLightBrush}"
VerticalAlignment="Center"/>
<Button Content="x" FontSize="10" Padding="2,0"
Background="Transparent" BorderThickness="0"
Foreground="{StaticResource TextMutedBrush}"
Cursor="Hand"
Command="{Binding $parent[UserControl].((vm:TaskDetailViewModel)DataContext).RemoveTagCommand}"
CommandParameter="{Binding}"/>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBox Text="{Binding NewTagInput}"
PlaceholderText="Add tag..."
Width="100" FontSize="12"
BorderThickness="0" Background="Transparent"
Padding="4,3"
KeyDown="OnTagInputKeyDown"/>
</WrapPanel>
</StackPanel>
<!-- Description (editable) -->
<TextBlock Text="Description" FontSize="12" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,8,0,2"/>
<TextBox Text="{Binding Description}"
AcceptsReturn="True" TextWrapping="Wrap" MinHeight="60"
Foreground="{StaticResource TextPrimaryBrush}"
PlaceholderText="Add a description..."
LostFocus="OnFieldLostFocus"/>
<!-- Sub-Tasks -->
<Border Height="1" Background="{StaticResource BorderSubtleBrush}" Margin="0,8,0,4"/>
<TextBlock Text="Sub-Tasks" FontWeight="Bold" FontSize="13"
Foreground="{StaticResource TextPrimaryBrush}"/>
<ItemsControl ItemsSource="{Binding Subtasks}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:SubtaskItemViewModel">
<StackPanel Orientation="Horizontal" Spacing="6" Margin="0,2,0,2">
<CheckBox IsChecked="{Binding Completed}" VerticalAlignment="Center"/>
<TextBox Text="{Binding Title}" PlaceholderText="Subtask title..." Width="220"
VerticalAlignment="Center"
LostFocus="OnSubtaskTitleLostFocus"/>
<Button Content="✕" Padding="6,2"
Background="Transparent" BorderThickness="0"
Foreground="{StaticResource TextMutedBrush}"
Command="{Binding $parent[UserControl].((vm:TaskDetailViewModel)DataContext).RemoveSubtaskCommand}"
CommandParameter="{Binding}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Button Content="+ Add Sub-Task" Command="{Binding AddSubtaskCommand}"
Background="Transparent" BorderThickness="0"
Foreground="{StaticResource AccentLightBrush}" HorizontalAlignment="Left"/>
<!-- Agent Config (overrides) -->
<Border Height="1" Background="{StaticResource BorderSubtleBrush}" Margin="0,8,0,4"/>
<TextBlock Text="Agent Config (overrides)" FontWeight="Bold" FontSize="13"
Foreground="{StaticResource TextPrimaryBrush}"/>
<Grid ColumnDefinitions="*,12,*" Margin="0,4,0,0">
<StackPanel Grid.Column="0" Spacing="4">
<TextBlock Text="Model" FontSize="12" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}"/>
<ComboBox ItemsSource="{Binding ModelChoices}"
SelectedItem="{Binding ModelChoice}"
MinWidth="100"
LostFocus="OnFieldLostFocus"/>
</StackPanel>
<StackPanel Grid.Column="2" Spacing="4">
<TextBlock Text="Agent File" FontSize="12" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}"/>
<StackPanel Orientation="Horizontal" Spacing="4">
<ComboBox ItemsSource="{Binding AvailableAgents}"
SelectedItem="{Binding SelectedAgent}"
MinWidth="100"
LostFocus="OnFieldLostFocus">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="m:AgentInfo">
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Content="…" Click="OnBrowseAgent" ToolTip.Tip="Browse for agent .md file"/>
</StackPanel>
</StackPanel>
</Grid>
<TextBlock Text="System Prompt" FontSize="12" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,4,0,2"/>
<TextBox Text="{Binding SystemPromptOverride}"
PlaceholderText="(inherits from list)"
AcceptsReturn="True" TextWrapping="Wrap" MinHeight="50"
LostFocus="OnFieldLostFocus"/>
<!-- === READ-ONLY ZONE === -->
<TextBlock Text="Result" FontWeight="SemiBold" FontSize="12"
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,12,0,2"/>
<TextBox Text="{Binding Result, Mode=OneWay}" IsReadOnly="True"
AcceptsReturn="True" TextWrapping="Wrap" MinHeight="60"
IsVisible="{Binding Result, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
<TextBlock Text="(no result yet)" Foreground="{StaticResource TextMutedBrush}" FontStyle="Italic"
IsVisible="{Binding Result, Converter={x:Static StringConverters.IsNullOrEmpty}}"/>
<StackPanel Orientation="Horizontal" Spacing="4"
IsVisible="{Binding LogPath, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
<TextBlock Text="Log:" FontWeight="SemiBold" FontSize="12"
Foreground="{StaticResource TextSecondaryBrush}" VerticalAlignment="Center"/>
<TextBlock Text="{Binding LogPath}" FontSize="11"
Foreground="{StaticResource TextDimBrush}" VerticalAlignment="Center"/>
</StackPanel>
<TextBlock Text="Live Output" FontWeight="SemiBold" FontSize="12"
Foreground="{StaticResource TextSecondaryBrush}" Margin="0,8,0,2"/>
<TextBox x:Name="LiveOutputBox"
Text="{Binding LiveText, Mode=OneWay}"
IsReadOnly="True"
AcceptsReturn="True"
TextWrapping="NoWrap"
FontFamily="Consolas,Courier New,monospace"
FontSize="11"
MaxHeight="300"
Foreground="{StaticResource TextPrimaryBrush}"
BorderBrush="{StaticResource BorderSubtleBrush}"
BorderThickness="1"
CornerRadius="6"
Padding="6"/>
<Border IsVisible="{Binding HasWorktree}" BorderBrush="{StaticResource AccentBrush}"
BorderThickness="1" CornerRadius="8" Padding="10" Margin="0,8,0,0">
<StackPanel Spacing="6">
<TextBlock Text="Worktree" FontWeight="Bold" FontSize="14"
Foreground="{StaticResource TextPrimaryBrush}"/>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="Branch:" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Text="{Binding BranchName}" FontFamily="Consolas,Courier New,monospace"
Foreground="{StaticResource TextPrimaryBrush}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="State:" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}"/>
<TextBlock Text="{Binding WorktreeState}"
Foreground="{StaticResource TextPrimaryBrush}"/>
</StackPanel>
<TextBlock Text="Diff Stat:" FontWeight="SemiBold"
Foreground="{StaticResource TextSecondaryBrush}"
IsVisible="{Binding DiffStat, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
<TextBox Text="{Binding DiffStat, Mode=OneWay}" IsReadOnly="True"
AcceptsReturn="True" FontFamily="Consolas,Courier New,monospace" FontSize="11"
IsVisible="{Binding DiffStat, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
<WrapPanel Orientation="Horizontal" Margin="0,4,0,0">
<Button Content="Open Worktree" Command="{Binding OpenWorktreeCommand}" Margin="0,0,4,4"/>
<Button Content="Show Diff" Command="{Binding ShowDiffCommand}" Margin="0,0,4,4"/>
<Button Content="Merge into main" Command="{Binding MergeIntoMainCommand}"
IsEnabled="{Binding CanWorktreeAction}" Margin="0,0,4,4"/>
<Button Content="Keep as branch" Command="{Binding KeepAsBranchCommand}"
IsEnabled="{Binding CanWorktreeAction}" Margin="0,0,4,4"/>
<Button Content="Discard" Command="{Binding DiscardCommand}"
IsEnabled="{Binding CanWorktreeAction}" Margin="0,0,4,4"/>
</WrapPanel>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</UserControl>