Replace the three ItemsControl sections (Overdue/Open/Completed) with a single flat Rows collection (HeaderRow | TaskRowViewModel) bound to a ListBox + VirtualizingStackPanel, so the realized container count stays bounded instead of growing with the list (measured: ~7-8 realized containers at any scroll position with 1000 source rows). Group headers become regular row entries, each section is simply omitted from Rows when empty, and the Completed section's Clear-completed action moves onto the header row itself. SectionFor/ReorderAsync/FindNextInSameSection now read a row's section off the nearest preceding HeaderRow in Rows instead of three separate bound collections, and ScrollSelectedIntoView goes through ListBox.ScrollIntoView so it still works for rows outside the realized window. Drag/reorder behavior, grouping/counts, and the Clear-completed button are unchanged. Auto-scroll-while-dragging and the cross-section reorder bug are explicitly out of scope (follow-up tasks).
153 lines
7.6 KiB
XML
153 lines
7.6 KiB
XML
<UserControl xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:ClaudeDo.Ui.ViewModels.Islands"
|
|
xmlns:islands="using:ClaudeDo.Ui.Views.Islands"
|
|
xmlns:uiconverters="using:ClaudeDo.Ui.Converters"
|
|
xmlns:loc="using:ClaudeDo.Ui.Localization"
|
|
x:Class="ClaudeDo.Ui.Views.Islands.TasksIslandView"
|
|
x:DataType="vm:TasksIslandViewModel">
|
|
<DockPanel LastChildFill="True">
|
|
|
|
<!-- Header -->
|
|
<Border DockPanel.Dock="Top" Classes="island-header">
|
|
<Grid ColumnDefinitions="*,Auto">
|
|
<StackPanel Grid.Column="0" Spacing="4">
|
|
<TextBlock Classes="eyebrow" Text="{Binding HeaderEyebrow}"/>
|
|
<TextBlock Classes="display"
|
|
Text="{Binding HeaderTitle}"
|
|
TextTrimming="CharacterEllipsis"/>
|
|
<TextBlock Classes="meta"
|
|
Foreground="{DynamicResource TextMuteBrush}"
|
|
Text="{Binding Subtitle}"
|
|
TextTrimming="CharacterEllipsis"/>
|
|
</StackPanel>
|
|
|
|
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="4"
|
|
VerticalAlignment="Top">
|
|
<Border Classes="kbd" VerticalAlignment="Center" Margin="0,0,6,0"
|
|
IsVisible="{Binding HasStatusPill}">
|
|
<TextBlock Text="{Binding StatusPill}"/>
|
|
</Border>
|
|
<Button Classes="icon-btn" Classes.active="{Binding IsShowingCompleted}"
|
|
Command="{Binding ToggleShowCompletedCommand}"
|
|
ToolTip.Tip="{loc:Tr tasks.showCompletedTip}">
|
|
<PathIcon Width="15" Height="15" Data="{StaticResource Icon.Eye}"/>
|
|
</Button>
|
|
<Button Classes="icon-btn" IsVisible="{Binding IsLetClaudeVisible}"
|
|
Command="{Binding LetClaudeHandleCommand}" ToolTip.Tip="{loc:Tr tasks.letClaudeTip}">
|
|
<PathIcon Width="15" Height="15" Data="{StaticResource Icon.AgentSuggested}"/>
|
|
</Button>
|
|
<Button Classes="icon-btn" IsVisible="{Binding IsQuickClaudeVisible}"
|
|
Command="{Binding OpenQuickClaudeSessionCommand}" ToolTip.Tip="{loc:Tr tasks.quickClaudeTip}">
|
|
<PathIcon Width="15" Height="15" Data="{StaticResource Icon.ArrowOut}"/>
|
|
</Button>
|
|
<Button Classes="icon-btn" IsVisible="{Binding IsMyDayList}"
|
|
Command="{Binding ClearDayCommand}" ToolTip.Tip="{loc:Tr tasks.clearDayTip}">
|
|
<PathIcon Width="15" Height="15" Data="{StaticResource Icon.Broom}"/>
|
|
</Button>
|
|
<Button Classes="icon-btn" IsVisible="{Binding IsMyDayList}"
|
|
Command="{Binding ShowPrepLogCommand}" ToolTip.Tip="{loc:Tr tasks.planMyDayTip}">
|
|
<Viewbox Width="18" Height="18">
|
|
<Path Classes="plan-icon" Data="{StaticResource Icon.PlanDay}"/>
|
|
</Viewbox>
|
|
</Button>
|
|
<Button Classes="icon-btn" Command="{Binding OpenListSettingsCommand}" ToolTip.Tip="{loc:Tr tasks.listSettingsTip}">
|
|
<PathIcon Width="15" Height="15" Data="{StaticResource Icon.Settings}"/>
|
|
</Button>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Add-task row -->
|
|
<Border DockPanel.Dock="Top" Classes="add-task" Margin="16,14,16,8">
|
|
<Grid ColumnDefinitions="Auto,*,Auto">
|
|
<Border Grid.Column="0" Classes="add-task-plus" VerticalAlignment="Center">
|
|
<PathIcon Width="12" Height="12" Data="{StaticResource Icon.Plus}"
|
|
Foreground="{DynamicResource TextFaintBrush}"/>
|
|
</Border>
|
|
<TextBox Grid.Column="1" x:Name="AddTaskBox" Classes="add-task-input"
|
|
PlaceholderText="{loc:Tr tasks.addPlaceholder}"
|
|
Text="{Binding NewTaskTitle, Mode=TwoWay}"
|
|
VerticalAlignment="Center"
|
|
Margin="12,0,0,0">
|
|
<TextBox.KeyBindings>
|
|
<KeyBinding Gesture="Enter" Command="{Binding AddCommand}"/>
|
|
</TextBox.KeyBindings>
|
|
</TextBox>
|
|
<Border Grid.Column="2" Classes="kbd kbd-enter" VerticalAlignment="Center"
|
|
IsVisible="{Binding #AddTaskBox.IsFocused}">
|
|
<TextBlock Text="{loc:Tr tasks.enterKey}"/>
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Notes pinned row (My Day only) -->
|
|
<Button DockPanel.Dock="Top"
|
|
Classes="btn" HorizontalAlignment="Stretch" HorizontalContentAlignment="Left"
|
|
Margin="16,0,16,8"
|
|
IsVisible="{Binding ShowNotesRow}"
|
|
Command="{Binding OpenNotesCommand}"
|
|
Content="{loc:Tr tasks.notesPinnedRow}"/>
|
|
|
|
<!-- Task list: one flat, virtualized ListBox. Rows is HeaderRow | TaskRowViewModel — group
|
|
headers are regular entries, not a separate ItemsControl per section, so a
|
|
VirtualizingStackPanel actually bounds the realized container count. -->
|
|
<ListBox x:Name="RowsListBox"
|
|
ItemsSource="{Binding Rows}"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
Padding="10,4">
|
|
<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<VirtualizingStackPanel/>
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>
|
|
<ListBox.Styles>
|
|
<!-- SelectedItem is never bound — selection is handled entirely by the inner row Button's
|
|
SelectCommand, mirroring the pre-virtualization ItemsControl. Avalonia's ListBox has
|
|
no "no selection" mode, so neutralize the app-wide selected/pointerover
|
|
ContentPresenter overlay (App.axaml) instead of letting it double up with
|
|
TaskRowView's own hover/selected style. -->
|
|
<Style Selector="ListBoxItem">
|
|
<Setter Property="Padding" Value="0"/>
|
|
<Setter Property="MinHeight" Value="0"/>
|
|
<Setter Property="CornerRadius" Value="0"/>
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
|
<Setter Property="Focusable" Value="{Binding Converter={x:Static uiconverters:NotHeaderRowConverter.Instance}}"/>
|
|
</Style>
|
|
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
</Style>
|
|
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
</Style>
|
|
</ListBox.Styles>
|
|
<ListBox.DataTemplates>
|
|
<DataTemplate DataType="vm:HeaderRow">
|
|
<Grid ColumnDefinitions="*,Auto" Margin="14,14,14,6">
|
|
<TextBlock Grid.Column="0" Classes="eyebrow section-label"
|
|
Classes.overdue="{Binding IsOverdue}"
|
|
Text="{Binding Label}" VerticalAlignment="Center"/>
|
|
<Button Grid.Column="1" Classes="icon-btn" IsVisible="{Binding HasAction}"
|
|
Command="{Binding ActionCommand}"
|
|
ToolTip.Tip="{loc:Tr tasks.clearCompletedTip}"
|
|
VerticalAlignment="Center">
|
|
<PathIcon Data="{StaticResource Icon.Trash}" Width="13" Height="13"
|
|
Foreground="{DynamicResource BloodBrush}"/>
|
|
</Button>
|
|
</Grid>
|
|
</DataTemplate>
|
|
<DataTemplate DataType="vm:TaskRowViewModel">
|
|
<Button Classes="flat" HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Stretch"
|
|
Command="{Binding $parent[ListBox].((vm:TasksIslandViewModel)DataContext).SelectCommand}"
|
|
CommandParameter="{Binding}">
|
|
<islands:TaskRowView/>
|
|
</Button>
|
|
</DataTemplate>
|
|
</ListBox.DataTemplates>
|
|
</ListBox>
|
|
|
|
</DockPanel>
|
|
</UserControl>
|