117 lines
5.8 KiB
XML
117 lines
5.8 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:models="clr-namespace:CORP_MAUI.ViewModels"
|
||
x:Class="CORP_MAUI.Pages.PostsPage"
|
||
Title="Новости">
|
||
|
||
<Grid>
|
||
<ActivityIndicator
|
||
x:Name="LoadingIndicator"
|
||
IsRunning="False"
|
||
IsVisible="False"
|
||
HorizontalOptions="Center"
|
||
VerticalOptions="Center"
|
||
Color="{StaticResource Primary}"/>
|
||
|
||
<RefreshView
|
||
x:Name="PostsRefreshView"
|
||
IsRefreshing="False"
|
||
Refreshing="OnRefreshing">
|
||
|
||
<CollectionView
|
||
x:Name="PostsCollectionView"
|
||
SelectionMode="Single"
|
||
SelectionChanged="OnPostSelected">
|
||
|
||
<CollectionView.EmptyView>
|
||
<VerticalStackLayout
|
||
VerticalOptions="Center"
|
||
HorizontalOptions="Center"
|
||
Padding="50">
|
||
<Label
|
||
Text="Нет новостей"
|
||
FontSize="16"
|
||
TextColor="{StaticResource Gray600}"
|
||
HorizontalOptions="Center"/>
|
||
</VerticalStackLayout>
|
||
</CollectionView.EmptyView>
|
||
|
||
<CollectionView.Header>
|
||
<Label Text="Последние новости"
|
||
FontSize="24"
|
||
FontAttributes="Bold"
|
||
Margin="20,10,20,0" />
|
||
</CollectionView.Header>
|
||
|
||
<CollectionView.ItemTemplate>
|
||
<DataTemplate x:DataType="models:PostViewModel">
|
||
<Border
|
||
Padding="15"
|
||
Margin="10,5"
|
||
StrokeShape="RoundRectangle 10"
|
||
BackgroundColor="White"
|
||
Shadow="{Shadow Brush=Black, Opacity=0.1, Offset='0,2', Radius=4}">
|
||
|
||
<VerticalStackLayout Spacing="10">
|
||
<!-- Заголовок и метаданные -->
|
||
<VerticalStackLayout Spacing="5">
|
||
<Label Text="{Binding Post.Title}"
|
||
FontSize="18"
|
||
FontAttributes="Bold"
|
||
TextColor="{StaticResource Gray900}"/>
|
||
|
||
<HorizontalStackLayout Spacing="10">
|
||
<Label Text="{Binding Post.Author.FullName}"
|
||
FontSize="12"
|
||
TextColor="{StaticResource Primary}"/>
|
||
<Label Text="{Binding Post.DisplayDate, StringFormat='{0:dd.MM.yyyy HH:mm}'}"
|
||
FontSize="12"
|
||
TextColor="{StaticResource Gray500}"/>
|
||
</HorizontalStackLayout>
|
||
</VerticalStackLayout>
|
||
|
||
<!-- Изображение -->
|
||
<Image Aspect="AspectFill"
|
||
HeightRequest="200"
|
||
Margin="0,5"
|
||
BackgroundColor="#F5F5F5"
|
||
Source="{Binding DisplayImageSource}"
|
||
IsVisible="{Binding IsImageVisible}">
|
||
<Image.Clip>
|
||
<RoundRectangleGeometry CornerRadius="10"/>
|
||
</Image.Clip>
|
||
</Image>
|
||
|
||
<!-- Контент -->
|
||
<Label Text="{Binding PreviewContent}"
|
||
FontSize="14"
|
||
TextColor="{StaticResource Gray900}"
|
||
LineBreakMode="TailTruncation"
|
||
MaxLines="3"/>
|
||
|
||
<!-- Футер с лайками и комментариями -->
|
||
<HorizontalStackLayout Spacing="20" Margin="0,5,0,0">
|
||
<HorizontalStackLayout Spacing="5">
|
||
<Label Text="❤️" />
|
||
<Label Text="{Binding Post.LikesCount}"
|
||
TextColor="{StaticResource Gray600}"/>
|
||
</HorizontalStackLayout>
|
||
|
||
<HorizontalStackLayout Spacing="5">
|
||
<Label Text="💬" />
|
||
<Label Text="{Binding Post.CommentsCount}"
|
||
TextColor="{StaticResource Gray600}"/>
|
||
</HorizontalStackLayout>
|
||
</HorizontalStackLayout>
|
||
</VerticalStackLayout>
|
||
</Border>
|
||
</DataTemplate>
|
||
</CollectionView.ItemTemplate>
|
||
|
||
</CollectionView>
|
||
</RefreshView>
|
||
</Grid>
|
||
|
||
</ContentPage>
|