refactor(ui): tokenize and dynamic-ize PlanningDiffView

Convert StaticResource token attrs to DynamicResource, snap font sizes to tokens, replace Consolas,Menlo,monospace with MonoFont DynamicResource, and fold Orange warning color to BloodBrush.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-05-30 16:50:43 +02:00
parent bce4e0a1e6
commit 5fdd9f0b4c

View File

@@ -8,34 +8,34 @@
WindowDecorations="None" WindowDecorations="None"
ExtendClientAreaToDecorationsHint="True" ExtendClientAreaToDecorationsHint="True"
WindowStartupLocation="CenterOwner" WindowStartupLocation="CenterOwner"
Background="{StaticResource SurfaceBrush}"> Background="{DynamicResource SurfaceBrush}">
<Window.KeyBindings> <Window.KeyBindings>
<KeyBinding Gesture="Escape" Command="{Binding CloseCommand}"/> <KeyBinding Gesture="Escape" Command="{Binding CloseCommand}"/>
</Window.KeyBindings> </Window.KeyBindings>
<Border Background="{StaticResource SurfaceBrush}" <Border Background="{DynamicResource SurfaceBrush}"
BorderBrush="{StaticResource LineBrush}" BorderBrush="{DynamicResource LineBrush}"
BorderThickness="1"> BorderThickness="1">
<Grid RowDefinitions="36,Auto,*"> <Grid RowDefinitions="36,Auto,*">
<!-- Title bar / drag handle --> <!-- Title bar / drag handle -->
<Border Grid.Row="0" <Border Grid.Row="0"
x:Name="TitleBar" x:Name="TitleBar"
Background="{StaticResource Surface2Brush}" Background="{DynamicResource Surface2Brush}"
BorderBrush="{StaticResource LineBrush}" BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,0,0,1" BorderThickness="0,0,0,1"
PointerPressed="TitleBar_PointerPressed"> PointerPressed="TitleBar_PointerPressed">
<Grid ColumnDefinitions="*,Auto" Margin="14,0"> <Grid ColumnDefinitions="*,Auto" Margin="14,0">
<TextBlock Text="Planning — Combined diff" <TextBlock Text="Planning — Combined diff"
VerticalAlignment="Center" VerticalAlignment="Center"
FontFamily="{StaticResource MonoFamily}" FontFamily="{DynamicResource MonoFont}"
FontSize="12" FontSize="{StaticResource FontSizeBody}"
Foreground="{StaticResource TextDimBrush}"/> Foreground="{DynamicResource TextDimBrush}"/>
<Button Grid.Column="1" <Button Grid.Column="1"
Classes="icon-btn" Classes="icon-btn"
Content="✕" Content="✕"
FontSize="12" FontSize="{StaticResource FontSizeBody}"
Command="{Binding CloseCommand}" Command="{Binding CloseCommand}"
VerticalAlignment="Center"/> VerticalAlignment="Center"/>
</Grid> </Grid>
@@ -48,7 +48,7 @@
Margin="8,6"> Margin="8,6">
<ToggleButton Content="Preview combined" IsChecked="{Binding IsCombinedMode}"/> <ToggleButton Content="Preview combined" IsChecked="{Binding IsCombinedMode}"/>
<TextBlock Text="{Binding CombinedWarning}" <TextBlock Text="{Binding CombinedWarning}"
Foreground="Orange" Foreground="{DynamicResource BloodBrush}"
VerticalAlignment="Center" VerticalAlignment="Center"
IsVisible="{Binding CombinedWarning, Converter={x:Static ObjectConverters.IsNotNull}}"/> IsVisible="{Binding CombinedWarning, Converter={x:Static ObjectConverters.IsNotNull}}"/>
<TextBlock Text="Loading…" <TextBlock Text="Loading…"
@@ -61,9 +61,9 @@
<!-- Subtask list (left pane) --> <!-- Subtask list (left pane) -->
<Border Grid.Column="0" <Border Grid.Column="0"
BorderBrush="{StaticResource LineBrush}" BorderBrush="{DynamicResource LineBrush}"
BorderThickness="0,0,1,0" BorderThickness="0,0,1,0"
Background="{StaticResource DeepBrush}"> Background="{DynamicResource DeepBrush}">
<ListBox ItemsSource="{Binding Subtasks}" <ListBox ItemsSource="{Binding Subtasks}"
SelectedItem="{Binding SelectedSubtask}" SelectedItem="{Binding SelectedSubtask}"
IsEnabled="{Binding !IsCombinedMode}" IsEnabled="{Binding !IsCombinedMode}"
@@ -79,8 +79,8 @@
TextTrimming="CharacterEllipsis"/> TextTrimming="CharacterEllipsis"/>
<TextBlock Text="{Binding DiffStat}" <TextBlock Text="{Binding DiffStat}"
Opacity="0.7" Opacity="0.7"
FontFamily="{StaticResource MonoFamily}" FontFamily="{DynamicResource MonoFont}"
FontSize="11"/> FontSize="{StaticResource FontSizeMono}"/>
</StackPanel> </StackPanel>
</Border> </Border>
</DataTemplate> </DataTemplate>
@@ -89,14 +89,14 @@
</Border> </Border>
<!-- Diff content (right pane) --> <!-- Diff content (right pane) -->
<Grid Grid.Column="1" Background="{StaticResource VoidBrush}"> <Grid Grid.Column="1" Background="{DynamicResource VoidBrush}">
<ScrollViewer HorizontalScrollBarVisibility="Auto" <ScrollViewer HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"> VerticalScrollBarVisibility="Auto">
<TextBox Text="{Binding DisplayedDiff, Mode=OneWay}" <TextBox Text="{Binding DisplayedDiff, Mode=OneWay}"
IsReadOnly="True" IsReadOnly="True"
AcceptsReturn="True" AcceptsReturn="True"
FontFamily="Consolas,Menlo,monospace" FontFamily="{DynamicResource MonoFont}"
FontSize="12" FontSize="{StaticResource FontSizeBody}"
Background="Transparent" Background="Transparent"
BorderThickness="0" BorderThickness="0"
Padding="8"/> Padding="8"/>