ux: new style for current branch (#998)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-02-18 18:19:19 +08:00
parent 3d4a9b86b4
commit 5d2cd8b2fa
No known key found for this signature in database
3 changed files with 18 additions and 19 deletions

View file

@ -8,6 +8,7 @@
<StreamGeometry x:Key="Icons.Branch">M757 226a143 143 0 00-55 276 96 96 0 01-88 59h-191a187 187 0 00-96 27V312a143 143 0 10-96 0v399a143 143 0 10103 2 96 96 0 0188-59h191a191 191 0 00187-151 143 143 0 00-43-279zM280 130a48 48 0 110 96 48 48 0 010-96zm0 764a48 48 0 110-96 48 48 0 010 96zM757 417a48 48 0 110-96 48 48 0 010 96z</StreamGeometry>
<StreamGeometry x:Key="Icons.Branch.Add">M896 128h-64V64c0-35-29-64-64-64s-64 29-64 64v64h-64c-35 0-64 29-64 64s29 64 64 64h64v64c0 35 29 64 64 64s64-29 64-64V256h64c35 0 64-29 64-64s-29-64-64-64zm-204 307C673 481 628 512 576 512H448c-47 0-90 13-128 35V372C394 346 448 275 448 192c0-106-86-192-192-192S64 86 64 192c0 83 54 154 128 180v280c-74 26-128 97-128 180c0 106 86 192 192 192s192-86 192-192c0-67-34-125-84-159c22-20 52-33 84-33h128c122 0 223-85 249-199c-19 4-37 7-57 7c-26 0-51-5-76-13zM256 128c35 0 64 29 64 64s-29 64-64 64s-64-29-64-64s29-64 64-64zm0 768c-35 0-64-29-64-64s29-64 64-64s64 29 64 64s-29 64-64 64z</StreamGeometry>
<StreamGeometry x:Key="Icons.Check">M512 597m-1 0a1 1 0 103 0a1 1 0 10-3 0ZM810 393 732 315 448 600 293 444 214 522l156 156 78 78 362-362z</StreamGeometry>
<StreamGeometry x:Key="Icons.CheckCircled">M512 32C246 32 32 250 32 512s218 480 480 480 480-218 480-480S774 32 512 32zm269 381L496 698c-26 26-61 26-83 0L243 528c-26-26-26-61 0-83s61-26 83 0l128 128 240-240c26-26 61-26 83 0 26 19 26 54 3 80z</StreamGeometry>
<StreamGeometry x:Key="Icons.Changes">M747 467c29 0 56 4 82 12v-363c0-47-38-84-84-84H125c-47 0-84 38-84 84v707c0 47 38 84 84 84h375a287 287 0 01-43-152c0-160 129-289 289-289zm-531-250h438c19 0 34 15 34 34s-15 34-34 34H216c-19 0-34-15-34-34s15-34 34-34zm0 179h263c19 0 34 15 34 34s-15 34-34 34H216c-19 0-34-15-34-34s15-34 34-34zm131 247h-131c-19 0-34-15-34-34s15-34 34-34h131c19 0 34 15 34 34s-15 34-34 34zM747 521c-130 0-236 106-236 236S617 992 747 992s236-106 236-236S877 521 747 521zm11 386v-65h-130c-12 0-22-10-22-22s10-22 22-22h260l-130 108zm108-192H606l130-108v65h130c12 0 22 10 22 22s-10 22-22 22z</StreamGeometry>
<StreamGeometry x:Key="Icons.CherryPick">M529 511c115 0 212 79 239 185h224a62 62 0 017 123l-7 0-224 0a247 247 0 01-479 0H65a62 62 0 01-7-123l7-0h224a247 247 0 01239-185zm0 124a124 124 0 100 247 124 124 0 000-247zm0-618c32 0 58 24 61 55l0 7V206c89 11 165 45 225 103a74 74 0 0122 45l0 9v87a62 62 0 01-123 7l-0-7v-65l-6-4c-43-33-97-51-163-53l-17-0c-74 0-133 18-180 54l-6 4v65a62 62 0 01-55 61l-7 0a62 62 0 01-61-55l-0-7V362c0-20 8-39 23-53 60-58 135-92 224-103V79c0-34 28-62 62-62z</StreamGeometry>
<StreamGeometry x:Key="Icons.CircleDown">M512 926c-229 0-414-186-414-414S283 98 512 98s414 186 414 414-186 414-414 414zm0-73c189 0 341-153 341-341S701 171 512 171 171 323 171 512s153 341 341 341zm-6-192L284 439l52-52 171 171 171-171L728 439l-222 222z</StreamGeometry>

View file

@ -57,18 +57,11 @@
IsExpanded="{Binding IsExpanded}"/>
<!-- Name -->
<Grid Grid.Column="1" ColumnDefinitions="Auto,*">
<Border Grid.Column="0" Margin="0,0,4,0" Background="Green" Height="16" CornerRadius="8" VerticalAlignment="Center" IsVisible="{Binding IsCurrent}">
<TextBlock Text="HEAD" Classes="primary" Margin="8,0" Foreground="#FFDDDDDD" FontSize="10" VerticalAlignment="Center"/>
</Border>
<TextBlock Grid.Column="1"
Classes="primary"
Text="{Binding Name}"
FontWeight="{Binding IsCurrent, Converter={x:Static c:BoolConverters.IsBoldToFontWeight}}"
TextTrimming="CharacterEllipsis"/>
</Grid>
<TextBlock Grid.Column="1"
Classes="primary"
Text="{Binding Name}"
FontWeight="{Binding IsCurrent, Converter={x:Static c:BoolConverters.IsBoldToFontWeight}}"
TextTrimming="CharacterEllipsis"/>
<!-- Tracking status -->
<v:BranchTreeNodeTrackStatusPresenter Grid.Column="2"

View file

@ -52,31 +52,31 @@ namespace SourceGit.Views
if (node.Backend is Models.Remote)
{
CreateContent(new Thickness(0, 0, 0, 0), "Icons.Remote");
CreateContent(new Thickness(0, 0, 0, 0), "Icons.Remote", false);
}
else if (node.Backend is Models.Branch branch)
{
if (branch.IsCurrent)
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Check");
CreateContent(new Thickness(0, 0, 0, 0), "Icons.CheckCircled", true);
else
CreateContent(new Thickness(2, 0, 0, 0), "Icons.Branch");
CreateContent(new Thickness(2, 0, 0, 0), "Icons.Branch", false);
}
else
{
if (node.IsExpanded)
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder.Open");
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder.Open", false);
else
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder");
CreateContent(new Thickness(0, 2, 0, 0), "Icons.Folder", false);
}
}
private void CreateContent(Thickness margin, string iconKey)
private void CreateContent(Thickness margin, string iconKey, bool highlight)
{
var geo = this.FindResource(iconKey) as StreamGeometry;
if (geo == null)
return;
Content = new Path()
var path = new Path()
{
Width = 12,
Height = 12,
@ -85,6 +85,11 @@ namespace SourceGit.Views
Margin = margin,
Data = geo,
};
if (highlight)
path.Fill = Brushes.Green;
Content = path;
}
}