193 lines
8.2 KiB
XML
193 lines
8.2 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:local="clr-namespace:CORP_MAUI.Pages"
|
||
x:Class="CORP_MAUI.Pages.ChatPage"
|
||
Title="Чат">
|
||
|
||
<Grid RowDefinitions="Auto,*,Auto">
|
||
|
||
<!-- Шапка с информацией о собеседнике -->
|
||
<Border
|
||
Grid.Row="0"
|
||
Padding="15"
|
||
BackgroundColor="{StaticResource Primary}"
|
||
Shadow="{Shadow Brush=Black, Opacity=0.3, Offset='0,2', Radius=4}">
|
||
|
||
<Grid ColumnDefinitions="Auto,Auto,*">
|
||
<!-- Кнопка "Назад" -->
|
||
<Button
|
||
Grid.Column="0"
|
||
Text="←"
|
||
FontSize="24"
|
||
TextColor="White"
|
||
BackgroundColor="Transparent"
|
||
WidthRequest="40"
|
||
HeightRequest="40"
|
||
Padding="0"
|
||
VerticalOptions="Center"
|
||
Clicked="OnBackButtonClicked"/>
|
||
|
||
<!-- Аватар -->
|
||
<Border
|
||
Grid.Column="1"
|
||
WidthRequest="50"
|
||
HeightRequest="50"
|
||
StrokeShape="RoundRectangle 25"
|
||
Padding="0"
|
||
Margin="10,0,0,0"
|
||
BackgroundColor="White">
|
||
<Image
|
||
x:Name="RecipientAvatar"
|
||
Source="dotnet_bot.png"
|
||
Aspect="AspectFill"/>
|
||
</Border>
|
||
|
||
<!-- Информация о собеседнике -->
|
||
<VerticalStackLayout
|
||
Grid.Column="2"
|
||
VerticalOptions="Center"
|
||
Margin="10,0,0,0">
|
||
<Label
|
||
x:Name="RecipientName"
|
||
Text="Выберите собеседника"
|
||
FontSize="18"
|
||
FontAttributes="Bold"
|
||
TextColor="White"/>
|
||
<Label
|
||
x:Name="RecipientStatus"
|
||
Text="Offline"
|
||
FontSize="12"
|
||
TextColor="White"
|
||
Opacity="0.8"/>
|
||
</VerticalStackLayout>
|
||
</Grid>
|
||
</Border>
|
||
|
||
<!-- Список сообщений -->
|
||
<CollectionView
|
||
Grid.Row="1"
|
||
x:Name="MessagesCollectionView"
|
||
SelectionMode="None"
|
||
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"
|
||
Padding="10"
|
||
Margin="50,0,0,0"
|
||
Shadow="{Shadow Brush=Black, Opacity=0.2, Offset='0,1', Radius=3}">
|
||
<Border.Triggers>
|
||
<DataTrigger TargetType="Border" Binding="{Binding IsMyMessage}" Value="False">
|
||
<Setter Property="HorizontalOptions" Value="Start"/>
|
||
<Setter Property="BackgroundColor" Value="{StaticResource Gray200}"/>
|
||
<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.7">
|
||
<Label.Triggers>
|
||
<DataTrigger TargetType="Label" Binding="{Binding IsMyMessage}" Value="False">
|
||
<Setter Property="TextColor" Value="{StaticResource Gray600}"/>
|
||
</DataTrigger>
|
||
</Label.Triggers>
|
||
</Label>
|
||
</VerticalStackLayout>
|
||
</Border>
|
||
</Grid>
|
||
</DataTemplate>
|
||
</CollectionView.ItemTemplate>
|
||
</CollectionView>
|
||
|
||
<!-- Панель ввода сообщения -->
|
||
<Border
|
||
Grid.Row="2"
|
||
Padding="10"
|
||
BackgroundColor="{StaticResource Gray100}"
|
||
Shadow="{Shadow Brush=Black, Opacity=0.3, Offset='0,-2', Radius=4}">
|
||
|
||
<Grid ColumnDefinitions="*,Auto">
|
||
<Entry
|
||
x:Name="MessageEntry"
|
||
Grid.Column="0"
|
||
Placeholder="Введите сообщение..."
|
||
PlaceholderColor="{StaticResource Gray400}"
|
||
TextColor="{StaticResource Gray900}"
|
||
BackgroundColor="White"
|
||
HeightRequest="45"
|
||
VerticalOptions="Center"
|
||
TextChanged="OnMessageTextChanged"
|
||
Completed="OnSendMessageClicked"/>
|
||
|
||
<Button
|
||
Grid.Column="1"
|
||
x:Name="SendButton"
|
||
Text="➤"
|
||
FontSize="24"
|
||
WidthRequest="50"
|
||
HeightRequest="45"
|
||
BackgroundColor="{StaticResource Primary}"
|
||
TextColor="White"
|
||
CornerRadius="10"
|
||
Margin="10,0,0,0"
|
||
Clicked="OnSendMessageClicked"/>
|
||
</Grid>
|
||
</Border>
|
||
|
||
<!-- Индикатор подключения -->
|
||
<Border
|
||
Grid.Row="1"
|
||
x:Name="ConnectionIndicator"
|
||
IsVisible="False"
|
||
BackgroundColor="{StaticResource Secondary}"
|
||
Padding="10"
|
||
StrokeShape="RoundRectangle 20"
|
||
VerticalOptions="Start"
|
||
HorizontalOptions="Center"
|
||
Margin="0,10,0,0"
|
||
Shadow="{Shadow Brush=Black, Opacity=0.3, Offset='0,2', Radius=4}">
|
||
<Label
|
||
Text="Подключение..."
|
||
TextColor="White"
|
||
FontSize="12"/>
|
||
</Border>
|
||
|
||
</Grid>
|
||
|
||
</ContentPage>
|
||
|