mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix: Fixed the issue when the email address is too long and exceeds the scope of the StackPanel
This commit is contained in:
parent
a5150edee0
commit
9c6798ef1b
2 changed files with 36 additions and 24 deletions
|
@ -1,4 +1,5 @@
|
||||||
using Avalonia.Data.Converters;
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Data.Converters;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
|
||||||
namespace SourceGit.Converters
|
namespace SourceGit.Converters
|
||||||
|
@ -10,5 +11,8 @@ namespace SourceGit.Converters
|
||||||
|
|
||||||
public static readonly FuncValueConverter<bool, FontWeight> BoldIfTrue =
|
public static readonly FuncValueConverter<bool, FontWeight> BoldIfTrue =
|
||||||
new FuncValueConverter<bool, FontWeight>(x => x ? FontWeight.Bold : FontWeight.Regular);
|
new FuncValueConverter<bool, FontWeight>(x => x ? FontWeight.Bold : FontWeight.Regular);
|
||||||
|
|
||||||
|
public static readonly FuncValueConverter<bool, GridLength> BoolToStarOrAutoGridLength =
|
||||||
|
new(value => value ? new GridLength(1, GridUnitType.Star) : new GridLength(1, GridUnitType.Auto));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,34 +12,42 @@
|
||||||
<DataTemplate DataType="m:Commit">
|
<DataTemplate DataType="m:Commit">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<!-- Author & Committer -->
|
<!-- Author & Committer -->
|
||||||
<Grid ColumnDefinitions="96,*,96,*" Margin="0,8">
|
<Grid Margin="0,8">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="{Binding IsCommitterVisible, Converter={x:Static c:BoolConverters.BoolToStarOrAutoGridLength}}"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<!-- Author -->
|
<!-- Author -->
|
||||||
<v:Avatar Grid.Column="0" Width="64" Height="64" HorizontalAlignment="Right" User="{Binding Author}"/>
|
<Grid Grid.Column="0" ColumnDefinitions="96,*">
|
||||||
<StackPanel Grid.Column="1" Margin="16,0,8,0" Orientation="Vertical">
|
<v:Avatar Grid.Column="0" Width="64" Height="64" HorizontalAlignment="Right" User="{Binding Author}"/>
|
||||||
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.CommitDetail.Info.Author}"/>
|
<StackPanel Grid.Column="1" Margin="16,0,8,0" Orientation="Vertical">
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,8">
|
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.CommitDetail.Info.Author}"/>
|
||||||
<SelectableTextBlock Text="{Binding Author.Name}" Margin="2,0,8,0"/>
|
<DockPanel Margin="0,10,0,8" ClipToBounds="True">
|
||||||
<SelectableTextBlock Text="{Binding Author.Email}" Foreground="{DynamicResource Brush.FG2}"/>
|
<SelectableTextBlock Text="{Binding Author.Name}" Margin="2,0,8,0"/>
|
||||||
|
<SelectableTextBlock Text="{Binding Author.Email}" ToolTip.Tip="{Binding Author.Email}" Foreground="{DynamicResource Brush.FG2}" TextTrimming="CharacterEllipsis"/>
|
||||||
|
</DockPanel>
|
||||||
|
<SelectableTextBlock Text="{Binding AuthorTimeStr}"
|
||||||
|
Margin="2,0,0,0"
|
||||||
|
FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:FontSizeModifyConverters.Decrease}}"
|
||||||
|
Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<SelectableTextBlock Text="{Binding AuthorTimeStr}"
|
</Grid>
|
||||||
Margin="2,0,0,0"
|
|
||||||
FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:FontSizeModifyConverters.Decrease}}"
|
|
||||||
Foreground="{DynamicResource Brush.FG2}"/>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<!-- Committer -->
|
<!-- Committer -->
|
||||||
<v:Avatar Grid.Column="2" Width="64" Height="64" HorizontalAlignment="Right" User="{Binding Committer}" IsVisible="{Binding IsCommitterVisible}"/>
|
<Grid Grid.Column="1" ColumnDefinitions="96,*" IsVisible="{Binding IsCommitterVisible}">
|
||||||
<StackPanel Grid.Column="3" Margin="16,0,8,0" Orientation="Vertical" IsVisible="{Binding IsCommitterVisible}">
|
<v:Avatar Grid.Column="0" Width="64" Height="64" HorizontalAlignment="Right" User="{Binding Committer}"/>
|
||||||
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.CommitDetail.Info.Committer}"/>
|
<StackPanel Grid.Column="1" Margin="16,0,8,0" Orientation="Vertical">
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,8">
|
<TextBlock Classes="group_header_label" Margin="0" Text="{DynamicResource Text.CommitDetail.Info.Committer}"/>
|
||||||
<SelectableTextBlock Text="{Binding Committer.Name}" Margin="2,0,8,0"/>
|
<DockPanel Margin="0,10,0,8" ClipToBounds="True">
|
||||||
<SelectableTextBlock Text="{Binding Committer.Email}" Foreground="{DynamicResource Brush.FG2}"/>
|
<SelectableTextBlock Text="{Binding Committer.Name}" Margin="2,0,8,0"/>
|
||||||
|
<SelectableTextBlock Text="{Binding Committer.Email}" ToolTip.Tip="{Binding Committer.Email}" Foreground="{DynamicResource Brush.FG2}" TextTrimming="CharacterEllipsis"/>
|
||||||
|
</DockPanel>
|
||||||
|
<SelectableTextBlock Text="{Binding CommitterTimeStr}"
|
||||||
|
Margin="2,0,0,0"
|
||||||
|
FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:FontSizeModifyConverters.Decrease}}"
|
||||||
|
Foreground="{DynamicResource Brush.FG2}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<SelectableTextBlock Text="{Binding CommitterTimeStr}"
|
</Grid>
|
||||||
Margin="2,0,0,0"
|
|
||||||
FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:FontSizeModifyConverters.Decrease}}"
|
|
||||||
Foreground="{DynamicResource Brush.FG2}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- Line -->
|
<!-- Line -->
|
||||||
|
|
Loading…
Reference in a new issue