sourcegit/src/Views/ConventionalCommitMessageBuilder.axaml
leo e3c0f7d496
refactor: rewrite chromeless window (#634)
* use system chrome instead of custom caption button on macOS
* move `BeginMoveWindow` and `MaximizeOrRestoreWindow` to `ChromelessWindow`
* better supports for fullscreen mode on macOS
* redesign the layout of title bar for all windows

Signed-off-by: leo <longshuang@msn.cn>
2024-11-01 09:38:42 +08:00

138 lines
6.2 KiB
XML

<v:ChromelessWindow xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.ConventionalCommitMessageBuilder"
x:DataType="vm:ConventionalCommitMessageBuilder"
x:Name="ThisControl"
Icon="/App.ico"
Title="{DynamicResource Text.ConventionalCommit}"
Width="600"
SizeToContent="Height"
CanResize="False"
WindowStartupLocation="CenterOwner">
<Grid RowDefinitions="Auto,Auto,Auto">
<!-- TitleBar -->
<Grid Grid.Row="0" Height="28" IsVisible="{Binding !#ThisControl.UseSystemWindowFrame}">
<Border Background="{DynamicResource Brush.TitleBar}"
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
PointerPressed="BeginMoveWindow"/>
<Path Width="14" Height="14"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Data="{StaticResource Icons.CommitMessageGenerator}"
IsVisible="{OnPlatform True, macOS=False}"/>
<TextBlock Classes="bold"
Text="{DynamicResource Text.ConventionalCommit}"
HorizontalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False"/>
<v:CaptionButtons HorizontalAlignment="Right"
IsCloseButtonOnly="True"
IsVisible="{OnPlatform True, macOS=False}"/>
</Grid>
<!-- Body -->
<Grid Grid.Row="1" Margin="16,8" RowDefinitions="32,32,32,100,100,32" ColumnDefinitions="Auto,*">
<TextBlock Grid.Row="0" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,6,8,0"
Text="{DynamicResource Text.ConventionalCommit.Type}"/>
<ComboBox Grid.Row="0" Grid.Column="1"
Height="28" Padding="8,0"
VerticalAlignment="Center" HorizontalAlignment="Stretch"
ItemsSource="{Binding Source={x:Static m:ConventionalCommitType.Supported}}"
SelectedItem="{Binding Type, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="{x:Type m:ConventionalCommitType}">
<Grid Height="20" ColumnDefinitions="64,Auto" VerticalAlignment="Center">
<TextBlock Grid.Column="0" Text="{Binding Type}"/>
<TextBlock Grid.Column="1" Text="{Binding Description}" Foreground="{DynamicResource Brush.FG2}"/>
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBlock Grid.Row="1" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,6,8,0"
Text="{DynamicResource Text.ConventionalCommit.Scope}"/>
<TextBox Grid.Row="1" Grid.Column="1"
Height="26"
VerticalAlignment="Center"
CornerRadius="2"
Watermark="{DynamicResource Text.Optional}"
Text="{Binding Scope, Mode=TwoWay}"/>
<TextBlock Grid.Row="2" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,6,8,0"
Text="{DynamicResource Text.ConventionalCommit.ShortDescription}"/>
<TextBox Grid.Row="2" Grid.Column="1"
Height="26"
VerticalAlignment="Center"
CornerRadius="2"
Text="{Binding Description, Mode=TwoWay}"/>
<TextBlock Grid.Row="3" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,6,8,0"
Text="{DynamicResource Text.ConventionalCommit.Detail}"/>
<TextBox Grid.Row="3" Grid.Column="1"
Height="96"
AcceptsReturn="True"
AcceptsTab="True"
TextWrapping="Wrap"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
VerticalAlignment="Center"
VerticalContentAlignment="Top"
CornerRadius="2"
Watermark="{DynamicResource Text.Optional}"
Text="{Binding Detail, Mode=TwoWay}"/>
<TextBlock Grid.Row="4" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,6,8,0"
Text="{DynamicResource Text.ConventionalCommit.BreakingChanges}"/>
<TextBox Grid.Row="4" Grid.Column="1"
Height="96"
AcceptsReturn="True"
AcceptsTab="True"
TextWrapping="Wrap"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
VerticalAlignment="Center"
VerticalContentAlignment="Top"
CornerRadius="2"
Watermark="{DynamicResource Text.Optional}"
Text="{Binding BreakingChanges, Mode=TwoWay}"/>
<TextBlock Grid.Row="5" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Top"
Margin="0,6,8,0"
Text="{DynamicResource Text.ConventionalCommit.ClosedIssue}"/>
<TextBox Grid.Row="5" Grid.Column="1"
Height="26"
VerticalAlignment="Center"
CornerRadius="2"
Watermark="{DynamicResource Text.Optional}"
Text="{Binding ClosedIssue, Mode=TwoWay}"/>
</Grid>
<!-- Apply Button -->
<Button Grid.Row="2"
Classes="flat primary"
Height="32" Width="80"
Margin="0,8,0,16"
HorizontalAlignment="Center"
Content="{DynamicResource Text.Sure}"
Click="OnApplyClicked"/>
</Grid>
</v:ChromelessWindow>