on master help sign in
Sort contacts by last message and anchor list to bottom
68c43e5iko
client/ViewConversations.fs+10−2
@@ -14,7 +14,14 @@ module ViewConversations =
14 open Avalonia.Layout
14 open Avalonia.Layout
15
15
16 let viewConversations model =
16 let viewConversations model =
17+ let contacts =
17− let contacts = model.Contacts.Values |> Seq.toList
18+ model.Contacts.Values
19+ |> Seq.toList
20+ |> List.sortBy (fun c ->
21+ messagesFor c.Pubkey model.Messages
22+ |> List.tryLast
23+ |> Option.map (fun m -> m.Timestamp)
24+ |> Option.defaultValue System.DateTimeOffset.MinValue)
18
25
19 let content =
26 let content =
20 if contacts.IsEmpty then
27 if contacts.IsEmpty then
@@ -70,7 +77,8 @@ module ViewConversations =
70 .onTapped (fun _ -> SetPage(Chat(c.Pubkey, "")))
77 .onTapped (fun _ -> SetPage(Chat(c.Pubkey, "")))
71 )
78 )
72 .styles(noListBoxPadding ())
79 .styles(noListBoxPadding ())
73− .background (Colors.White)
80+ .background(Colors.White)
81+ .verticalAlignment (VerticalAlignment.Bottom)
74 )
82 )
75
83
76 let bar =
84 let bar =