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 ClaudeDo.Data.Models;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
@@ -43,6 +44,16 @@ public partial class TaskItemViewModel : ViewModelBase
public bool IsRunning => Status == TaskStatus.Running; public bool IsRunning => Status == TaskStatus.Running;
public bool CanToggleDone => Status != TaskStatus.Running && Status != TaskStatus.Failed; 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) public void Refresh(TaskEntity entity, IReadOnlyList<TagEntity> tags)
{ {
Entity = entity; Entity = entity;
@@ -56,6 +67,9 @@ public partial class TaskItemViewModel : ViewModelBase
OnPropertyChanged(nameof(IsDone)); OnPropertyChanged(nameof(IsDone));
OnPropertyChanged(nameof(IsRunning)); OnPropertyChanged(nameof(IsRunning));
OnPropertyChanged(nameof(CanToggleDone)); OnPropertyChanged(nameof(CanToggleDone));
OnPropertyChanged(nameof(TitleDecorations));
OnPropertyChanged(nameof(TitleForeground));
OnPropertyChanged(nameof(RowOpacity));
ToggleDoneCommand.NotifyCanExecuteChanged(); ToggleDoneCommand.NotifyCanExecuteChanged();
} }

View File

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