feat(ui): reveal a task by id from anywhere
This commit is contained in:
@@ -43,6 +43,9 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
|
||||
// Layer C seam: composition root sets the factory; the dialog service shows the resolver.
|
||||
public Func<string, ClaudeDo.Ui.ViewModels.Conflicts.ConflictResolverViewModel>? ConflictResolverFactory { get; set; }
|
||||
|
||||
// Set by MainWindow so a reveal can bring the main window to the foreground.
|
||||
public Action? BringToFront { get; set; }
|
||||
|
||||
// Single dialog seam (set by MainWindow); propagated to the lists island.
|
||||
private IDialogService? _dialogs;
|
||||
public IDialogService? Dialogs
|
||||
@@ -55,6 +58,33 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RevealTaskAsync(string taskId)
|
||||
{
|
||||
if (Tasks is null || Lists is null) { BringToFront?.Invoke(); return; }
|
||||
|
||||
string? listId = null;
|
||||
if (_dbFactory is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await using var ctx = await _dbFactory.CreateDbContextAsync();
|
||||
var entity = await ctx.Tasks.AsNoTracking().FirstOrDefaultAsync(t => t.Id == taskId);
|
||||
listId = entity?.ListId;
|
||||
}
|
||||
catch { /* best-effort list resolution */ }
|
||||
}
|
||||
|
||||
if (listId is not null)
|
||||
{
|
||||
var navItem = Lists.Items.FirstOrDefault(i => i.Id == $"user:{listId}");
|
||||
if (navItem is not null && !ReferenceEquals(Lists.SelectedList, navItem))
|
||||
Lists.SelectedList = navItem; // raises SelectionChanged → Tasks.LoadForList
|
||||
}
|
||||
|
||||
await Tasks.SelectByIdAsync(taskId);
|
||||
BringToFront?.Invoke();
|
||||
}
|
||||
|
||||
public async Task RequestConflictResolutionAsync(string taskId, string targetBranch)
|
||||
{
|
||||
if (ConflictResolverFactory is null || Dialogs is null) return;
|
||||
|
||||
Reference in New Issue
Block a user