<UserControl
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d"
    x:Class="Nebula.Launcher.Views.Pages.ServerOverviewView"
    x:DataType="pages:ServerOverviewModel"
    xmlns="https://github.com/avaloniaui"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pages="clr-namespace:Nebula.Launcher.ViewModels.Pages"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:Nebula.Launcher.Controls"
    xmlns:models="clr-namespace:Nebula.Launcher.Models"
    xmlns:services="clr-namespace:Nebula.Launcher.Services">

    <Design.DataContext>
        <pages:ServerOverviewModel />
    </Design.DataContext>

    <Grid
        ColumnDefinitions="*"
        Margin="0"
        RowDefinitions="40,*,40">
        
        <ListBox
            Background="Transparent"
            ItemsSource="{Binding Items}"
            Padding="0"
            SelectedItem="{Binding SelectedItem}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate DataType="{x:Type models:ServerListTabTemplate}">
                    <StackPanel Orientation="Horizontal" Spacing="19">
                        <TextBlock Text="{Binding TabName}" VerticalAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        
        <Border
            Child="{Binding CurrentServerList}"
            Grid.Row="1"
            Grid.RowSpan="2" />
        
        <Border Grid.Row="1" 
                Background="{StaticResource DefaultGrad}" 
                Margin="0,0,0,0" CornerRadius="20,20,0,0"
                VerticalAlignment="Bottom" 
                IsVisible="{Binding IsFilterVisible}">
            <StackPanel Orientation="Vertical" Spacing="2" Margin="15">
                <controls:FilterBox Name="EssentialFilters" FilterBoxName="filter-roleplay" FilterCommand="{Binding OnFilterChanged}"/>
                <controls:FilterBox Name="LanguageFilters" FilterBoxName="filter-language" FilterCommand="{Binding OnFilterChanged}"/>
            </StackPanel>
        </Border>

        <Border
            Background="{StaticResource DefaultGrad}"
            BoxShadow="0 2 25 0 #121212"
            CornerRadius="0"
            Grid.Row="2" />

        <Grid
            ColumnDefinitions="*,40,40,40"
            Grid.Row="2"
            Margin="-25,0,0,0"
            RowDefinitions="*">
            <TextBox
                Margin="25,0,0,0"
                Text="{Binding SearchText}"
                VerticalAlignment="Center"
                Watermark="{services:LocaledText 'server-search'}" />
            <Button
                Command="{Binding FilterRequired}"
                Grid.Column="2"
                Padding="10">
                <Svg Path="/Assets/svg/filter.svg" />
            </Button>
            <Button
                Command="{Binding UpdateRequired}"
                Grid.Column="3"
                Padding="10">
                <Svg Path="/Assets/svg/refresh.svg" />
            </Button>
        </Grid>
    </Grid>
</UserControl>