feat(ui): add settings modal and wire to worker hub

This commit is contained in:
Mika Kuns
2026-04-21 15:55:53 +02:00
parent fca5d57fef
commit e6b37624a1
9 changed files with 644 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels.Islands;
namespace ClaudeDo.Ui.ViewModels;
@@ -9,6 +10,14 @@ public sealed partial class IslandsShellViewModel : ViewModelBase
public ListsIslandViewModel Lists { get; }
public TasksIslandViewModel Tasks { get; }
public DetailsIslandViewModel Details { get; }
public WorkerClient Worker { get; }
public string ConnectionText =>
Worker.IsConnected ? "Online"
: Worker.IsReconnecting ? "Connecting…"
: "Offline";
public bool IsOffline => !Worker.IsConnected && !Worker.IsReconnecting;
[ObservableProperty]
private double _windowWidth = 1280;
@@ -37,9 +46,10 @@ public sealed partial class IslandsShellViewModel : ViewModelBase
public IslandsShellViewModel(
ListsIslandViewModel lists,
TasksIslandViewModel tasks,
DetailsIslandViewModel details)
DetailsIslandViewModel details,
WorkerClient worker)
{
Lists = lists; Tasks = tasks; Details = details;
Lists = lists; Tasks = tasks; Details = details; Worker = worker;
Lists.SelectionChanged += (_, _) => Tasks.LoadForList(Lists.SelectedList);
Tasks.SelectionChanged += (_, _) => Details.Bind(Tasks.SelectedTask);
Details.CloseDetail = () => Tasks.SelectedTask = null;
@@ -48,6 +58,14 @@ public sealed partial class IslandsShellViewModel : ViewModelBase
Tasks.LoadForList(Lists.SelectedList);
return System.Threading.Tasks.Task.CompletedTask;
};
Worker.PropertyChanged += (_, e) =>
{
if (e.PropertyName is nameof(WorkerClient.IsConnected) or nameof(WorkerClient.IsReconnecting))
{
OnPropertyChanged(nameof(ConnectionText));
OnPropertyChanged(nameof(IsOffline));
}
};
_ = Lists.LoadAsync();
}
}