@@ -8,6 +8,8 @@ open type Fabulous.Avalonia.View
88module ViewAddContact =
99
1010 open AppTypes
11+ open Buttons
12+ open Styles
1113
1214 let private qrBytes (text: string) =
1315 use qr = new QRCoder.QRCodeGenerator()
@@ -16,42 +18,41 @@ module ViewAddContact =
1618 png.GetGraphic(8, [| 0uy; 0uy; 0uy |], [| 255uy; 255uy; 255uy |])
1719
1820 let viewAddContact model cpk cnn =
19− ScrollViewer(
20− (VStack(16.) {
21− HStack(8.) {
22− Image("avares://Skrepka/Assets/Images/left.png", Stretch.Uniform)
23− .width(24.)
24− .height(24.)
25− .onTapped (fun _ -> SetPage Conversations)
21+ let content =
22+ ScrollViewer(
23+ (VStack(16.) {
24+ match model.Auth with
25+ | Identified(id, _) ->
26+ let ob = hexToOb id.PubKeyHex
2627
27− TextBlock("Add Contact").fontSize (20.)
28− }
28+ TextBlock("Your key (share with contact):").foreground (SolidColorBrush(Colors.DimGray))
2929
30− match model.Auth with
31− | Identified(id, _) ->
32− let ob = hexToOb id.PubKeyHex
30+ Image(Styles.cachedBitmap (qrBytes ob), Stretch.Uniform)
31+ .maxWidth(200.)
32+ .centerHorizontal ()
3333
34− TextBlock("Your key (share with contact):").foreground (SolidColorBrush(Colors.DimGray))
34+ TextBlock(truncKey id.PubKeyHex)
35+ .fontSize(12.)
36+ .foreground(SolidColorBrush(Colors.DimGray))
37+ .centerText ()
38+ | NoIdentity -> ()
3539
36− Image(Styles.cachedBitmap (qrBytes ob), Stretch.Uniform)
37− .maxWidth(200.)
38− .centerHorizontal ()
40+ viewErrorBanner model.Error
3941
40− TextBlock(truncKey id.PubKeyHex)
41− .fontSize(12.)
42− .foreground(SolidColorBrush(Colors.DimGray))
43− .centerText ()
44− | NoIdentity -> ()
42+ TextBlock("Public Key:")
43+ TextBox(cpk, fun text -> SetPage(AddContact(text, cnn))).watermark ("sampel-palnet-...")
4544
46− viewErrorBanner model.Error
45+ TextBlock("Nickname:")
46+ TextBox(cnn, fun text -> SetPage(AddContact(cpk, text)))
4747
48− TextBlock("Public Key:")
49− TextBox(cpk, fun text -> SetPage(AddContact(text, cnn))).watermark ("sampel-palnet-...")
48+ Button("Save Contact", DoSaveContact).centerHorizontal ()
49+ })
50+ .margin (20.)
51+ )
5052
51− TextBlock("Nickname:")
52− TextBox(cnn, fun text -> SetPage(AddContact(cpk, text)))
53+ let bar =
54+ HStack(8.) {
55+ backButton (SetPage Conversations)
56+ }
5357
54− Button("Save Contact", DoSaveContact).centerHorizontal ()
55− })
56− .margin (20.)
57− )
58+ withBottomBar bar content