Files
Massenger/src/Massenger.Client/Pages/ChatsPage.xaml
2026-03-13 21:01:04 +03:00

48 lines
2.7 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="Massenger.Client.Pages.ChatsPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:shared="clr-namespace:Massenger.Shared;assembly=Massenger.Shared"
xmlns:viewModels="clr-namespace:Massenger.Client.ViewModels"
x:DataType="viewModels:ChatsViewModel"
x:Name="RootPage">
<Grid Padding="20" RowDefinitions="Auto,*,Auto" RowSpacing="16">
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="12">
<VerticalStackLayout Spacing="4">
<Label FontSize="28" FontAttributes="Bold" Text="Chats" />
<Label Text="Recent conversations are ordered by last activity." TextColor="#64748B" />
</VerticalStackLayout>
<Button Grid.Column="1" Command="{Binding LoadCommand}" Text="Refresh" />
</Grid>
<RefreshView Grid.Row="1" Command="{Binding LoadCommand}" IsRefreshing="{Binding IsBusy}">
<CollectionView
ItemsSource="{Binding Chats}"
SelectionChanged="OnSelectionChanged"
SelectionMode="Single">
<CollectionView.EmptyView>
<VerticalStackLayout Padding="24" Spacing="6">
<Label HorizontalTextAlignment="Center" Text="{Binding EmptyState}" TextColor="#64748B" />
</VerticalStackLayout>
</CollectionView.EmptyView>
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="shared:ChatSummaryDto">
<Border Margin="0,0,0,12" Padding="16" StrokeShape="RoundRectangle 18">
<Grid ColumnDefinitions="*,Auto" RowDefinitions="Auto,Auto,Auto" RowSpacing="6">
<Label FontAttributes="Bold" Text="{Binding Title}" />
<Label Grid.Column="1" FontSize="12" Text="{Binding LastActivityAt, StringFormat='{}{0:HH:mm}'}" TextColor="#64748B" />
<Label Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding SecondaryText}" TextColor="#0F766E" />
<Label Grid.Row="2" Grid.ColumnSpan="2" LineBreakMode="TailTruncation" Text="{Binding LastMessagePreview}" TextColor="#475569" />
</Grid>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
<Label Grid.Row="2" FontSize="12" Text="Use Discover to search users and create direct chats, groups or channels." TextColor="#94A3B8" />
</Grid>
</ContentPage>