<Page
    x:Class="FoxTube.Home"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:FoxTube"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pages="using:FoxTube.Pages"
    xmlns:controls="using:FoxTube.Controls"
    xmlns:classes="using:FoxTube.Classes"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Pivot SelectionChanged="pivot_SelectionChanged" Name="pivot">
            <PivotItem Name="recommended" Header="Recommended" x:Uid="/Home/recommended">
                <Grid>
                    <ScrollViewer>
                        <StackPanel>
                            <pages:VideoGrid x:Name="recGrid"/>
                            <controls:ShowMore Clicked="Recommended_More" x:Name="recommendedMore"/>
                        </StackPanel>
                    </ScrollViewer>

                    <local:LoadingPage x:Name="recsLoading" Grid.RowSpan="2" RefreshPage="Refresh_Click"/>
                </Grid>
            </PivotItem>
            <PivotItem Name="trending" Header="Trending" x:Uid="/Home/trending">
                <Grid>
                    <ScrollViewer>
                        <StackPanel>
                            <pages:VideoGrid x:Name="trendGrid"/>
                            <controls:ShowMore Clicked="Trending_More" x:Name="trendingMore"/>
                        </StackPanel>
                    </ScrollViewer>

                    <local:LoadingPage x:Name="trendsLoading" Grid.RowSpan="2" RefreshPage="Refresh_Click"/>
                </Grid>
            </PivotItem>
            <PivotItem Name="subscriptions" Header="Subscriptions" x:Uid="/Home/subs">
                <Grid>
                    <ScrollViewer>
                        <StackPanel>
                            <pages:VideoGrid x:Name="subsGrid"/>
                            <controls:ShowMore Clicked="Subscriptions_More" x:Name="subscriptionsMore"/>
                        </StackPanel>
                    </ScrollViewer>

                    <local:LoadingPage x:Name="subsLoading" Grid.RowSpan="2" RefreshPage="Refresh_Click"/>
                </Grid>
            </PivotItem>
        </Pivot>

        <classes:AdaptiveCommandBar Grid.Row="1" Name="commandbar">
            <AppBarButton Icon="Refresh" Label="Refresh" x:Uid="/Home/refresh" Click="Refresh_Click"/>
        </classes:AdaptiveCommandBar>
    </Grid>
</Page>
