mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 13:51:53 +08:00
ux: text styles in Interactive Rebase dialog
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -6,7 +6,7 @@ namespace SourceGit.Converters
|
||||
public static class InteractiveRebaseActionConverters
|
||||
{
|
||||
public static readonly FuncValueConverter<Models.InteractiveRebaseAction, IBrush> ToIconBrush =
|
||||
new FuncValueConverter<Models.InteractiveRebaseAction, IBrush>(v =>
|
||||
new(v =>
|
||||
{
|
||||
return v switch
|
||||
{
|
||||
@@ -20,6 +20,12 @@ namespace SourceGit.Converters
|
||||
});
|
||||
|
||||
public static readonly FuncValueConverter<Models.InteractiveRebaseAction, string> ToName =
|
||||
new FuncValueConverter<Models.InteractiveRebaseAction, string>(v => v.ToString());
|
||||
new(v => v.ToString());
|
||||
|
||||
public static readonly FuncValueConverter<Models.InteractiveRebaseAction, bool> IsDrop =
|
||||
new(v => v == Models.InteractiveRebaseAction.Drop);
|
||||
|
||||
public static readonly FuncValueConverter<Models.InteractiveRebaseAction, double> ToOpacity =
|
||||
new(v => v > Models.InteractiveRebaseAction.Reword ? 0.65 : 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,6 +524,9 @@
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.FG1}"/>
|
||||
<Setter Property="Opacity" Value=".56"/>
|
||||
</Style>
|
||||
<Style Selector="TextBlock.dropped">
|
||||
<Setter Property="TextDecorations" Value="Strikethrough"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Run.issue_link">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Link}"/>
|
||||
|
||||
@@ -76,12 +76,6 @@ namespace SourceGit.ViewModels
|
||||
set => SetProperty(ref _showEditMessageButton, value);
|
||||
}
|
||||
|
||||
public bool IsFullMessageUsed
|
||||
{
|
||||
get => _isFullMessageUsed;
|
||||
set => SetProperty(ref _isFullMessageUsed, value);
|
||||
}
|
||||
|
||||
public Thickness DropDirectionIndicator
|
||||
{
|
||||
get => _dropDirectionIndicator;
|
||||
@@ -108,7 +102,6 @@ namespace SourceGit.ViewModels
|
||||
private string _fullMessage;
|
||||
private bool _canSquashOrFixup = true;
|
||||
private bool _showEditMessageButton = false;
|
||||
private bool _isFullMessageUsed = true;
|
||||
private Thickness _dropDirectionIndicator = new Thickness(0);
|
||||
}
|
||||
|
||||
@@ -354,7 +347,6 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (item.Action == Models.InteractiveRebaseAction.Drop)
|
||||
{
|
||||
item.IsFullMessageUsed = false;
|
||||
item.ShowEditMessageButton = false;
|
||||
item.PendingType = hasPending ? Models.InteractiveRebasePendingType.Ignore : Models.InteractiveRebasePendingType.None;
|
||||
item.FullMessage = item.OriginalFullMessage;
|
||||
@@ -365,7 +357,6 @@ namespace SourceGit.ViewModels
|
||||
if (item.Action == Models.InteractiveRebaseAction.Fixup ||
|
||||
item.Action == Models.InteractiveRebaseAction.Squash)
|
||||
{
|
||||
item.IsFullMessageUsed = false;
|
||||
item.ShowEditMessageButton = false;
|
||||
item.PendingType = hasPending ? Models.InteractiveRebasePendingType.Pending : Models.InteractiveRebasePendingType.Last;
|
||||
item.FullMessage = item.OriginalFullMessage;
|
||||
@@ -382,7 +373,6 @@ namespace SourceGit.ViewModels
|
||||
item.Action == Models.InteractiveRebaseAction.Edit)
|
||||
{
|
||||
var oldPendingType = item.PendingType;
|
||||
item.IsFullMessageUsed = true;
|
||||
item.ShowEditMessageButton = true;
|
||||
item.PendingType = hasPending ? Models.InteractiveRebasePendingType.Target : Models.InteractiveRebasePendingType.None;
|
||||
|
||||
@@ -412,7 +402,6 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (item.Action == Models.InteractiveRebaseAction.Pick)
|
||||
{
|
||||
item.IsFullMessageUsed = true;
|
||||
item.IsMessageUserEdited = false;
|
||||
|
||||
if (hasPending)
|
||||
|
||||
@@ -165,8 +165,8 @@
|
||||
Subject="{Binding Subject}"
|
||||
IssueTrackers="{Binding $parent[v:InteractiveRebase].((vm:InteractiveRebase)DataContext).IssueTrackers}"
|
||||
FontWeight="Normal"
|
||||
Opacity="{Binding IsFullMessageUsed, Converter={x:Static c:BoolConverters.IsMergedToOpacity}}"
|
||||
ShowStrikethrough="{Binding Action, Mode=OneWay, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static m:InteractiveRebaseAction.Drop}}"/>
|
||||
Opacity="{Binding Action, Mode=OneWay, Converter={x:Static c:InteractiveRebaseActionConverters.ToOpacity}}"
|
||||
ShowStrikethrough="{Binding Action, Mode=OneWay, Converter={x:Static c:InteractiveRebaseActionConverters.IsDrop}}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Author Avatar -->
|
||||
@@ -174,27 +174,29 @@
|
||||
Width="16" Height="16"
|
||||
Margin="8,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
User="{Binding Commit.Author}"
|
||||
Opacity="{Binding IsFullMessageUsed, Converter={x:Static c:BoolConverters.IsMergedToOpacity}}"/>
|
||||
User="{Binding Commit.Author}"/>
|
||||
|
||||
<!-- Author Name -->
|
||||
<Border Grid.Column="5" ClipToBounds="True">
|
||||
<TextBlock Margin="6,0,12,0"
|
||||
Text="{Binding Commit.Author.Name}"
|
||||
Opacity="{Binding IsFullMessageUsed, Converter={x:Static c:BoolConverters.IsMergedToOpacity}}"/>
|
||||
Text="{Binding Commit.Author.Name}"
|
||||
Opacity="{Binding Action, Mode=OneWay, Converter={x:Static c:InteractiveRebaseActionConverters.ToOpacity}}"
|
||||
Classes.dropped="{Binding Action, Mode=OneWay, Converter={x:Static c:InteractiveRebaseActionConverters.IsDrop}}"/>
|
||||
</Border>
|
||||
|
||||
<!-- Commit SHA -->
|
||||
<Border Grid.Column="6" ClipToBounds="True">
|
||||
<TextBlock Text="{Binding Commit.SHA, Converter={x:Static c:StringConverters.ToShortSHA}}"
|
||||
Opacity="{Binding IsFullMessageUsed, Converter={x:Static c:BoolConverters.IsMergedToOpacity}}"/>
|
||||
Opacity="{Binding Action, Mode=OneWay, Converter={x:Static c:InteractiveRebaseActionConverters.ToOpacity}}"
|
||||
Classes.dropped="{Binding Action, Mode=OneWay, Converter={x:Static c:InteractiveRebaseActionConverters.IsDrop}}"/>
|
||||
</Border>
|
||||
|
||||
<!-- Commit Time -->
|
||||
<Border Grid.Column="7">
|
||||
<v:DateTimePresenter Margin="16,0,8,0"
|
||||
Timestamp="{Binding Commit.CommitterTime}"
|
||||
Opacity="{Binding IsFullMessageUsed, Converter={x:Static c:BoolConverters.IsMergedToOpacity}}"/>
|
||||
Opacity="{Binding Action, Mode=OneWay, Converter={x:Static c:InteractiveRebaseActionConverters.ToOpacity}}"
|
||||
Classes.dropped="{Binding Action, Mode=OneWay, Converter={x:Static c:InteractiveRebaseActionConverters.IsDrop}}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
Reference in New Issue
Block a user