mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55:00 +00:00
enhance: conventional commit message helper (#1200)
- add `build`, `ci`, `pref` - re-design helper dialog Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
fa44fa773c
commit
cac4b7edf6
2 changed files with 41 additions and 14 deletions
|
@ -4,23 +4,29 @@ namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
public class ConventionalCommitType
|
public class ConventionalCommitType
|
||||||
{
|
{
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
public string Type { get; set; } = string.Empty;
|
public string Type { get; set; } = string.Empty;
|
||||||
public string Description { get; set; } = string.Empty;
|
public string Description { get; set; } = string.Empty;
|
||||||
|
|
||||||
public static readonly List<ConventionalCommitType> Supported = new List<ConventionalCommitType>()
|
public static readonly List<ConventionalCommitType> Supported = new List<ConventionalCommitType>()
|
||||||
{
|
{
|
||||||
new ConventionalCommitType("feat", "Adding a new feature"),
|
new ConventionalCommitType("Features", "feat", "Adding a new feature"),
|
||||||
new ConventionalCommitType("fix", "Fixing a bug"),
|
new ConventionalCommitType("Bug Fixes", "fix", "Fixing a bug"),
|
||||||
new ConventionalCommitType("docs", "Updating documentation"),
|
new ConventionalCommitType("Reverts", "revert", "Undoing a previous commit"),
|
||||||
new ConventionalCommitType("style", "Elements or code styles without changing the code logic"),
|
new ConventionalCommitType("Code Refactoring", "refactor", "Restructuring code without changing its external behavior"),
|
||||||
new ConventionalCommitType("test", "Adding or updating tests"),
|
new ConventionalCommitType("Performance Improvements", "pref", "Improves performance"),
|
||||||
new ConventionalCommitType("chore", "Making changes to the build process or auxiliary tools and libraries"),
|
new ConventionalCommitType("Builds", "build", "Changes that affect the build system or external dependencies"),
|
||||||
new ConventionalCommitType("revert", "Undoing a previous commit"),
|
new ConventionalCommitType("Continuous Integrations", "ci", "Changes to CI configuration files and scripts"),
|
||||||
new ConventionalCommitType("refactor", "Restructuring code without changing its external behavior")
|
new ConventionalCommitType("Documentations", "docs", "Updating documentation"),
|
||||||
|
new ConventionalCommitType("Styles", "style", "Elements or code styles without changing the code logic"),
|
||||||
|
new ConventionalCommitType("Tests", "test", "Adding or updating tests"),
|
||||||
|
new ConventionalCommitType("Chores", "chore", "Other changes that don't modify src or test files"),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public ConventionalCommitType(string type, string description)
|
public ConventionalCommitType(string name, string type, string description)
|
||||||
{
|
{
|
||||||
|
Name = name;
|
||||||
Type = type;
|
Type = type;
|
||||||
Description = description;
|
Description = description;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,12 +48,33 @@
|
||||||
Height="28" Padding="8,0"
|
Height="28" Padding="8,0"
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||||
ItemsSource="{Binding Source={x:Static m:ConventionalCommitType.Supported}}"
|
ItemsSource="{Binding Source={x:Static m:ConventionalCommitType.Supported}}"
|
||||||
SelectedItem="{Binding Type, Mode=TwoWay}">
|
SelectedItem="{Binding Type, Mode=TwoWay}"
|
||||||
|
Grid.IsSharedSizeScope="True">
|
||||||
|
<ComboBox.SelectionBoxItemTemplate>
|
||||||
|
<DataTemplate DataType="m:ConventionalCommitType">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding Name}" Margin="0,0,8,0"/>
|
||||||
|
<Border Height="16" CornerRadius="8" Padding="8,0" VerticalAlignment="Center" Background="Green">
|
||||||
|
<TextBlock Text="{Binding Type}" VerticalAlignment="Center" FontSize="11" Foreground="White"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.SelectionBoxItemTemplate>
|
||||||
|
|
||||||
<ComboBox.ItemTemplate>
|
<ComboBox.ItemTemplate>
|
||||||
<DataTemplate x:DataType="{x:Type m:ConventionalCommitType}">
|
<DataTemplate DataType="m:ConventionalCommitType">
|
||||||
<Grid Height="20" ColumnDefinitions="64,Auto" VerticalAlignment="Center">
|
<Grid Height="24">
|
||||||
<TextBlock Grid.Column="0" Text="{Binding Type}"/>
|
<Grid.ColumnDefinitions>
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Description}" Foreground="{DynamicResource Brush.FG2}"/>
|
<ColumnDefinition Width="Auto" SharedSizeGroup="NameColumn"/>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="TypeColumn"/>
|
||||||
|
<ColumnDefinition Width="Auto" SharedSizeGroup="DescriptionColumn"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0" Text="{Binding Name}"/>
|
||||||
|
<Border Grid.Column="1" Height="16" CornerRadius="8" Padding="8,0" Margin="8,0,16,0" HorizontalAlignment="Left" VerticalAlignment="Center" Background="Green">
|
||||||
|
<TextBlock Text="{Binding Type}" VerticalAlignment="Center" FontSize="11" Foreground="White"/>
|
||||||
|
</Border>
|
||||||
|
<TextBlock Grid.Column="2" Text="{Binding Description}" Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue