170 lines
8.9 KiB
XML
170 lines
8.9 KiB
XML
<?xml version="1.0" encoding="utf-8" ?>
|
|
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
xmlns:viewModels="clr-namespace:CORP_MAUI.ViewModels"
|
|
xmlns:models="clr-namespace:CORP_MAUI.Models"
|
|
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
|
|
x:Class="CORP_MAUI.Pages.PostDetailsPage"
|
|
x:DataType="viewModels:PostDetailsViewModel"
|
|
Title="Публикация"
|
|
BackgroundColor="White">
|
|
|
|
<Grid RowDefinitions="Auto,*">
|
|
|
|
<!-- Шапка -->
|
|
<Grid
|
|
Grid.Row="0"
|
|
ColumnDefinitions="50,*,50"
|
|
Padding="15,10"
|
|
BackgroundColor="White">
|
|
|
|
<!-- Кнопка назад -->
|
|
<Border
|
|
Grid.Column="0"
|
|
WidthRequest="40"
|
|
HeightRequest="40"
|
|
StrokeShape="RoundRectangle 20"
|
|
BackgroundColor="Transparent"
|
|
Stroke="Transparent"
|
|
HorizontalOptions="Start">
|
|
<Border.GestureRecognizers>
|
|
<TapGestureRecognizer Tapped="OnCloseClicked"/>
|
|
</Border.GestureRecognizers>
|
|
<Image
|
|
Source="arrow_back.png"
|
|
WidthRequest="24"
|
|
HeightRequest="24"
|
|
HorizontalOptions="Center"
|
|
VerticalOptions="Center">
|
|
<Image.Behaviors>
|
|
<toolkit:IconTintColorBehavior TintColor="{StaticResource Primary}"/>
|
|
</Image.Behaviors>
|
|
</Image>
|
|
</Border>
|
|
|
|
<!-- Заголовок -->
|
|
<Label
|
|
Grid.Column="1"
|
|
Text="Публикация"
|
|
FontSize="18"
|
|
FontAttributes="Bold"
|
|
TextColor="{StaticResource Gray900}"
|
|
HorizontalOptions="Center"
|
|
VerticalOptions="Center"/>
|
|
|
|
<!-- Пустое место справа -->
|
|
<BoxView Grid.Column="2" Color="Transparent"/>
|
|
</Grid>
|
|
|
|
<!-- Контент -->
|
|
<CollectionView
|
|
Grid.Row="1"
|
|
x:Name="CommentsCollectionView"
|
|
ItemsSource="{Binding Comments}"
|
|
SelectionMode="None"
|
|
BackgroundColor="Transparent">
|
|
|
|
<CollectionView.Header>
|
|
<VerticalStackLayout>
|
|
<Border Style="{StaticResource CardBorderLarge}" Margin="10,10,10,5">
|
|
<VerticalStackLayout Spacing="15">
|
|
|
|
<!-- Автор и дата -->
|
|
<Grid ColumnDefinitions="50,*">
|
|
<Border Grid.Column="0" Style="{StaticResource AvatarSmall}">
|
|
<Image Source="{Binding PostViewModel.Post.Author.DisplayAvatarSource}" Aspect="AspectFill"/>
|
|
</Border>
|
|
<VerticalStackLayout Grid.Column="1" VerticalOptions="Center" Spacing="2" Margin="10,0,0,0">
|
|
<Label Text="{Binding PostViewModel.Post.Author.FullName}" Style="{StaticResource CardSubtitle}"/>
|
|
<Label Text="{Binding PostViewModel.Post.DisplayDate, StringFormat='{0:dd.MM.yyyy HH:mm}'}" Style="{StaticResource CardMeta}"/>
|
|
</VerticalStackLayout>
|
|
</Grid>
|
|
|
|
<!-- Заголовок -->
|
|
<Label Text="{Binding PostViewModel.Post.Title}"
|
|
Style="{StaticResource CardTitle}"
|
|
FontSize="20"/>
|
|
|
|
<!-- Изображение -->
|
|
<Image Aspect="AspectFit"
|
|
MinimumHeightRequest="200"
|
|
BackgroundColor="{StaticResource Gray200}"
|
|
Source="{Binding PostViewModel.DisplayImageSource}"
|
|
IsVisible="{Binding PostViewModel.IsImageVisible}"/>
|
|
|
|
<!-- Полный текст -->
|
|
<Label Text="{Binding PostViewModel.Post.Content}"
|
|
Style="{StaticResource CardText}"
|
|
FontSize="15"
|
|
LineHeight="1.3"/>
|
|
|
|
<!-- Статистика -->
|
|
<HorizontalStackLayout Spacing="20" Margin="0,5,0,0">
|
|
<HorizontalStackLayout Spacing="5">
|
|
<Image Source="like.png" WidthRequest="18" HeightRequest="18" VerticalOptions="Center">
|
|
<Image.Behaviors>
|
|
<toolkit:IconTintColorBehavior TintColor="{StaticResource Primary}"/>
|
|
</Image.Behaviors>
|
|
</Image>
|
|
<Label Text="{Binding PostViewModel.Post.LikesCount}" Style="{StaticResource CardMeta}" VerticalOptions="Center"/>
|
|
</HorizontalStackLayout>
|
|
<HorizontalStackLayout Spacing="5">
|
|
<Image Source="messages.png" WidthRequest="18" HeightRequest="18" VerticalOptions="Center">
|
|
<Image.Behaviors>
|
|
<toolkit:IconTintColorBehavior TintColor="{StaticResource Primary}"/>
|
|
</Image.Behaviors>
|
|
</Image>
|
|
<Label Text="{Binding PostViewModel.Post.CommentsCount}" Style="{StaticResource CardMeta}" VerticalOptions="Center"/>
|
|
</HorizontalStackLayout>
|
|
</HorizontalStackLayout>
|
|
|
|
</VerticalStackLayout>
|
|
</Border>
|
|
|
|
<!-- Заголовок комментариев -->
|
|
<Label Text="Комментарии" Style="{StaticResource SectionTitle}" Margin="15,15,15,5"/>
|
|
|
|
<!-- Индикатор загрузки комментариев -->
|
|
<ActivityIndicator IsRunning="{Binding IsLoadingComments}"
|
|
IsVisible="{Binding IsLoadingComments}"
|
|
Color="{StaticResource Primary}"
|
|
HorizontalOptions="Center"
|
|
Margin="0,10"/>
|
|
</VerticalStackLayout>
|
|
</CollectionView.Header>
|
|
|
|
<CollectionView.EmptyView>
|
|
<VerticalStackLayout Padding="20" Spacing="10" IsVisible="{Binding IsNotLoadingComments}">
|
|
<Label Text="Нет комментариев"
|
|
HorizontalOptions="Center"
|
|
Style="{StaticResource EmptyStateTitle}"/>
|
|
</VerticalStackLayout>
|
|
</CollectionView.EmptyView>
|
|
|
|
<CollectionView.ItemTemplate>
|
|
<DataTemplate x:DataType="models:Comment">
|
|
<Border
|
|
Style="{StaticResource CardBorder}"
|
|
Margin="10,5">
|
|
|
|
<VerticalStackLayout Spacing="8">
|
|
<Grid ColumnDefinitions="35,*">
|
|
<Border Grid.Column="0" Style="{StaticResource AvatarSmall}" WidthRequest="35" HeightRequest="35">
|
|
<Image Source="{Binding Author.DisplayAvatarSource}" Aspect="AspectFill"/>
|
|
</Border>
|
|
<VerticalStackLayout Grid.Column="1" VerticalOptions="Center" Spacing="2" Margin="8,0,0,0">
|
|
<Label Text="{Binding Author.FullName}" Style="{StaticResource CardSubtitle}" FontSize="13"/>
|
|
<Label Text="{Binding DisplayDate, StringFormat='{0:dd.MM.yyyy HH:mm}'}" Style="{StaticResource CardMeta}" FontSize="11"/>
|
|
</VerticalStackLayout>
|
|
</Grid>
|
|
|
|
<Label Text="{Binding DisplayContent}" Style="{StaticResource CardText}"/>
|
|
</VerticalStackLayout>
|
|
</Border>
|
|
</DataTemplate>
|
|
</CollectionView.ItemTemplate>
|
|
</CollectionView>
|
|
</Grid>
|
|
|
|
</ContentPage>
|