style(ui): add strikethrough and dimming for completed tasks

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Mika Kuns
2026-04-14 10:36:06 +02:00
parent ff5e56a6f0
commit c44aefde77
2 changed files with 17 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
using Avalonia.Media;
using ClaudeDo.Data.Models;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
@@ -43,6 +44,16 @@ public partial class TaskItemViewModel : ViewModelBase
public bool IsRunning => Status == TaskStatus.Running;
public bool CanToggleDone => Status != TaskStatus.Running && Status != TaskStatus.Failed;
public TextDecorationCollection? TitleDecorations => IsDone
? TextDecorations.Strikethrough
: null;
public IBrush TitleForeground => IsDone
? new SolidColorBrush(Color.Parse("#5a6578"))
: new SolidColorBrush(Color.Parse("#e2e8f0"));
public double RowOpacity => IsDone ? 0.6 : 1.0;
public void Refresh(TaskEntity entity, IReadOnlyList<TagEntity> tags)
{
Entity = entity;
@@ -56,6 +67,9 @@ public partial class TaskItemViewModel : ViewModelBase
OnPropertyChanged(nameof(IsDone));
OnPropertyChanged(nameof(IsRunning));
OnPropertyChanged(nameof(CanToggleDone));
OnPropertyChanged(nameof(TitleDecorations));
OnPropertyChanged(nameof(TitleForeground));
OnPropertyChanged(nameof(RowOpacity));
ToggleDoneCommand.NotifyCanExecuteChanged();
}

View File

@@ -33,6 +33,7 @@
<DataTemplate x:DataType="vm:TaskItemViewModel">
<Grid ColumnDefinitions="Auto,*" Margin="4,4"
Background="Transparent"
Opacity="{Binding RowOpacity}"
DoubleTapped="OnTaskItemDoubleTapped"
PointerPressed="OnTaskItemPointerPressed">
<Grid.ContextFlyout>
@@ -75,7 +76,8 @@
<!-- Task content -->
<StackPanel Grid.Column="1" VerticalAlignment="Center">
<TextBlock Text="{Binding Title}" FontWeight="Medium"
Foreground="{StaticResource TextPrimaryBrush}"
Foreground="{Binding TitleForeground}"
TextDecorations="{Binding TitleDecorations}"
TextTrimming="CharacterEllipsis"/>
<TextBlock FontSize="11"
Foreground="{StaticResource TextDimBrush}"