Skip to content

Commit 7262437

Browse files
committed
ux: new style for pushing a new branch to remote
1 parent 9d3a874 commit 7262437

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/ViewModels/Push.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public Models.Branch SelectedLocalBranch
2626
public List<Models.Branch> LocalBranches
2727
{
2828
get;
29-
private set;
3029
}
3130

3231
public List<Models.Remote> Remotes
@@ -157,7 +156,7 @@ public override Task<bool> Sure()
157156
{
158157
_repo.SetWatcherEnabled(false);
159158

160-
var remoteBranchName = _selectedRemoteBranch.Name.Replace(" (new)", "");
159+
var remoteBranchName = _selectedRemoteBranch.Name;
161160
ProgressDescription = $"Push {_selectedLocalBranch.Name} -> {_selectedRemote.Name}/{remoteBranchName} ...";
162161

163162
return Task.Run(() =>
@@ -187,7 +186,7 @@ private void AutoSelectBranchByRemote()
187186
branches.Add(branch);
188187
}
189188

190-
// If selected local branch has upstream branch. Try to find it in current remote branches.
189+
// If selected local branch has upstream. Try to find it in current remote branches.
191190
if (!string.IsNullOrEmpty(_selectedLocalBranch.Upstream))
192191
{
193192
foreach (var branch in branches)
@@ -201,7 +200,7 @@ private void AutoSelectBranchByRemote()
201200
}
202201
}
203202

204-
// Find best remote branch by name.
203+
// Try to find a remote branch with the same name of selected local branch.
205204
foreach (var branch in branches)
206205
{
207206
if (_selectedLocalBranch.Name == branch.Name)
@@ -215,7 +214,7 @@ private void AutoSelectBranchByRemote()
215214
// Add a fake new branch.
216215
var fake = new Models.Branch()
217216
{
218-
Name = $"{_selectedLocalBranch.Name} (new)",
217+
Name = _selectedLocalBranch.Name,
219218
Remote = _selectedRemote.Name,
220219
};
221220
branches.Add(fake);
@@ -226,7 +225,7 @@ private void AutoSelectBranchByRemote()
226225
private readonly Repository _repo = null;
227226
private Models.Branch _selectedLocalBranch = null;
228227
private Models.Remote _selectedRemote = null;
229-
private List<Models.Branch> _remoteBranches = new List<Models.Branch>();
228+
private List<Models.Branch> _remoteBranches = [];
230229
private Models.Branch _selectedRemoteBranch = null;
231230
private bool _isSetTrackOptionVisible = false;
232231
}

src/Views/Push.axaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,15 @@
6565
<DataTemplate x:DataType="{x:Type m:Branch}">
6666
<StackPanel Orientation="Horizontal" Height="20" VerticalAlignment="Center">
6767
<Path Margin="0,0,8,0" Width="14" Height="14" Fill="{DynamicResource Brush.FG1}" Data="{StaticResource Icons.Branch}"/>
68-
<TextBlock Text="{Binding Name}"/>
68+
<TextBlock Text="{Binding Name}" VerticalAlignment="Center"/>
69+
<Border Height="14"
70+
CornerRadius="7"
71+
Margin="4,0,0,0" Padding="6,0"
72+
VerticalAlignment="Center"
73+
Background="Green"
74+
IsVisible="{Binding Head, Converter={x:Static StringConverters.IsNullOrEmpty}}">
75+
<TextBlock Text="NEW" FontSize="9" FontFamily="{DynamicResource Fonts.Monospace}" Foreground="White" VerticalAlignment="Center"/>
76+
</Border>
6977
</StackPanel>
7078
</DataTemplate>
7179
</ComboBox.ItemTemplate>

0 commit comments

Comments
 (0)