<Page
    x:Class="AmbientSounds.Views.UploadPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:AmbientSounds.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:AmbientSounds.Views"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:strings="using:AmbientSounds.Strings"
    Background="{ThemeResource FallbackBackgroundBrush}"
    mc:Ignorable="d">
    <Grid>
        <SplitView
            x:Name="MainSplitView"
            DisplayMode="Overlay"
            IsPaneOpen="False"
            PaneBackground="{ThemeResource SystemControlPageBackgroundChromeLowBrush}"
            PanePlacement="Right">
            <SplitView.Pane>
                <controls:UploadForm Margin="0,42,0,20" />
            </SplitView.Pane>

            <Grid Padding="0,32,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="60" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <StackPanel Margin="40,0" Orientation="Horizontal">
                    <Button
                        x:Uid="BackButton"
                        Click="{x:Bind ViewModel.GoBack}"
                        Style="{StaticResource TransparentRoundButtonStyle}">
                        <FontIcon FontFamily="{StaticResource FluentUIGlyphs}" Glyph="&#xE921;" />
                    </Button>
                    <FontIcon
                        Margin="12,0,0,0"
                        FontFamily="{StaticResource FluentUIGlyphs}"
                        Glyph="&#xE9B8;" />
                    <TextBlock
                        x:Uid="UploadPortal"
                        Margin="12,0,0,0"
                        Style="{StaticResource PageHeaderTextStyle}" />
                </StackPanel>

                <StackPanel
                    Grid.Row="1"
                    Margin="40,16,0,0"
                    Orientation="Horizontal">
                    <Button
                        AutomationProperties.Name="{x:Bind strings:Resources.Refresh}"
                        Click="RefreshClicked"
                        Content="{x:Bind strings:Resources.Refresh}" />
                    <Button
                        x:Name="OpenUploadPane"
                        Margin="8,0,0,0"
                        AutomationProperties.Name="{x:Bind strings:Resources.UploadSubmitButton}"
                        Click="Button_Click"
                        Content="{x:Bind strings:Resources.UploadSubmitButton}" />
                </StackPanel>

                <controls:UploadedSoundsList
                    x:Name="MySoundsList"
                    Grid.Row="2"
                    Margin="8,20,0,0" />
            </Grid>
        </SplitView>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState>
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="800" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                        <Setter Target="MainSplitView.DisplayMode" Value="Inline" />
                        <Setter Target="MainSplitView.IsPaneOpen" Value="True" />
                        <Setter Target="OpenUploadPane.Visibility" Value="Collapsed" />
                        <Setter Target="MainSplitView.PaneBackground" Value="{ThemeResource SystemControlAcrylicWindowBrush}" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</Page>
