<?xml version="1.0" encoding="utf-8" ?>
<local:VideoPartitionSideBodyBase
    x:Class="BiliCopilot.UI.Controls.VideoPartition.VideoPartitionSideBody"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:animations="using:CommunityToolkit.WinUI.Animations"
    xmlns:components="using:BiliCopilot.UI.Controls.Components"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:ext="using:BiliCopilot.UI.Extensions"
    xmlns:items="using:BiliCopilot.UI.ViewModels.Items"
    xmlns:local="using:BiliCopilot.UI.Controls.VideoPartition"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <ItemsView
            x:Name="PartitionView"
            Padding="2,8,8,8"
            ItemsSource="{x:Bind ViewModel.Partitions}"
            ScrollViewer.HorizontalScrollMode="Disabled"
            ScrollViewer.VerticalScrollBarVisibility="Auto"
            SelectionChanged="OnPartitionSelectionChanged"
            SelectionMode="Single">
            <ItemsView.ItemTemplate>
                <DataTemplate x:DataType="items:PartitionViewModel">
                    <ItemContainer
                        Height="40"
                        Margin="8,0"
                        Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                        Style="{StaticResource AppItemContainerStyle}">
                        <components:PartitionItemControl Margin="12,0" ViewModel="{x:Bind}" />
                    </ItemContainer>
                </DataTemplate>
            </ItemsView.ItemTemplate>
            <ItemsView.Layout>
                <StackLayout Spacing="8" />
            </ItemsView.Layout>
        </ItemsView>
        <components:SideBottomLoadingWidget
            VerticalAlignment="Bottom"
            Text="{ext:Locale Name=GettingPartitions}"
            Visibility="{x:Bind ViewModel.IsPartitionLoading, Mode=OneWay}" />
        <animations:Implicit.ShowAnimations>
            <animations:TranslationAnimation
                From="-20,0"
                To="0,0"
                Duration="0:0:0.24" />
            <animations:OpacityAnimation
                From="0.0"
                To="1.0"
                Duration="0:0:0.2" />
        </animations:Implicit.ShowAnimations>
        <animations:Implicit.HideAnimations>
            <animations:TranslationAnimation
                From="0,0"
                To="-20,0"
                Duration="0:0:0.24" />
            <animations:OpacityAnimation
                From="1.0"
                To="0.0"
                Duration="0:0:0.2" />
        </animations:Implicit.HideAnimations>
    </Grid>
</local:VideoPartitionSideBodyBase>
