feat(ui): scaffold islands shell and child VMs
This commit is contained in:
@@ -5,6 +5,7 @@ using ClaudeDo.Data.Repositories;
|
||||
using ClaudeDo.Ui;
|
||||
using ClaudeDo.Ui.Services;
|
||||
using ClaudeDo.Ui.ViewModels;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
@@ -100,6 +101,12 @@ sealed class Program
|
||||
() => sp.GetRequiredService<ListEditorViewModel>());
|
||||
});
|
||||
|
||||
// Islands shell VMs
|
||||
sc.AddSingleton<ListsIslandViewModel>();
|
||||
sc.AddSingleton<TasksIslandViewModel>();
|
||||
sc.AddSingleton<DetailsIslandViewModel>();
|
||||
sc.AddSingleton<IslandsShellViewModel>();
|
||||
|
||||
return sc.BuildServiceProvider();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
public sealed partial class DetailsIslandViewModel : ViewModelBase
|
||||
{
|
||||
[ObservableProperty] private TaskRowViewModel? _task;
|
||||
public void Bind(TaskRowViewModel? task) => Task = task;
|
||||
}
|
||||
12
src/ClaudeDo.Ui/ViewModels/Islands/ListNavItemViewModel.cs
Normal file
12
src/ClaudeDo.Ui/ViewModels/Islands/ListNavItemViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
public sealed partial class ListNavItemViewModel : ViewModelBase
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
public required string Name { get; init; }
|
||||
[ObservableProperty] private int _count;
|
||||
[ObservableProperty] private bool _isActive;
|
||||
public string? IconKey { get; init; }
|
||||
}
|
||||
11
src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs
Normal file
11
src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
public sealed partial class ListsIslandViewModel : ViewModelBase
|
||||
{
|
||||
public event EventHandler? SelectionChanged;
|
||||
[ObservableProperty] private ListNavItemViewModel? _selectedList;
|
||||
partial void OnSelectedListChanged(ListNavItemViewModel? value) =>
|
||||
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
10
src/ClaudeDo.Ui/ViewModels/Islands/TaskRowViewModel.cs
Normal file
10
src/ClaudeDo.Ui/ViewModels/Islands/TaskRowViewModel.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
public sealed partial class TaskRowViewModel : ViewModelBase
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
[ObservableProperty] private string _title = "";
|
||||
[ObservableProperty] private bool _done;
|
||||
}
|
||||
12
src/ClaudeDo.Ui/ViewModels/Islands/TasksIslandViewModel.cs
Normal file
12
src/ClaudeDo.Ui/ViewModels/Islands/TasksIslandViewModel.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
public sealed partial class TasksIslandViewModel : ViewModelBase
|
||||
{
|
||||
public event EventHandler? SelectionChanged;
|
||||
[ObservableProperty] private TaskRowViewModel? _selectedTask;
|
||||
public void LoadForList(ListNavItemViewModel? list) { /* Phase 5 */ }
|
||||
partial void OnSelectedTaskChanged(TaskRowViewModel? value) =>
|
||||
SelectionChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
33
src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs
Normal file
33
src/ClaudeDo.Ui/ViewModels/IslandsShellViewModel.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels;
|
||||
|
||||
public sealed partial class IslandsShellViewModel : ViewModelBase
|
||||
{
|
||||
public ListsIslandViewModel Lists { get; }
|
||||
public TasksIslandViewModel Tasks { get; }
|
||||
public DetailsIslandViewModel Details { get; }
|
||||
|
||||
[ObservableProperty]
|
||||
private double _windowWidth = 1280;
|
||||
|
||||
public bool ShowDetails => WindowWidth >= 1100;
|
||||
public bool ShowLists => WindowWidth >= 780;
|
||||
|
||||
partial void OnWindowWidthChanged(double value)
|
||||
{
|
||||
OnPropertyChanged(nameof(ShowDetails));
|
||||
OnPropertyChanged(nameof(ShowLists));
|
||||
}
|
||||
|
||||
public IslandsShellViewModel(
|
||||
ListsIslandViewModel lists,
|
||||
TasksIslandViewModel tasks,
|
||||
DetailsIslandViewModel details)
|
||||
{
|
||||
Lists = lists; Tasks = tasks; Details = details;
|
||||
Lists.SelectionChanged += (_, _) => Tasks.LoadForList(Lists.SelectedList);
|
||||
Tasks.SelectionChanged += (_, _) => Details.Bind(Tasks.SelectedTask);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user