Skip to content

Commit d7a5586

Browse files
committed
ux: re-design Local Changes page
Signed-off-by: leo <longshuang@msn.cn>
1 parent e106840 commit d7a5586

9 files changed

Lines changed: 62 additions & 56 deletions

File tree

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,7 @@
10441044
<x:String x:Key="Text.WorkingCopy.Conflicts.Resolved" xml:space="preserve">FILE CONFLICTS ARE RESOLVED</x:String>
10451045
<x:String x:Key="Text.WorkingCopy.Conflicts.UseMine" xml:space="preserve">USE MINE</x:String>
10461046
<x:String x:Key="Text.WorkingCopy.Conflicts.UseTheirs" xml:space="preserve">USE THEIRS</x:String>
1047+
<x:String x:Key="Text.WorkingCopy.DiscardAll" xml:space="preserve">DISCARD ALL</x:String>
10471048
<x:String x:Key="Text.WorkingCopy.FilterChanges" xml:space="preserve">Filter Changes...</x:String>
10481049
<x:String x:Key="Text.WorkingCopy.IncludeUntracked" xml:space="preserve">INCLUDE UNTRACKED FILES</x:String>
10491050
<x:String x:Key="Text.WorkingCopy.NoCommitHistories" xml:space="preserve">NO RECENT INPUT MESSAGES</x:String>

src/Resources/Locales/zh_CN.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,7 @@
10481048
<x:String x:Key="Text.WorkingCopy.Conflicts.Resolved" xml:space="preserve">文件冲突已解决</x:String>
10491049
<x:String x:Key="Text.WorkingCopy.Conflicts.UseMine" xml:space="preserve">使用 MINE</x:String>
10501050
<x:String x:Key="Text.WorkingCopy.Conflicts.UseTheirs" xml:space="preserve">使用 THEIRS</x:String>
1051+
<x:String x:Key="Text.WorkingCopy.DiscardAll" xml:space="preserve">放弃所有更改</x:String>
10511052
<x:String x:Key="Text.WorkingCopy.FilterChanges" xml:space="preserve">查找变更...</x:String>
10521053
<x:String x:Key="Text.WorkingCopy.IncludeUntracked" xml:space="preserve">显示未跟踪文件</x:String>
10531054
<x:String x:Key="Text.WorkingCopy.NoCommitHistories" xml:space="preserve">没有提交信息记录</x:String>

src/Resources/Locales/zh_TW.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,7 @@
10481048
<x:String x:Key="Text.WorkingCopy.Conflicts.Resolved" xml:space="preserve">檔案衝突已解決</x:String>
10491049
<x:String x:Key="Text.WorkingCopy.Conflicts.UseMine" xml:space="preserve">使用我方版本 (ours)</x:String>
10501050
<x:String x:Key="Text.WorkingCopy.Conflicts.UseTheirs" xml:space="preserve">使用對方版本 (theirs)</x:String>
1051+
<x:String x:Key="Text.WorkingCopy.DiscardAll" xml:space="preserve">捨棄所有變更</x:String>
10511052
<x:String x:Key="Text.WorkingCopy.FilterChanges" xml:space="preserve">搜尋變更...</x:String>
10521053
<x:String x:Key="Text.WorkingCopy.IncludeUntracked" xml:space="preserve">顯示未追蹤檔案</x:String>
10531054
<x:String x:Key="Text.WorkingCopy.NoCommitHistories" xml:space="preserve">沒有提交訊息記錄</x:String>

src/ViewModels/RepositoryCommandPalette.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public RepositoryCommandPalette(Repository repo)
7373
_cmds.Add(new("Push", "push", "Push", async () => await repo.PushAsync(false)));
7474
_cmds.Add(new("Stash.Title", "stash", "Stashes.Add", async () => await repo.StashAllAsync(false)));
7575
_cmds.Add(new("Apply.Title", "apply", "ApplyPatch", () => repo.ApplyPatch()));
76+
_cmds.Add(new("Repository.DiscardAll", "discard", "Undo", () => repo.WorkingCopy.DiscardAllChanges()));
7677

7778
_cmds.Sort((l, r) => l.Label.CompareTo(r.Label));
7879
_visibleCmds = _cmds;

src/Views/Repository.axaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
Background="{DynamicResource Brush.ToolBar}"
2222
BorderThickness="0,0,1,0"
2323
BorderBrush="{DynamicResource Brush.Border0}">
24-
<Grid RowDefinitions="Auto,*,Auto">
24+
<Grid RowDefinitions="Auto,*,Auto,Auto,8">
2525
<ListBox Background="Transparent" SelectedIndex="{Binding SelectedViewIndex, Mode=TwoWay}" SelectionMode="AlwaysSelected">
2626
<ListBox.Styles>
2727
<Style Selector="Path.icon">
@@ -121,7 +121,15 @@
121121
<Button Grid.Row="2"
122122
Classes="icon_button"
123123
Width="40" Height="40"
124-
Margin="4,8"
124+
Margin="4,0"
125+
Click="Cleanup"
126+
ToolTip.Tip="{DynamicResource Text.Repository.Clean}">
127+
<Path Width="18" Height="18" Data="{StaticResource Icons.Clean}"/>
128+
</Button>
129+
<Button Grid.Row="3"
130+
Classes="icon_button"
131+
Width="40" Height="40"
132+
Margin="4,0"
125133
Click="OnOpenConfigure"
126134
ToolTip.Tip="{DynamicResource Text.Repository.Configure}">
127135
<Path Width="18" Height="18" Data="{StaticResource Icons.Settings}"/>

src/Views/Repository.axaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ public Repository()
1212
InitializeComponent();
1313
}
1414

15+
private async void Cleanup(object sender, RoutedEventArgs e)
16+
{
17+
if (DataContext is ViewModels.Repository repo)
18+
{
19+
await repo.CleanupAsync();
20+
e.Handled = true;
21+
}
22+
}
23+
1524
private async void OnOpenConfigure(object sender, RoutedEventArgs e)
1625
{
1726
if (DataContext is ViewModels.Repository repo)

src/Views/RepositoryToolbar.axaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@
102102
<Button Classes="icon_button" Width="32" Margin="12,0,0,0" Click="OpenCustomActionMenu" ToolTip.Tip="{DynamicResource Text.Repository.CustomActions}">
103103
<Path Width="14" Height="14" Data="{StaticResource Icons.Action}"/>
104104
</Button>
105-
106-
<Button Classes="icon_button" Width="32" Margin="12,0,0,0" Click="Cleanup" ToolTip.Tip="{DynamicResource Text.Repository.Clean}">
107-
<Path Width="14" Height="14" Margin="0,1,0,0" Data="{StaticResource Icons.Clean}"/>
108-
</Button>
109105
</StackPanel>
110106

111107
<StackPanel Grid.Column="2" Orientation="Horizontal">

src/Views/RepositoryToolbar.axaml.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -468,15 +468,6 @@ private async void StartBisect(object sender, RoutedEventArgs e)
468468
e.Handled = true;
469469
}
470470

471-
private async void Cleanup(object sender, RoutedEventArgs e)
472-
{
473-
if (DataContext is ViewModels.Repository repo)
474-
{
475-
await repo.CleanupAsync();
476-
e.Handled = true;
477-
}
478-
}
479-
480471
private void OpenCustomActionMenu(object sender, RoutedEventArgs ev)
481472
{
482473
if (DataContext is ViewModels.Repository repo && sender is Control control)

src/Views/WorkingCopy.axaml

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -18,55 +18,45 @@
1818
<!-- Left -->
1919
<Grid Grid.Column="0">
2020
<Grid.RowDefinitions>
21-
<RowDefinition Height="36"/>
21+
<RowDefinition Height="36" MinHeight="36" MaxHeight="36"/>
2222
<RowDefinition Height="*" MinHeight="100"/>
2323
<RowDefinition Height="1"/>
2424
<RowDefinition Height="*" MinHeight="100"/>
25+
<RowDefinition Height="40" MinHeight="40" MaxHeight="40"/>
2526
</Grid.RowDefinitions>
2627

2728
<!-- Search Filter -->
2829
<Border Grid.Row="0" BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}">
29-
<Grid ColumnDefinitions="*,Auto">
30-
<TextBox Grid.Column="0"
31-
x:Name="LocalChangesSearchBox"
32-
Height="24"
33-
Margin="4,0"
34-
BorderThickness="1"
35-
CornerRadius="12"
36-
Text="{Binding Filter, Mode=TwoWay}"
37-
BorderBrush="{DynamicResource Brush.Border2}"
38-
Watermark="{DynamicResource Text.WorkingCopy.FilterChanges}"
39-
VerticalContentAlignment="Center">
40-
<TextBox.InnerLeftContent>
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">
4153
<Path Width="14" Height="14"
42-
Margin="6,0,0,0"
43-
Fill="{DynamicResource Brush.FG2}"
44-
Data="{StaticResource Icons.Search}"/>
45-
</TextBox.InnerLeftContent>
46-
47-
<TextBox.InnerRightContent>
48-
<Button Classes="icon_button"
49-
Width="16"
50-
Margin="0,0,6,0"
51-
Command="{Binding ClearFilter}"
52-
IsVisible="{Binding Filter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
53-
HorizontalAlignment="Right">
54-
<Path Width="14" Height="14"
55-
Margin="0,1,0,0"
56-
Fill="{DynamicResource Brush.FG1}"
57-
Data="{StaticResource Icons.Clear}"/>
58-
</Button>
59-
</TextBox.InnerRightContent>
60-
</TextBox>
61-
62-
<Button Grid.Column="1"
63-
Classes="icon_button"
64-
Width="26" Height="26"
65-
Command="{Binding DiscardAllChanges}"
66-
ToolTip.Tip="{DynamicResource Text.Repository.DiscardAll}">
67-
<Path Width="13" Height="13" Margin="0,1,0,0" Data="{StaticResource Icons.Undo}"/>
68-
</Button>
69-
</Grid>
54+
Margin="0,1,0,0"
55+
Fill="{DynamicResource Brush.FG1}"
56+
Data="{StaticResource Icons.Clear}"/>
57+
</Button>
58+
</TextBox.InnerRightContent>
59+
</TextBox>
7060
</Border>
7161

7262
<!-- Unstaged -->
@@ -203,6 +193,14 @@
203193
ChangeDoubleTapped="OnStagedChangeDoubleTapped"
204194
KeyDown="OnStagedKeyDown"/>
205195
</Grid>
196+
197+
<!-- Bottom -->
198+
<Border Grid.Row="4" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource Brush.Border0}">
199+
<Button Classes="flat"
200+
HorizontalAlignment="Center" VerticalAlignment="Center"
201+
Content="{DynamicResource Text.WorkingCopy.DiscardAll}"
202+
Command="{Binding DiscardAllChanges}"/>
203+
</Border>
206204
</Grid>
207205

208206
<GridSplitter Grid.Column="1"

0 commit comments

Comments
 (0)