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 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-03 10:07:09 +02:00
parent 731c291d61
commit eccd06e182
3 changed files with 26 additions and 4 deletions

View File

@@ -126,7 +126,8 @@ sealed class Program
new DetailsIslandViewModel(
sp.GetRequiredService<IDbContextFactory<ClaudeDoDbContext>>(),
sp.GetRequiredService<WorkerClient>(),
sp));
sp,
sp.GetRequiredService<INotesApi>()));
sc.AddSingleton<IslandsShellViewModel>();
return sc.BuildServiceProvider();

View File

@@ -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<ClaudeDoDbContext> _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<ClaudeDoDbContext> dbFactory, IWorkerClient worker, IServiceProvider services)
public DetailsIslandViewModel(IDbContextFactory<ClaudeDoDbContext> 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();

View File

@@ -126,8 +126,10 @@
<!-- ── Agent status strip (sticky, above metadata footer) ── -->
<islands:AgentStripView DockPanel.Dock="Bottom"/>
<!-- ── Scrollable body: steps + terminal ── -->
<ScrollViewer VerticalScrollBarVisibility="Auto">
<!-- ── Body: task details (normal) or notes editor (notes mode) ── -->
<Grid>
<ScrollViewer VerticalScrollBarVisibility="Auto"
IsVisible="{Binding !IsNotesMode}">
<StackPanel Spacing="0">
<!-- Planning merge section — visible only for planning parent tasks -->
@@ -293,6 +295,10 @@
</StackPanel>
</ScrollViewer>
<Panel IsVisible="{Binding IsNotesMode}">
<islands:NotesEditorView DataContext="{Binding Notes}"/>
</Panel>
</Grid>
</DockPanel>
</UserControl>