LANCommander/LANCommander.Launcher/Views/ShellView.axaml
2026-07-07 01:53:38 -05:00

211 lines
12 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:LANCommander.Launcher.ViewModels"
xmlns:views="using:LANCommander.Launcher.Views"
xmlns:controls="using:LANCommander.Launcher.Controls"
xmlns:converters="using:LANCommander.Launcher.Converters"
x:Class="LANCommander.Launcher.Views.ShellView"
x:DataType="vm:ShellViewModel">
<UserControl.Resources>
<converters:FilePathToBitmapConverter x:Key="FilePathToBitmapConverter" />
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="Button.active">
<Setter Property="Background" Value="{DynamicResource SystemAccentColor}" />
</Style>
</UserControl.Styles>
<Grid RowDefinitions="*,Auto">
<!-- ── Main Content ──────────────────────────────────────────── -->
<TransitioningContentControl Grid.Row="0" Content="{Binding ContentView}">
<TransitioningContentControl.PageTransition>
<controls:FadeInPageTransition Duration="0:0:0.2" />
</TransitioningContentControl.PageTransition>
<TransitioningContentControl.DataTemplates>
<DataTemplate DataType="vm:DepotViewModel">
<views:DepotView />
</DataTemplate>
<DataTemplate DataType="vm:DepotBrowseViewModel">
<views:DepotBrowseView />
</DataTemplate>
<!-- DepotGameDetailViewModel must appear before GameDetailViewModel
so the more-specific type is matched first. -->
<DataTemplate DataType="vm:DepotGameDetailViewModel">
<views:GameDetailView />
</DataTemplate>
<DataTemplate DataType="vm:GamesListViewModel">
<views:GamesListView />
</DataTemplate>
<DataTemplate DataType="vm:LibraryViewModel">
<views:GamesListView />
</DataTemplate>
<DataTemplate DataType="vm:GameDetailViewModel">
<views:GameDetailView />
</DataTemplate>
<DataTemplate DataType="vm:SettingsViewModel">
<views:SettingsView />
</DataTemplate>
<DataTemplate DataType="vm:DownloadQueueViewModel">
<views:DownloadQueuePageView />
</DataTemplate>
</TransitioningContentControl.DataTemplates>
</TransitioningContentControl>
<!-- ── Loading overlay (shown during async navigation) ───── -->
<Border Grid.Row="0"
Background="#80000000"
IsVisible="{Binding IsNavigating}"
IsHitTestVisible="False"
ZIndex="10">
<ProgressBar IsIndeterminate="True"
Width="200"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<!-- ── Footer ────────────────────────────────────────────────── -->
<Border Grid.Row="1"
Background="Black"
BorderBrush="#22FFFFFF"
BorderThickness="0,1,0,0"
Padding="8, 0">
<Grid ColumnDefinitions="Auto,*,Auto" Height="52">
<!-- Left: Depot / Library toggle -->
<StackPanel Grid.Column="0"
Orientation="Horizontal"
IsVisible="{Binding AreUserLibrariesEnabled}">
<IconButton Command="{Binding ShowLibraryCommand}"
Text="Library"
Classes="Text"
IconType="Regular"
IconValue="Books"
Size="16"
IsVisible="{Binding IsDepotActive}" />
<IconButton Command="{Binding ShowDepotCommand}"
Text="Depot"
Classes="Text"
IconType="Regular"
IconValue="Storefront"
Size="16"
IsVisible="{Binding IsLibraryActive}" />
</StackPanel>
<!-- Center: active download OR idle downloads button -->
<Panel Grid.Column="1" HorizontalAlignment="Stretch" Margin="16,0">
<!-- Active download progress -->
<Button Classes="Text"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
VerticalAlignment="Stretch"
MaxWidth="900"
Command="{Binding ShowDownloadQueueCommand}"
IsVisible="{Binding DownloadQueue.HasActiveDownload}">
<Grid ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto">
<!-- Queue icon: game icon or fallback -->
<Border Grid.Column="0" Grid.RowSpan="2"
Width="32" Height="32"
CornerRadius="4"
ClipToBounds="True"
Margin="0,0,10,0"
VerticalAlignment="Center">
<Panel>
<Border Background="{DynamicResource SystemAccentColor}"
IsVisible="{Binding !DownloadQueue.CurrentItem.HasIcon}">
<Icon Type="Regular" Value="ArrowCircleDown" Width="16" Height="16" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<Image Source="{Binding DownloadQueue.CurrentItem.IconPath, Converter={StaticResource FilePathToBitmapConverter}}"
Stretch="UniformToFill"
IsVisible="{Binding DownloadQueue.CurrentItem.HasIcon}" />
</Panel>
</Border>
<!-- Title · Status | Speed | Time remaining -->
<DockPanel Grid.Column="1" Grid.Row="0">
<TextBlock DockPanel.Dock="Right"
Text="{Binding DownloadQueue.TimeRemainingText}"
FontSize="11" Opacity="0.6"
VerticalAlignment="Center"
Margin="8,0,0,0"
IsVisible="{Binding DownloadQueue.TimeRemainingText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
<TextBlock DockPanel.Dock="Right"
Text="{Binding DownloadQueue.TransferSpeedText}"
FontSize="11" Opacity="0.6"
VerticalAlignment="Center"
Margin="8,0,0,0" />
<TextBlock Text="{Binding DownloadQueue.CurrentItem.Title}"
FontSize="13" FontWeight="SemiBold"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" />
</DockPanel>
<!-- Status + progress bar -->
<DockPanel Grid.Column="1" Grid.Row="1" Margin="0,2,0,0">
<TextBlock DockPanel.Dock="Left"
Text="{Binding DownloadQueue.CurrentStatus}"
FontSize="11" Opacity="0.5"
VerticalAlignment="Center"
Margin="0,0,8,0"
IsVisible="{Binding DownloadQueue.CurrentStatus, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" />
<ProgressBar Value="{Binding DownloadQueue.CurrentProgress}"
Minimum="0" Maximum="1"
Height="3"
VerticalAlignment="Center" />
</DockPanel>
</Grid>
</Button>
<!-- Idle: always-visible downloads button -->
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="8"
IsVisible="{Binding !DownloadQueue.HasActiveDownload}">
<Button Command="{Binding ShowDownloadQueueCommand}"
Classes="Text">
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Center">
<Icon Type="Regular" Value="DownloadSimple" Width="16" Height="16" VerticalAlignment="Center" />
<TextBlock Text="Downloads" FontSize="16" VerticalAlignment="Center" />
<Border Background="{DynamicResource SystemAccentColor}"
CornerRadius="8"
Padding="5,1"
IsVisible="{Binding DownloadQueue.HasPendingItems}">
<TextBlock Text="{Binding DownloadQueue.ActiveCount}"
FontSize="11" Foreground="White" />
</Border>
</StackPanel>
</Button>
</StackPanel>
</Panel>
<Panel Grid.Column="2" HorizontalAlignment="Right">
<!-- Chat button -->
<Button Command="{Binding OpenChatCommand}"
Classes="Text">
<StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
<Icon Type="Regular" Value="ChatCircle" Width="16" Height="16" VerticalAlignment="Center" />
<TextBlock Text="Chat" FontSize="16" VerticalAlignment="Center" />
<Border Background="{DynamicResource SystemAccentColor}"
CornerRadius="8"
Padding="5,1"
IsVisible="{Binding HasUnreadChat}">
<TextBlock Text="{Binding ChatUnreadCount}"
FontSize="11" Foreground="White" />
</Border>
</StackPanel>
</Button>
</Panel>
</Grid>
</Border>
</Grid>
</UserControl>