corp-app/CORP-MAUI/Pages/ChatPage.xaml

226 lines
9.6 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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:local="clr-namespace:CORP_MAUI.Pages"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="CORP_MAUI.Pages.ChatPage"
Title="Чат"
BackgroundColor="White">
<Grid RowDefinitions="Auto,*,Auto">
<!-- Шапка с информацией о собеседнике -->
<Grid
Grid.Row="0"
ColumnDefinitions="50,Auto,*,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="OnBackButtonClicked"/>
</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>
<!-- Аватар -->
<Border
Grid.Column="1"
Style="{StaticResource AvatarSmall}"
Margin="5,0,10,0">
<Image
x:Name="RecipientAvatar"
Source="dotnet_bot.png"
Aspect="AspectFill"/>
</Border>
<!-- Информация о собеседнике -->
<VerticalStackLayout
Grid.Column="2"
VerticalOptions="Center"
Spacing="2">
<Label
x:Name="RecipientName"
Text="Выберите собеседника"
FontSize="16"
FontAttributes="Bold"
TextColor="{StaticResource Gray900}"/>
<Label
x:Name="RecipientStatus"
Text="Offline"
FontSize="12"
TextColor="{StaticResource Gray500}"/>
</VerticalStackLayout>
<!-- Пустое место справа -->
<BoxView Grid.Column="3" Color="Transparent"/>
</Grid>
<!-- Список сообщений -->
<CollectionView
Grid.Row="1"
x:Name="MessagesCollectionView"
SelectionMode="None"
BackgroundColor="Transparent"
Margin="10">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="{x:Type local:MessageViewModel}">
<Grid Padding="5">
<!-- Сообщение отправленное -->
<Border
HorizontalOptions="End"
MaximumWidthRequest="300"
BackgroundColor="{StaticResource Primary}"
StrokeShape="RoundRectangle 15"
Stroke="Transparent"
Padding="12"
Margin="50,0,0,0"
Shadow="{Shadow Brush=Black, Opacity=0.1, Offset='0,1', Radius=3}">
<Border.Triggers>
<DataTrigger TargetType="Border" Binding="{Binding IsMyMessage}" Value="False">
<Setter Property="HorizontalOptions" Value="Start"/>
<Setter Property="BackgroundColor" Value="White"/>
<Setter Property="Margin" Value="0,0,50,0"/>
</DataTrigger>
</Border.Triggers>
<VerticalStackLayout Spacing="5">
<Label
Text="{Binding SenderName}"
FontSize="12"
FontAttributes="Bold"
TextColor="White">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding IsMyMessage}" Value="False">
<Setter Property="TextColor" Value="{StaticResource Gray900}"/>
</DataTrigger>
</Label.Triggers>
</Label>
<Label
Text="{Binding Content}"
FontSize="14"
TextColor="White">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding IsMyMessage}" Value="False">
<Setter Property="TextColor" Value="{StaticResource Gray900}"/>
</DataTrigger>
</Label.Triggers>
</Label>
<Label
Text="{Binding Timestamp, StringFormat='{0:HH:mm}'}"
FontSize="10"
HorizontalOptions="End"
TextColor="White"
Opacity="0.8">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding IsMyMessage}" Value="False">
<Setter Property="TextColor" Value="{StaticResource Gray500}"/>
</DataTrigger>
</Label.Triggers>
</Label>
</VerticalStackLayout>
</Border>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<!-- Панель ввода сообщения -->
<Border
Grid.Row="2"
Padding="15,10"
BackgroundColor="White"
Stroke="Transparent"
StrokeShape="RoundRectangle 0">
<Grid ColumnDefinitions="*,Auto">
<!-- Поле ввода -->
<Border
Grid.Column="0"
StrokeShape="RoundRectangle 22.5"
BackgroundColor="{StaticResource Gray200}"
Stroke="Transparent"
HeightRequest="45"
Padding="15,0">
<Entry
x:Name="MessageEntry"
Placeholder="Введите сообщение..."
PlaceholderColor="{StaticResource Gray500}"
TextColor="{StaticResource Gray900}"
BackgroundColor="Transparent"
VerticalOptions="Center"
TextChanged="OnMessageTextChanged"
Completed="OnSendMessageClicked"/>
</Border>
<!-- Кнопка отправки -->
<Border
Grid.Column="1"
x:Name="SendButton"
WidthRequest="45"
HeightRequest="45"
StrokeShape="RoundRectangle 22.5"
BackgroundColor="{StaticResource Primary}"
Stroke="Transparent"
Margin="10,0,0,0">
<Border.GestureRecognizers>
<TapGestureRecognizer Tapped="OnSendMessageClicked"/>
</Border.GestureRecognizers>
<Image
Source="send.png"
WidthRequest="22"
HeightRequest="22"
HorizontalOptions="Center"
VerticalOptions="Center">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="White"/>
</Image.Behaviors>
</Image>
</Border>
</Grid>
</Border>
<!-- Индикатор подключения -->
<Border
Grid.Row="1"
x:Name="ConnectionIndicator"
IsVisible="False"
BackgroundColor="{StaticResource Primary}"
Padding="12,8"
StrokeShape="RoundRectangle 20"
Stroke="Transparent"
VerticalOptions="Start"
HorizontalOptions="Center"
Margin="0,10,0,0"
Shadow="{Shadow Brush=Black, Opacity=0.2, Offset='0,2', Radius=4}">
<Label
Text="Подключение..."
TextColor="White"
FontSize="12"/>
</Border>
</Grid>
</ContentPage>