<?xml version="1.0" encoding="utf-8" ?>
<local:ArticleCardPresenter
    x:Class="BiliCopilot.UI.Controls.Components.PartitionArticlePresenter"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="using:Richasy.WinUIKernel.Share.Base"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:BiliCopilot.UI.Controls.Components"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="80" />
        </Grid.RowDefinitions>
        <local:VideoCoverImage CornerRadius="4,4,0,0" Source="{x:Bind ViewModel.Cover, Mode=OneWay}" />
        <Button
            x:Name="UserButton"
            Margin="6"
            HorizontalAlignment="Left"
            VerticalAlignment="Bottom"
            Command="{x:Bind ViewModel.ShowUserSpaceCommand, Mode=OneWay}"
            Style="{StaticResource AvatarButtonStyle}">
            <Grid>
                <Ellipse
                    Width="35"
                    Height="35"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Fill="Black"
                    Opacity="0.7" />
                <PersonPicture
                    Width="32"
                    Height="32"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    DisplayName="{x:Bind ViewModel.Author, Mode=OneWay}"
                    ProfilePicture="{x:Bind ViewModel.Avatar, Converter={StaticResource BitmapConverter}, Mode=OneWay}"
                    ToolTipService.ToolTip="{x:Bind ViewModel.Author, Mode=OneWay}" />
            </Grid>
        </Button>
        <Grid
            Grid.Row="1"
            Padding="12,8,12,12"
            RowSpacing="6">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid ColumnSpacing="8">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <base:TrimTextBlock
                    FontSize="12"
                    Foreground="{ThemeResource TextFillColorTertiaryBrush}"
                    Text="{x:Bind ViewModel.Author, Mode=OneWay}" />
                <TextBlock
                    Grid.Column="1"
                    VerticalAlignment="Center"
                    Foreground="{ThemeResource TextFillColorTertiaryBrush}"
                    Style="{StaticResource CaptionTextBlockStyle}"
                    Text="{x:Bind ViewModel.PublishRelativeTime, Mode=OneWay}"
                    TextTrimming="CharacterEllipsis"
                    TextWrapping="NoWrap"
                    Visibility="{x:Bind ViewModel.PublishRelativeTime, Converter={StaticResource ObjectToVisibilityConverter}, Mode=OneWay}" />
            </Grid>
            <base:TrimTextBlock
                Grid.Row="1"
                HorizontalAlignment="Left"
                Text="{x:Bind ViewModel.Title, Mode=OneWay}" />
        </Grid>
    </Grid>
</local:ArticleCardPresenter>
