@@ -1,5 +1,6 @@
1namespace Skrepka
1namespace Skrepka
3open Fabulous.Avalonia
4open Fabulous.Avalonia
5open type Fabulous.Avalonia.View
6open type Fabulous.Avalonia.View
@@ -14,37 +15,42 @@ module ViewChat =
14 let name = contactName model.Contacts pk
15 let name = contactName model.Contacts pk
15 let msgs = messagesFor pk model.Messages
16 let msgs = messagesFor pk model.Messages
17− (VStack(8.) {
18+ (Grid([ Dimension.Auto; Dimension.Auto; Dimension.Star; Dimension.Auto ], [ Dimension.Star ]) {
18− HStack(8.) {
19+ (HStack(8.) {
19 backButton (SetPage Conversations)
20 backButton (SetPage Conversations)
21 TextBlock(name).fontSize(20.).centerVertical ()
22 TextBlock(name).fontSize(20.).centerVertical ()
24− viewErrorBanner model.Error
26+ (viewErrorBanner model.Error).gridRow (1)
28− if msgs.IsEmpty then
28+ (if msgs.IsEmpty then
29− TextBlock("No messages yet").padding(8.).fontSize (14.)
29+ AnyView(TextBlock("No messages yet").padding(8.).fontSize (14.))
31− for m in msgs do
31+ let reversed = List.rev msgs
35+ ItemsRepeater(reversed, fun m ->
32− let prefix, tick =
36+ let prefix, tick =
33− match m.Direction with
37+ match m.Direction with
34− | Outgoing DeliveryStatus.Delivered -> "You: ", " \u2713"
38+ | Outgoing DeliveryStatus.Delivered -> "You: ", " \u2713"
35− | Outgoing DeliveryStatus.Sent -> "You: ", ""
39+ | Outgoing DeliveryStatus.Sent -> "You: ", ""
36− | Incoming -> "", ""
40+ | Incoming -> "", ""
38− TextBlock($"{prefix}{m.Body}{tick}").padding(8.).fontSize (14.)
42+ TextBlock($"{prefix}{m.Body}{tick}").padding(8.).fontSize (14.))
42− HStack(8.) {
47+ (HStack(8.) {
43 TextBox(compose, fun text -> SetPage(Chat(pk, text)))
48 TextBox(compose, fun text -> SetPage(Chat(pk, text)))
44 .watermark("Message...")
49 .watermark("Message...")
45− .horizontalAlignment (Avalonia.Layout.HorizontalAlignment.Stretch)
50+ .horizontalAlignment (HorizontalAlignment.Stretch)
47 Button("Send", DoSend)
52 Button("Send", DoSend)
50 .margin (12.)
56 .margin (12.)