feat(ui): TaskRowViewModel with status chip mapping
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ClaudeDo.Data.Models;
|
||||
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
@@ -6,5 +9,37 @@ public sealed partial class TaskRowViewModel : ViewModelBase
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
[ObservableProperty] private string _title = "";
|
||||
[ObservableProperty] private string _listName = "";
|
||||
[ObservableProperty] private bool _done;
|
||||
[ObservableProperty] private bool _isStarred;
|
||||
[ObservableProperty] private bool _isMyDay;
|
||||
[ObservableProperty] private bool _isSelected;
|
||||
[ObservableProperty] private TaskStatus _status;
|
||||
[ObservableProperty] private string? _branch;
|
||||
[ObservableProperty] private string? _diffStat;
|
||||
[ObservableProperty] private string? _liveTail;
|
||||
|
||||
public string StatusChipClass => Status switch
|
||||
{
|
||||
TaskStatus.Running => "running",
|
||||
TaskStatus.Failed => "error",
|
||||
TaskStatus.Done => "review",
|
||||
TaskStatus.Queued => "queued",
|
||||
_ => "idle",
|
||||
};
|
||||
|
||||
partial void OnStatusChanged(TaskStatus value) => OnPropertyChanged(nameof(StatusChipClass));
|
||||
|
||||
public static TaskRowViewModel FromEntity(TaskEntity t) => new()
|
||||
{
|
||||
Id = t.Id,
|
||||
Title = t.Title,
|
||||
ListName = t.List?.Name ?? "",
|
||||
Done = t.Status == TaskStatus.Done,
|
||||
IsStarred = t.IsStarred,
|
||||
IsMyDay = t.IsMyDay,
|
||||
Status = t.Status,
|
||||
Branch = t.Worktree?.BranchName,
|
||||
DiffStat = t.Worktree?.DiffStat,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user