Skip to content

Commit 5f52093

Browse files
committed
ux: hide the row to deal with uncommitted local changes when there are no local changes
Signed-off-by: leo <longshuang@msn.cn>
1 parent 9c15cc9 commit 5f52093

File tree

8 files changed

+40
-36
lines changed

8 files changed

+40
-36
lines changed

src/ViewModels/Checkout.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ public string BranchName
99
get => _branch.Name;
1010
}
1111

12+
public bool HasLocalChanges
13+
{
14+
get => _repo.LocalChangesCount > 0;
15+
}
16+
1217
public Models.DealWithLocalChanges DealWithLocalChanges
1318
{
1419
get;

src/ViewModels/CheckoutAndFastForward.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ public Models.Branch RemoteBranch
1414
get;
1515
}
1616

17+
public bool HasLocalChanges
18+
{
19+
get => _repo.LocalChangesCount > 0;
20+
}
21+
1722
public Models.DealWithLocalChanges DealWithLocalChanges
1823
{
1924
get;

src/ViewModels/CheckoutCommit.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ public Models.Commit Commit
99
get;
1010
}
1111

12+
public bool HasLocalChanges
13+
{
14+
get => _repo.LocalChangesCount > 0;
15+
}
16+
1217
public Models.DealWithLocalChanges DealWithLocalChanges
1318
{
1419
get;

src/ViewModels/Pull.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public Models.Branch SelectedBranch
3838
set => SetProperty(ref _selectedBranch, value, true);
3939
}
4040

41+
public bool HasLocalChanges
42+
{
43+
get => _repo.LocalChangesCount > 0;
44+
}
45+
4146
public Models.DealWithLocalChanges DealWithLocalChanges
4247
{
4348
get;

src/Views/Checkout.axaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919
Text="{DynamicResource Text.Checkout}"/>
2020
</StackPanel>
2121

22-
<Grid Margin="0,16,0,0" ColumnDefinitions="140,*">
23-
<Grid.RowDefinitions>
24-
<RowDefinition Height="32"/>
25-
<RowDefinition Height="Auto" MinHeight="32"/>
26-
</Grid.RowDefinitions>
27-
22+
<Grid Margin="0,16,0,0" RowDefinitions="32,Auto" ColumnDefinitions="140,*">
2823
<TextBlock Grid.Row="0" Grid.Column="0"
2924
HorizontalAlignment="Right" VerticalAlignment="Center"
3025
Margin="0,0,8,0"
@@ -36,13 +31,15 @@
3631

3732
<Border Grid.Row="1" Grid.Column="0"
3833
Height="32"
39-
VerticalAlignment="Top">
34+
VerticalAlignment="Top"
35+
IsVisible="{Binding HasLocalChanges, Mode=OneWay}">
4036
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center"
4137
Margin="0,0,8,0"
4238
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
4339
</Border>
4440
<v:DealWithLocalChangesMethod Grid.Row="1" Grid.Column="1"
45-
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"/>
41+
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"
42+
IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>
4643
</Grid>
4744
</StackPanel>
4845
</UserControl>

src/Views/CheckoutAndFastForward.axaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@
1919
Text="{DynamicResource Text.Checkout.WithFastForward}"/>
2020
</StackPanel>
2121

22-
<Grid Margin="0,16,0,0" ColumnDefinitions="140,*">
23-
<Grid.RowDefinitions>
24-
<RowDefinition Height="32"/>
25-
<RowDefinition Height="32"/>
26-
<RowDefinition Height="Auto" MinHeight="32"/>
27-
</Grid.RowDefinitions>
28-
22+
<Grid Margin="0,16,0,0" RowDefinitions="32,32,Auto" ColumnDefinitions="140,*">
2923
<TextBlock Grid.Row="0" Grid.Column="0"
3024
HorizontalAlignment="Right" VerticalAlignment="Center"
3125
Margin="0,0,8,0"
@@ -58,13 +52,15 @@
5852

5953
<Border Grid.Row="2" Grid.Column="0"
6054
Height="32"
61-
VerticalAlignment="Top">
55+
VerticalAlignment="Top"
56+
IsVisible="{Binding HasLocalChanges, Mode=OneWay}">
6257
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center"
6358
Margin="0,0,8,0"
6459
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
6560
</Border>
6661
<v:DealWithLocalChangesMethod Grid.Row="2" Grid.Column="1"
67-
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"/>
62+
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"
63+
IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>
6864
</Grid>
6965
</StackPanel>
7066
</UserControl>

src/Views/CheckoutCommit.axaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919
Text="{DynamicResource Text.Checkout.Commit}"/>
2020
</StackPanel>
2121

22-
<Grid Margin="0,16,0,0">
23-
<Grid.RowDefinitions>
24-
<RowDefinition Height="32"/>
25-
<RowDefinition Height="Auto" MinHeight="32"/>
26-
<RowDefinition Height="Auto"/>
27-
</Grid.RowDefinitions>
22+
<Grid Margin="0,16,0,0" RowDefinitions="32,Auto,Auto">
2823
<Grid.ColumnDefinitions>
2924
<ColumnDefinition Width="Auto" MinWidth="140"/>
3025
<ColumnDefinition Width="*"/>
@@ -42,13 +37,15 @@
4237

4338
<Border Grid.Row="1" Grid.Column="0"
4439
Height="32"
45-
VerticalAlignment="Top">
40+
VerticalAlignment="Top"
41+
IsVisible="{Binding HasLocalChanges, Mode=OneWay}">
4642
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center"
4743
Margin="0,0,8,0"
4844
Text="{DynamicResource Text.Checkout.LocalChanges}"/>
4945
</Border>
5046
<v:DealWithLocalChangesMethod Grid.Row="1" Grid.Column="1"
51-
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"/>
47+
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"
48+
IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>
5249

5350
<Grid Grid.Row="2" Grid.Column="1" ColumnDefinitions="Auto,*" Margin="0,6,0,0">
5451
<Path Grid.Column="0"

src/Views/Pull.axaml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,7 @@
1919
Text="{DynamicResource Text.Pull.Title}"/>
2020
</StackPanel>
2121

22-
<Grid Margin="0,16,0,0" ColumnDefinitions="140,*">
23-
<Grid.RowDefinitions>
24-
<RowDefinition Height="32"/>
25-
<RowDefinition Height="32"/>
26-
<RowDefinition Height="32"/>
27-
<RowDefinition Height="Auto" MinHeight="32"/>
28-
<RowDefinition Height="32"/>
29-
</Grid.RowDefinitions>
30-
22+
<Grid Margin="0,16,0,0" RowDefinitions="32,32,32,Auto,32" ColumnDefinitions="140,*">
3123
<TextBlock Grid.Row="0" Grid.Column="0"
3224
HorizontalAlignment="Right" VerticalAlignment="Center"
3325
Margin="0,0,8,0"
@@ -81,13 +73,15 @@
8173

8274
<Border Grid.Row="3" Grid.Column="0"
8375
Height="32"
84-
VerticalAlignment="Top">
76+
VerticalAlignment="Top"
77+
IsVisible="{Binding HasLocalChanges, Mode=OneWay}">
8578
<TextBlock HorizontalAlignment="Right" VerticalAlignment="Center"
8679
Margin="0,0,8,0"
8780
Text="{DynamicResource Text.Pull.LocalChanges}"/>
8881
</Border>
8982
<v:DealWithLocalChangesMethod Grid.Row="3" Grid.Column="1"
90-
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"/>
83+
Method="{Binding DealWithLocalChanges, Mode=TwoWay}"
84+
IsVisible="{Binding HasLocalChanges, Mode=OneWay}"/>
9185

9286
<CheckBox Grid.Row="4" Grid.Column="1"
9387
Content="{DynamicResource Text.Pull.UseRebase}"

0 commit comments

Comments
 (0)