Extract the unified-diff parser into UnifiedDiffParser and the styled line renderer into a reusable DiffLinesView control. The combined (planning) diff now parses its unified-diff string and renders color-coded rows (green additions / red deletions, file headers) identical to the per-task viewer instead of dumping plain text into a TextBox. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
78 lines
3.1 KiB
XML
78 lines
3.1 KiB
XML
<Window xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:ClaudeDo.Ui.ViewModels.Planning"
|
|
xmlns:ctl="using:ClaudeDo.Ui.Views.Controls"
|
|
xmlns:loc="using:ClaudeDo.Ui.Localization"
|
|
x:Class="ClaudeDo.Ui.Views.Planning.PlanningDiffView"
|
|
x:DataType="vm:PlanningDiffViewModel"
|
|
Title="{loc:Tr planning.diff.windowTitle}"
|
|
Width="1100" Height="700" MinWidth="700" MinHeight="450"
|
|
CanResize="True"
|
|
WindowDecorations="BorderOnly"
|
|
ExtendClientAreaToDecorationsHint="True"
|
|
ExtendClientAreaTitleBarHeightHint="-1"
|
|
WindowStartupLocation="CenterOwner"
|
|
Background="{DynamicResource SurfaceBrush}">
|
|
|
|
<Window.KeyBindings>
|
|
<KeyBinding Gesture="Escape" Command="{Binding CloseCommand}"/>
|
|
</Window.KeyBindings>
|
|
|
|
<ctl:ModalShell Title="{loc:Tr planning.diff.modalTitle}" CloseCommand="{Binding CloseCommand}">
|
|
|
|
<!-- Toolbar row -->
|
|
<DockPanel>
|
|
<StackPanel DockPanel.Dock="Top"
|
|
Orientation="Horizontal"
|
|
Spacing="8"
|
|
Margin="8,6">
|
|
<ToggleButton Content="{loc:Tr planning.diff.previewCombined}" IsChecked="{Binding IsCombinedMode}"/>
|
|
<TextBlock Text="{Binding CombinedWarning}"
|
|
Foreground="{DynamicResource BloodBrush}"
|
|
VerticalAlignment="Center"
|
|
IsVisible="{Binding CombinedWarning, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
|
<TextBlock Text="{loc:Tr planning.diff.loading}"
|
|
VerticalAlignment="Center"
|
|
IsVisible="{Binding IsLoadingCombined}"/>
|
|
</StackPanel>
|
|
|
|
<!-- Two-pane body -->
|
|
<Grid ColumnDefinitions="240,*">
|
|
|
|
<!-- Subtask list (left pane) -->
|
|
<Border Grid.Column="0"
|
|
Classes="sidebar-pane">
|
|
<ListBox ItemsSource="{Binding Subtasks}"
|
|
SelectedItem="{Binding SelectedSubtask}"
|
|
IsEnabled="{Binding !IsCombinedMode}"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate x:DataType="vm:SubtaskDiffRow">
|
|
<Border Padding="10,8" Background="Transparent">
|
|
<StackPanel Spacing="2">
|
|
<TextBlock Classes="title" Text="{Binding Title}"
|
|
TextTrimming="CharacterEllipsis"/>
|
|
<TextBlock Classes="meta" Text="{Binding DiffStat}"/>
|
|
</StackPanel>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</Border>
|
|
|
|
<!-- Diff content (right pane) -->
|
|
<Grid Grid.Column="1" Background="{DynamicResource VoidBrush}">
|
|
<ScrollViewer HorizontalScrollBarVisibility="Auto"
|
|
VerticalScrollBarVisibility="Auto">
|
|
<ctl:DiffLinesView Lines="{Binding DiffLines}"/>
|
|
</ScrollViewer>
|
|
</Grid>
|
|
|
|
</Grid>
|
|
</DockPanel>
|
|
|
|
</ctl:ModalShell>
|
|
</Window>
|