<?xml version="1.0" encoding="utf-8" ?>
<local:WebDavPageControlBase
    x:Class="BiliCopilot.UI.Controls.WebDav.WebDavPageBody"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:base="using:Richasy.WinUIKernel.Share.Base"
    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.WebDav"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid>
        <Grid Visibility="{x:Bind ViewModel.IsInvalidConfig, Mode=OneWay, Converter={StaticResource BoolToVisibilityReverseConverter}}">
            <ScrollViewer Style="{StaticResource PageScrollViewerStyle}">
                <ItemsControl Margin="16,12" ItemsSource="{x:Bind ViewModel.Items, Mode=OneWay}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate x:DataType="items:WebDavStorageItemViewModel">
                            <local:WebDavStorageItemControl Margin="0,4" ViewModel="{x:Bind}" />
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>
            <base:EmptyHolder
                Title="{ext:Locale Name=NoFiles}"
                Description="{ext:Locale Name=NoFilesDescription}"
                Emoji="&#x1F9D0;"
                Visibility="{x:Bind ViewModel.IsItemsEmpty, Mode=OneWay}" />
            <base:LoadingWidget Text="{ext:Locale Name=LoadingAndWait}" Visibility="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />
        </Grid>
        <base:EmptyHolder
            Title="{ext:Locale Name=InvalidServiceConfig}"
            Description="{ext:Locale Name=InvalidServiceConfigDescription}"
            Emoji="&#x1F62C;"
            Visibility="{x:Bind ViewModel.IsInvalidConfig, Mode=OneWay}" />
    </Grid>
</local:WebDavPageControlBase>
