<UserControl 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:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight"
             xmlns:entryReleases="clr-namespace:Artemis.UI.Screens.Workshop.EntryReleases"
             xmlns:ui="clr-namespace:Artemis.UI"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Artemis.UI.Screens.Workshop.EntryReleases.EntryReleaseView"
             x:DataType="entryReleases:EntryReleaseViewModel">
    <UserControl.Resources>
        <ui:ArtemisLinkCommand x:Key="ArtemisLinkCommand" />
    </UserControl.Resources>
    <Grid RowDefinitions="Auto,Auto">
        <Border Grid.Row="0" Classes="card" Margin="0 0 0 10">
            <ContentControl Content="{CompiledBinding EntryReleaseInfoViewModel}"/>
        </Border>

        <Border Grid.Row="1" Classes="card">
            <Grid RowDefinitions="Auto,Auto,*">
                <TextBlock Grid.Row="0" Classes="h5 no-margin">Release notes</TextBlock>
                <Border Grid.Row="1" Classes="card-separator" />

                <TextBlock Grid.Row="2" Classes="subtitle" IsVisible="{CompiledBinding Release.Changelog, Converter={x:Static StringConverters.IsNullOrEmpty}}">
                    There are no release notes for this release.
                </TextBlock>
                <mdxaml:MarkdownScrollViewer Grid.Row="2"
                                             Markdown="{CompiledBinding Release.Changelog}"
                                             MarkdownStyleName="FluentAvalonia"
                                             IsVisible="{CompiledBinding Release.Changelog, Converter={x:Static StringConverters.IsNotNullOrEmpty}}">
                    <mdxaml:MarkdownScrollViewer.Engine>
                        <mdxaml:Markdown HyperlinkCommand="{StaticResource ArtemisLinkCommand}" />
                    </mdxaml:MarkdownScrollViewer.Engine>
                    <mdxaml:MarkdownScrollViewer.Styles>
                        <StyleInclude Source="/Styles/Markdown.axaml" />
                    </mdxaml:MarkdownScrollViewer.Styles>
                </mdxaml:MarkdownScrollViewer>
            </Grid>
        </Border>
    </Grid>
</UserControl>