1
0

96 lines
6.6 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:u="https://irihi.tech/ursa"
xmlns:semi="https://irihi.tech/semi"
xmlns:vm="using:Flawless.Client.ViewModels"
mc:Ignorable="d" d:DesignWidth="1280" d:DesignHeight="768"
x:DataType="vm:HomeViewModel"
x:Class="Flawless.Client.Views.HomeView">
<DockPanel Margin="50">
<Grid RowDefinitions="Auto, 18, Auto" ColumnDefinitions="*, Auto" DockPanel.Dock="Top">
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
<Label Content="{Binding ServerFriendlyName, StringFormat='Server {0}', FallbackValue='Server LocalTest'}" FontSize="18" FontWeight="400"></Label>
<Label Content="Repositories" FontSize="32" FontWeight="600"></Label>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" Spacing="8">
<u:IconButton Icon="{StaticResource SemiIconSetting}"
Command="{Binding OpenGlobalSettingCommand}"/>
<u:IconButton Classes="Danger" Icon="{StaticResource SemiIconQuit}"
Command="{Binding QuitLoginCommand}"/>
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" Spacing="8">
<u:IconButton Icon="{StaticResource SemiIconRefresh}" Content="Refresh"
Command="{Binding RefreshRepositoriesCommand}"/>
<u:IconButton Icon="{StaticResource SemiIconPlus}" Content="Create"
Command="{Binding CreateRepositoryCommand}"/>
<u:DisableContainer IsEnabled="{Binding SelectedRepository, Converter={x:Static ObjectConverters.IsNotNull}}">
<StackPanel Orientation="Horizontal" Spacing="8">
<u:IconButton Icon="{StaticResource SemiIconFolderOpen}" Content="Open"
IsEnabled="{Binding SelectedRepository.IsDownloaded}"
Command="{Binding OpenRepositoryCommand}"/>
<u:IconButton Icon="{StaticResource SemiIconDownload}" Content="Download"
IsEnabled="{Binding !SelectedRepository.IsDownloaded}"
Command="{Binding DownloadRepositoryCommand}"/>
<u:IconButton Classes="Danger" Icon="{StaticResource SemiIconDelete}" Content="Delete"
IsEnabled="{Binding SelectedRepository.IsDownloaded}"
Command="{Binding DeleteRepositoryCommand}"/>
</StackPanel>
</u:DisableContainer>
</StackPanel>
</Grid>
<Rectangle DockPanel.Dock="Top" Height="18"/>
<StackPanel IsVisible="{Binding !Repos.Count}"
VerticalAlignment="Center" Spacing="18">
<PathIcon Data="{StaticResource SemiIconAlertCircle}" HorizontalAlignment="Left" Width="48" Height="48"/>
<Label FontSize="18" Content="Repository is empty, try refresh or create repository."/>
</StackPanel>
<Grid IsVisible="{Binding Repos.Count}" ColumnDefinitions="*, 10, *" VerticalAlignment="Stretch">
<ScrollViewer Grid.Column="0" VerticalScrollBarVisibility="Auto" AllowAutoHide="True">
<u:SelectionList ItemsSource="{Binding Repos, Mode=TwoWay}"
SelectedItem="{Binding SelectedRepository, Mode=TwoWay}"
Margin="0, 0, 8, 0">
<u:SelectionList.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Spacing="6" Margin="6 0">
<PathIcon MaxHeight="16" MaxWidth="16" Data="{StaticResource SemiIconDownload}"
IsVisible="{Binding !IsDownloaded}"/>
<PathIcon MaxHeight="16" MaxWidth="16" Data="{StaticResource SemiIconFolder}"
IsVisible="{Binding IsDownloaded}"/>
<TextBlock Margin="0, 12" VerticalAlignment="Center" Text="{Binding StandaloneName, Mode=OneWay}"/>
</StackPanel>
</DataTemplate>
</u:SelectionList.ItemTemplate>
</u:SelectionList>
</ScrollViewer>
<Border Grid.Column="2" Classes="Shadow" Theme="{StaticResource CardBorder}" VerticalAlignment="Stretch">
<StackPanel VerticalAlignment="Stretch" Spacing="20">
<Label FontWeight="400" FontSize="24"
Content="{Binding SelectedRepository.Name, FallbackValue='Select a Repository'}"/>
<StackPanel Spacing="10" IsVisible="{Binding SelectedRepository, Converter={x:Static ObjectConverters.IsNotNull}}">
<StackPanel IsVisible="{Binding SelectedRepository.Archived, FallbackValue=False}"
Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
<PathIcon MaxHeight="14" MaxWidth="14" Data="{StaticResource SemiIconArchive}"/>
<Label Content="Archived"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="6" VerticalAlignment="Center">
<PathIcon MaxHeight="14" MaxWidth="14" Data="{StaticResource SemiIconUser}"/>
<Label Content="{Binding SelectedRepository.OwnerName, FallbackValue='Owner'}"/>
</StackPanel>
<ScrollViewer IsVisible="{Binding SelectedRepository, Converter={x:Static ObjectConverters.IsNotNull}}">
<StackPanel Orientation="Vertical" Spacing="8">
<Label Content="{Binding SelectedRepository.Description, FallbackValue='Description as below.'}"/>
<u:Divider Content="Recent Activities"/>
</StackPanel>
</ScrollViewer>
</StackPanel>
</StackPanel>
</Border>
</Grid>
</DockPanel>
</UserControl>