Skip to content

Commit bc074ec

Browse files
committed
ux: show matched changes count while searching changes in LOCAL CHANGES page (#2703)
Signed-off-by: leo <longshuang@msn.cn>
1 parent 2f9e4ed commit bc074ec

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

‎src/ViewModels/WorkingCopy.cs‎

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,25 +140,51 @@ public string Filter
140140
public List<Models.Change> Unstaged
141141
{
142142
get => _unstaged;
143-
private set => SetProperty(ref _unstaged, value);
143+
private set
144+
{
145+
if (SetProperty(ref _unstaged, value))
146+
OnPropertyChanged(nameof(UnstagedCountInfo));
147+
}
144148
}
145149

146150
public List<Models.Change> VisibleUnstaged
147151
{
148152
get => _visibleUnstaged;
149-
private set => SetProperty(ref _visibleUnstaged, value);
153+
private set
154+
{
155+
if (SetProperty(ref _visibleUnstaged, value))
156+
OnPropertyChanged(nameof(UnstagedCountInfo));
157+
}
150158
}
151159

152160
public List<Models.Change> Staged
153161
{
154162
get => _staged;
155-
private set => SetProperty(ref _staged, value);
163+
private set
164+
{
165+
if (SetProperty(ref _staged, value))
166+
OnPropertyChanged(nameof(StagedCountInfo));
167+
}
156168
}
157169

158170
public List<Models.Change> VisibleStaged
159171
{
160172
get => _visibleStaged;
161-
private set => SetProperty(ref _visibleStaged, value);
173+
private set
174+
{
175+
if (SetProperty(ref _visibleStaged, value))
176+
OnPropertyChanged(nameof(StagedCountInfo));
177+
}
178+
}
179+
180+
public string UnstagedCountInfo
181+
{
182+
get => string.IsNullOrEmpty(_filter) ? $"({_unstaged.Count})" : $"({_visibleUnstaged.Count}/{_unstaged.Count})";
183+
}
184+
185+
public string StagedCountInfo
186+
{
187+
get => string.IsNullOrEmpty(_filter) ? $"({_staged.Count})" : $"({_visibleStaged.Count}/{_staged.Count})";
162188
}
163189

164190
public ChangeSelection SelectedUnstaged

‎src/Views/WorkingCopy.axaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<Path Grid.Column="0" Margin="8,0,0,0" Width="14" Height="14" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Changes}"/>
6868
<TextBlock Grid.Column="1" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold" Margin="4,0,0,0">
6969
<Run Text="{DynamicResource Text.WorkingCopy.Unstaged}"/>
70-
<Run Text="{Binding Unstaged, Converter={x:Static c:ListConverters.ToCount}, Mode=OneWay}"/>
70+
<Run Text="{Binding UnstagedCountInfo, Mode=OneWay}"/>
7171
</TextBlock>
7272
<v:LoadingIcon Grid.Column="2" Width="14" Height="14" Margin="8,0,0,0" IsVisible="{Binding IsStaging}"/>
7373

@@ -154,7 +154,7 @@
154154
<Path Grid.Column="0" Margin="8,0,0,0" Width="14" Height="14" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Changes}"/>
155155
<TextBlock Grid.Column="1" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold" Margin="4,0,0,0">
156156
<Run Text="{DynamicResource Text.WorkingCopy.Staged}"/>
157-
<Run Text="{Binding Staged, Converter={x:Static c:ListConverters.ToCount}, Mode=OneWay}"/>
157+
<Run Text="{Binding StagedCountInfo, Mode=OneWay}"/>
158158
</TextBlock>
159159
<v:LoadingIcon Grid.Column="2" Width="14" Height="14" Margin="8,0,0,0" IsVisible="{Binding IsUnstaging}"/>
160160
<Button Grid.Column="4" Classes="icon_button" Width="26" Height="14" Padding="0" Click="OnUnstageSelectedButtonClicked">

0 commit comments

Comments
 (0)