From eccd06e18201681d0cb6123d1592fcc8fad9e3db Mon Sep 17 00:00:00 2001 From: mika kuns Date: Wed, 3 Jun 2026 10:07:09 +0200 Subject: [PATCH] feat(ui): notes mode in the Details island Add IsNotesMode/Notes to DetailsIslandViewModel; ShowNotes() loads today's notes and switches the island body to NotesEditorView via IsVisible toggling. Co-Authored-By: Claude Sonnet 4.6 --- src/ClaudeDo.App/Program.cs | 3 ++- .../Islands/DetailsIslandViewModel.cs | 17 ++++++++++++++++- .../Views/Islands/DetailsIslandView.axaml | 10 ++++++++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/ClaudeDo.App/Program.cs b/src/ClaudeDo.App/Program.cs index 343ea94..ab06ede 100644 --- a/src/ClaudeDo.App/Program.cs +++ b/src/ClaudeDo.App/Program.cs @@ -126,7 +126,8 @@ sealed class Program new DetailsIslandViewModel( sp.GetRequiredService>(), sp.GetRequiredService(), - sp)); + sp, + sp.GetRequiredService())); sc.AddSingleton(); return sc.BuildServiceProvider(); diff --git a/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs index 9e46341..93c0f92 100644 --- a/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs @@ -7,6 +7,7 @@ using ClaudeDo.Data.Models; using ClaudeDo.Data.Repositories; using ClaudeDo.Ui.Helpers; using ClaudeDo.Ui.Services; +using ClaudeDo.Ui.Services.Interfaces; using ClaudeDo.Ui.ViewModels.Modals; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; @@ -49,6 +50,10 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase private readonly IDbContextFactory _dbFactory; private readonly IWorkerClient _worker; private readonly IServiceProvider _services; + private readonly INotesApi _notesApi; + + [ObservableProperty] private bool _isNotesMode; + public NotesEditorViewModel Notes { get; private set; } = null!; // Current task row (set by IslandsShellViewModel via Bind) [ObservableProperty] @@ -233,11 +238,13 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase catch { } } - public DetailsIslandViewModel(IDbContextFactory dbFactory, IWorkerClient worker, IServiceProvider services) + public DetailsIslandViewModel(IDbContextFactory dbFactory, IWorkerClient worker, IServiceProvider services, INotesApi notesApi) { _dbFactory = dbFactory; _worker = worker; _services = services; + _notesApi = notesApi; + Notes = new NotesEditorViewModel(_notesApi); // Subscribe once; filter by current task id inside the handler _worker.TaskMessageEvent += OnTaskMessage; @@ -431,8 +438,16 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase } } + public void ShowNotes() + { + Bind(null); + IsNotesMode = true; + _ = Notes.LoadDayAsync(DateOnly.FromDateTime(DateTime.Today)); + } + public void Bind(TaskRowViewModel? row) { + IsNotesMode = false; _loadCts?.Cancel(); _loadCts?.Dispose(); _loadCts = new CancellationTokenSource(); diff --git a/src/ClaudeDo.Ui/Views/Islands/DetailsIslandView.axaml b/src/ClaudeDo.Ui/Views/Islands/DetailsIslandView.axaml index 16d07da..f320fa4 100644 --- a/src/ClaudeDo.Ui/Views/Islands/DetailsIslandView.axaml +++ b/src/ClaudeDo.Ui/Views/Islands/DetailsIslandView.axaml @@ -126,8 +126,10 @@ - - + + + @@ -293,6 +295,10 @@ + + + +