<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:ext="clr-namespace:Ryujinx.Ava.Common.Markup"
             xmlns:fa="using:Projektanker.Icons.Avalonia"
             xmlns:wiz="using:Ryujinx.Ava.UI.SetupWizard"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:DataType="wiz:SetupWizardPage"
             x:Class="Ryujinx.Ava.UI.SetupWizard.SetupWizardPageView">
    <Grid RowDefinitions="*,Auto" Margin="60">
        <ScrollViewer>
            <Grid RowDefinitions="Auto,*">
                <TextBlock Grid.Row="0" 
                           TextWrapping="WrapWithOverflow"
                           FontSize="46"
                           Text="{Binding Title}" />
                <ContentPresenter Grid.Row="1" 
                                  Content="{Binding}"
                                  IsVisible="{Binding !#InfoToggle.IsChecked}"
                                  TextWrapping="WrapWithOverflow"
                                  Margin="0,15,0,0">
                    <ContentPresenter.DataTemplates>
                        <DataTemplate DataType="{x:Type wiz:SetupWizardPage}">
                            <ContentControl Content="{Binding Content}" VerticalAlignment="Stretch"/>
                        </DataTemplate>
                    </ContentPresenter.DataTemplates>
                </ContentPresenter>

                <Grid Grid.Row="1" 
                      ColumnDefinitions="*" RowDefinitions="*,Auto"
                      VerticalAlignment="Stretch" 
                      HorizontalAlignment="Stretch"
                      IsVisible="{Binding #InfoToggle.IsChecked}">
                    <Border
                        Margin="15"
                        IsVisible="{Binding HasHelpContent}"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        ClipToBounds="True"
                        CornerRadius="5"
                        Background="{DynamicResource AppListBackgroundColor}">
                        <ContentPresenter Content="{Binding}"
                                          Margin="5"
                                          TextWrapping="WrapWithOverflow" VerticalAlignment="Center" HorizontalAlignment="Center">
                            <ContentPresenter.DataTemplates>
                                <DataTemplate DataType="{x:Type wiz:SetupWizardPage}">
                                    <ContentControl Content="{Binding HelpContent}" />
                                </DataTemplate>
                            </ContentPresenter.DataTemplates>
                        </ContentPresenter>
                    </Border>
                    <Button Grid.Row="1"
                        VerticalAlignment="Bottom"
                        HorizontalAlignment="Center"
                        MinWidth="45"
                        MinHeight="32"
                        MaxWidth="45"
                        MaxHeight="32"
                        Padding="8"
                        Background="Transparent"
                        Click="Button_OnClick"
                        CornerRadius="5"
                        Tag="https://discord.gg/PEuzjrFXUA"
                        ToolTip.Tip="{ext:Locale AboutDiscordUrlTooltipMessage}">
                        <Image Source="{Binding Parent.DiscordLogo}" />
                    </Button>
                </Grid>
            </Grid>
        </ScrollViewer>

        <Grid ColumnDefinitions="Auto,Auto,*" Grid.Row="1">
            <ToggleButton Name="InfoToggle" Padding="6" IsVisible="{Binding ShowHelpButton}">
                <fa:Icon Value="fa-solid fa-circle-info" />
            </ToggleButton>

            <Button IsVisible="{Binding !IsFirstPage}"
                    Grid.Column="1"
                    Content="{ext:Locale SetupWizardActionBack}"
                    Margin="10,0,0,0"
                    Command="{Binding MoveBackCommand}" />

            <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Right"
                        Grid.Column="2">
                <Button Content="{Binding ActionContent}"
                        Command="{Binding MoveNextCommand}" />
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>

