Skip to content

Commit c9fdddc

Browse files
committed
ux: re-design Local Changes view & use the same change view mode for all
Signed-off-by: leo <longshuang@msn.cn>
1 parent 8d959c5 commit c9fdddc

8 files changed

Lines changed: 71 additions & 97 deletions

File tree

‎src/Resources/Styles.axaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@
13731373
HorizontalAlignment="Left"
13741374
VerticalAlignment="Center">
13751375
<Path x:Name="ChevronPath"
1376-
Width="16" Height="16"
1376+
Width="15" Height="15"
13771377
Data="{StaticResource Icons.Sidebar.Expanded}"
13781378
Fill="{DynamicResource Brush.FG1}"
13791379
HorizontalAlignment="Center"

‎src/ViewModels/Preferences.cs‎

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -301,28 +301,10 @@ public bool EnableCompactFoldersInChangesTree
301301
set => SetProperty(ref _enableCompactFoldersInChangesTree, value);
302302
}
303303

304-
public Models.ChangeViewMode UnstagedChangeViewMode
304+
public Models.ChangeViewMode ChangeViewMode
305305
{
306-
get => _unstagedChangeViewMode;
307-
set => SetProperty(ref _unstagedChangeViewMode, value);
308-
}
309-
310-
public Models.ChangeViewMode StagedChangeViewMode
311-
{
312-
get => _stagedChangeViewMode;
313-
set => SetProperty(ref _stagedChangeViewMode, value);
314-
}
315-
316-
public Models.ChangeViewMode CommitChangeViewMode
317-
{
318-
get => _commitChangeViewMode;
319-
set => SetProperty(ref _commitChangeViewMode, value);
320-
}
321-
322-
public Models.ChangeViewMode StashChangeViewMode
323-
{
324-
get => _stashChangeViewMode;
325-
set => SetProperty(ref _stashChangeViewMode, value);
306+
get => _changeViewMode;
307+
set => SetProperty(ref _changeViewMode, value);
326308
}
327309

328310
public string GitInstallPath
@@ -860,11 +842,7 @@ private bool RemoveInvalidRepositoriesRecursive(List<RepositoryNode> collection)
860842
private int _lfsImageActiveIdx = 0;
861843
private int _imageDiffActiveIdx = 0;
862844
private bool _enableCompactFoldersInChangesTree = false;
863-
864-
private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List;
865-
private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List;
866-
private Models.ChangeViewMode _commitChangeViewMode = Models.ChangeViewMode.List;
867-
private Models.ChangeViewMode _stashChangeViewMode = Models.ChangeViewMode.List;
845+
private Models.ChangeViewMode _changeViewMode = Models.ChangeViewMode.List;
868846

869847
private string _gitDefaultCloneDir = string.Empty;
870848
private int _shellOrTerminalType = -1;

‎src/Views/CommitChanges.axaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<v:ChangeViewModeSwitcher Grid.Column="1"
4242
Width="18" Height="18"
4343
Margin="4,0,0,0"
44-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode, Mode=TwoWay}"/>
44+
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode, Mode=TwoWay}"/>
4545
</Grid>
4646

4747
<!-- Changes -->
@@ -53,7 +53,7 @@
5353
<Border CornerRadius="4,4,0,0"
5454
Background="{DynamicResource Brush.Contents}"
5555
ClipToBounds="True">
56-
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode}"
56+
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode}"
5757
EnableCompactFolders="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableCompactFoldersInChangesTree}"
5858
Changes="{Binding VisibleChanges, Mode=OneWay}"
5959
Selection="{Binding ChangeSelection, Mode=TwoWay}"

‎src/Views/Compare.axaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@
172172
<v:ChangeViewModeSwitcher Grid.Column="1"
173173
Width="14" Height="14"
174174
HorizontalAlignment="Right"
175-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode, Mode=TwoWay}"/>
175+
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode, Mode=TwoWay}"/>
176176
</Grid>
177177

178178
<!-- Changes -->
179179
<Border Grid.Row="1" CornerRadius="4,4,0,0" Margin="0,4,0,0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1">
180180
<Border CornerRadius="4,4,0,0" Background="{DynamicResource Brush.Contents}" ClipToBounds="True">
181-
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode}"
181+
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode}"
182182
EnableCompactFolders="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableCompactFoldersInChangesTree}"
183183
Changes="{Binding VisibleChanges, Mode=OneWay}"
184184
Selection="{Binding ChangeSelection, Mode=TwoWay}"

‎src/Views/RevisionCompare.axaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@
102102
<v:ChangeViewModeSwitcher Grid.Column="1"
103103
Width="14" Height="14"
104104
HorizontalAlignment="Right"
105-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode, Mode=TwoWay}"/>
105+
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode, Mode=TwoWay}"/>
106106
</Grid>
107107

108108
<!-- Changes -->
109109
<Border Grid.Row="1" CornerRadius="4,4,0,0" Margin="0,4,0,0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1">
110110
<Border CornerRadius="4,4,0,0" Background="{DynamicResource Brush.Contents}" ClipToBounds="True">
111-
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode}"
111+
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode}"
112112
EnableCompactFolders="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableCompactFoldersInChangesTree}"
113113
Changes="{Binding VisibleChanges, Mode=OneWay}"
114114
Selection="{Binding ChangeSelection, Mode=TwoWay}"

‎src/Views/StashesPage.axaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,13 @@
131131
<v:ChangeViewModeSwitcher Grid.Column="2"
132132
Width="26" Height="14"
133133
Margin="0,1,0,0"
134-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=StashChangeViewMode, Mode=TwoWay}"/>
134+
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode, Mode=TwoWay}"/>
135135
</Grid>
136136
</Border>
137137

138138
<!-- View Changes -->
139139
<Border Grid.Row="4" Background="{DynamicResource Brush.Contents}">
140-
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=StashChangeViewMode, Mode=OneWay}"
140+
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode, Mode=OneWay}"
141141
EnableCompactFolders="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableCompactFoldersInChangesTree}"
142142
Changes="{Binding Changes, Mode=OneWay}"
143143
Selection="{Binding ChangeSelection, Mode=TwoWay}"

‎src/Views/SubmoduleRevisionCompare.axaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@
134134
<v:ChangeViewModeSwitcher Grid.Column="1"
135135
Width="14" Height="14"
136136
HorizontalAlignment="Right"
137-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode, Mode=TwoWay}"/>
137+
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode, Mode=TwoWay}"/>
138138
</Grid>
139139

140140
<!-- Changes -->
141141
<Border Grid.Row="1" Margin="0,4,0,0" BorderBrush="{DynamicResource Brush.Border2}" BorderThickness="1" Background="{DynamicResource Brush.Contents}">
142-
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=CommitChangeViewMode}"
142+
<v:ChangeCollectionView ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode}"
143143
EnableCompactFolders="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableCompactFoldersInChangesTree}"
144144
Changes="{Binding VisibleChanges, Mode=OneWay}"
145145
Selection="{Binding ChangeSelection, Mode=TwoWay}"

‎src/Views/WorkingCopy.axaml‎

Lines changed: 56 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,70 @@
2222
<RowDefinition Height="*" MinHeight="100"/>
2323
<RowDefinition Height="1"/>
2424
<RowDefinition Height="*" MinHeight="100"/>
25-
<RowDefinition Height="40" MinHeight="40" MaxHeight="40"/>
2625
</Grid.RowDefinitions>
2726

2827
<!-- Search Filter -->
2928
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
30-
<TextBox x:Name="LocalChangesSearchBox"
31-
Height="24"
32-
Margin="4,0"
33-
BorderThickness="1"
34-
CornerRadius="12"
35-
Text="{Binding Filter, Mode=TwoWay}"
36-
BorderBrush="{DynamicResource Brush.Border2}"
37-
Watermark="{DynamicResource Text.WorkingCopy.FilterChanges}"
38-
VerticalContentAlignment="Center">
39-
<TextBox.InnerLeftContent>
40-
<Path Width="14" Height="14"
41-
Margin="6,0,0,0"
42-
Fill="{DynamicResource Brush.FG2}"
43-
Data="{StaticResource Icons.Search}"/>
44-
</TextBox.InnerLeftContent>
45-
46-
<TextBox.InnerRightContent>
47-
<Button Classes="icon_button"
48-
Width="16"
49-
Margin="0,0,6,0"
50-
Command="{Binding ClearFilter}"
51-
IsVisible="{Binding Filter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
52-
HorizontalAlignment="Right">
29+
<Grid ColumnDefinitions="Auto,*,Auto,Auto">
30+
<ToggleButton Grid.Column="0"
31+
Classes="sidebar_expander"
32+
Width="32"
33+
VerticalAlignment="Center"
34+
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=Layout.IsSidebarCollapsedInLocalChanges, Mode=TwoWay}"
35+
ToolTip.Placement="RightEdgeAlignedBottom"/>
36+
37+
<TextBox Grid.Column="1"
38+
x:Name="LocalChangesSearchBox"
39+
Height="24"
40+
Margin="4,0"
41+
BorderThickness="1"
42+
CornerRadius="12"
43+
Text="{Binding Filter, Mode=TwoWay}"
44+
BorderBrush="{DynamicResource Brush.Border2}"
45+
Watermark="{DynamicResource Text.WorkingCopy.FilterChanges}"
46+
VerticalContentAlignment="Center">
47+
<TextBox.InnerLeftContent>
5348
<Path Width="14" Height="14"
54-
Margin="0,1,0,0"
55-
Fill="{DynamicResource Brush.FG1}"
56-
Data="{StaticResource Icons.Clear}"/>
57-
</Button>
58-
</TextBox.InnerRightContent>
59-
</TextBox>
49+
Margin="6,0,0,0"
50+
Fill="{DynamicResource Brush.FG2}"
51+
Data="{StaticResource Icons.Search}"/>
52+
</TextBox.InnerLeftContent>
53+
54+
<TextBox.InnerRightContent>
55+
<Button Classes="icon_button"
56+
Width="16"
57+
Margin="0,0,6,0"
58+
Command="{Binding ClearFilter}"
59+
IsVisible="{Binding Filter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
60+
HorizontalAlignment="Right">
61+
<Path Width="14" Height="14"
62+
Margin="0,1,0,0"
63+
Fill="{DynamicResource Brush.FG1}"
64+
Data="{StaticResource Icons.Clear}"/>
65+
</Button>
66+
</TextBox.InnerRightContent>
67+
</TextBox>
68+
69+
<Button Grid.Column="2"
70+
Classes="icon_button"
71+
VerticalAlignment="Center"
72+
Command="{Binding DiscardAllChanges}"
73+
ToolTip.Tip="{DynamicResource Text.WorkingCopy.DiscardAll}">
74+
<Path Width="14" Height="14" Data="{StaticResource Icons.Undo}"/>
75+
</Button>
76+
77+
<v:ChangeViewModeSwitcher Grid.Column="3"
78+
Width="26"
79+
VerticalAlignment="Center"
80+
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode, Mode=TwoWay}"/>
81+
</Grid>
6082
</Border>
6183

6284
<!-- Unstaged -->
6385
<Grid Grid.Row="1" RowDefinitions="28,*">
6486
<!-- Unstaged Toolbar -->
6587
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
66-
<Grid ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto,Auto,Auto,Auto,Auto">
88+
<Grid ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto,Auto,Auto,Auto">
6789
<Path Grid.Column="0" Margin="8,0,0,0" Width="14" Height="14" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Changes}"/>
6890
<TextBlock Grid.Column="1" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold" Margin="4,0,0,0">
6991
<Run Text="{DynamicResource Text.WorkingCopy.Unstaged}"/>
@@ -118,10 +140,6 @@
118140
Click="OnStageAllButtonClicked">
119141
<Path Width="14" Height="14" Data="{StaticResource Icons.DoubleDown}"/>
120142
</Button>
121-
<v:ChangeViewModeSwitcher Grid.Column="9"
122-
Width="26" Height="14"
123-
Margin="0,1,0,0"
124-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=UnstagedChangeViewMode, Mode=TwoWay}"/>
125143
</Grid>
126144
</Border>
127145

@@ -130,7 +148,7 @@
130148
x:Name="UnstagedChangesView"
131149
IsUnstagedChange="True"
132150
Background="{DynamicResource Brush.Contents}"
133-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=UnstagedChangeViewMode}"
151+
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode}"
134152
EnableCompactFolders="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableCompactFoldersInChangesTree}"
135153
Changes="{Binding VisibleUnstaged}"
136154
Selection="{Binding SelectedUnstaged, Mode=TwoWay}"
@@ -150,7 +168,7 @@
150168
<Grid Grid.Row="3" RowDefinitions="27,*">
151169
<!-- Staged Toolbar -->
152170
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
153-
<Grid ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto,Auto">
171+
<Grid ColumnDefinitions="Auto,Auto,Auto,*,Auto,Auto">
154172
<Path Grid.Column="0" Margin="8,0,0,0" Width="14" Height="14" Fill="{DynamicResource Brush.FG2}" Data="{StaticResource Icons.Changes}"/>
155173
<TextBlock Grid.Column="1" Foreground="{DynamicResource Brush.FG2}" FontWeight="Bold" Margin="4,0,0,0">
156174
<Run Text="{DynamicResource Text.WorkingCopy.Staged}"/>
@@ -173,10 +191,6 @@
173191
<Button Grid.Column="5" Classes="icon_button" Width="26" Height="14" Padding="0" ToolTip.Tip="{DynamicResource Text.WorkingCopy.Staged.UnstageAll}" Click="OnUnstageAllButtonClicked">
174192
<Path Width="14" Height="14" Data="{StaticResource Icons.DoubleUp}"/>
175193
</Button>
176-
<v:ChangeViewModeSwitcher Grid.Column="6"
177-
Width="26" Height="14"
178-
Margin="0,1,0,0"
179-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=StagedChangeViewMode, Mode=TwoWay}"/>
180194
</Grid>
181195
</Border>
182196

@@ -185,32 +199,14 @@
185199
x:Name="StagedChangesView"
186200
IsUnstagedChange="False"
187201
Background="{DynamicResource Brush.Contents}"
188-
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=StagedChangeViewMode}"
202+
ViewMode="{Binding Source={x:Static vm:Preferences.Instance}, Path=ChangeViewMode}"
189203
EnableCompactFolders="{Binding Source={x:Static vm:Preferences.Instance}, Path=EnableCompactFoldersInChangesTree}"
190204
Changes="{Binding VisibleStaged}"
191205
Selection="{Binding SelectedStaged, Mode=TwoWay}"
192206
ContextRequested="OnStagedContextRequested"
193207
ChangeDoubleTapped="OnStagedChangeDoubleTapped"
194208
KeyDown="OnStagedKeyDown"/>
195209
</Grid>
196-
197-
<!-- Bottom -->
198-
<Border Grid.Row="4" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource Brush.Border0}">
199-
<Grid ColumnDefinitions="Auto,*,Auto">
200-
<ToggleButton Grid.Column="0"
201-
Classes="sidebar_expander"
202-
Width="32" Height="32"
203-
IsChecked="{Binding Source={x:Static vm:Preferences.Instance}, Path=Layout.IsSidebarCollapsedInLocalChanges, Mode=TwoWay}"
204-
ToolTip.Placement="RightEdgeAlignedBottom"/>
205-
206-
<Button Grid.Column="2"
207-
Classes="flat"
208-
Margin="0,0,8,0"
209-
HorizontalAlignment="Center" VerticalAlignment="Center"
210-
Content="{DynamicResource Text.WorkingCopy.DiscardAll}"
211-
Command="{Binding DiscardAllChanges}"/>
212-
</Grid>
213-
</Border>
214210
</Grid>
215211

216212
<GridSplitter Grid.Column="1"

0 commit comments

Comments
 (0)