6open type Fabulous.Avalonia.View
16 let private qrBytes (text: string) =
17 use qr = new QRCoder.QRCodeGenerator()
18 use data = qr.CreateQrCode(text, QRCoder.QRCodeGenerator.ECCLevel.M)
19 use png = new QRCoder.PngByteQRCode(data)
20 png.GetGraphic(8, [| 0uy; 0uy; 0uy |], [| 255uy; 255uy; 255uy |])
22 let viewAddContact model (cpk: string) =
27 h2 ("Share your address")
30 | Identified(id, _) ->
31 let ob = hexToOb id.PubKeyHex
33 Image(Styles.cachedBitmap (qrBytes ob), Stretch.Uniform).maxWidth(200.).centerHorizontal ()
35 body(ob).fontSize(12.).centerText ()
37 smallButton Primary "Copy Address" CopyPubKey
40 h2 "Enter someone else's address"
42 smallButton Secondary "Scan QR Code" DoScanQR
44 let cpkTrimmed: string = cpk.Trim()
47 Phonemic.fromOb cpkTrimmed
48 |> Option.orElseWith (fun () -> Crypto.tryFromHex cpkTrimmed)
49 |> Option.filter (fun bytes -> bytes.Length = 32)
52 let hasError = cpkTrimmed <> "" && not isValid
55 errorTextField cpk (fun key -> SetPage(AddContact(key)))
57 textField "" cpk (fun key -> SetPage(AddContact(key)))
61 smallButton Primary "Add" DoSaveContact
63 disabledSmallButton Primary "Add" DoSaveContact
68 let bar = HStack(8.) { backButton (SetPage Conversations) }
70 withBottomBar model.SafeAreaBottom bar content
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list