Speech bubbles, a chat log that follows its end, a composer that sends on Enter, typing dots, chat and channel lists, read receipts, reactions, emoji and sticker pickers, mentions, date and unread rules, system lines, member lists, user cards, a mailbox, mail reader and letter, a notification bell, call controls, a voice meter, attachment chips, link previews and polls. pixel's editor takes EnterSends; display's Bubble takes a Fill and exports EmojiSprite. data.List names its rows, which also lets typing choose one. layout.ScrollArea and input.TextArea hold still under Inert, and an inert scroll view leaves the Tab order until it wakes.
29 lines
901 B
Go
29 lines
901 B
Go
package chat
|
|
|
|
import (
|
|
"github.com/egoist/mygo/ui"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/data"
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
|
)
|
|
|
|
type MailReaderOptions struct {
|
|
// Width is in dots; zero means 220.
|
|
Width int
|
|
}
|
|
|
|
// MailReader shows a mail's headers, a rule, its body.
|
|
func MailReader(c *ui.Context, m Mail, o MailReaderOptions) *ui.Element {
|
|
k := pixel.K(c)
|
|
w := pixel.Or("MailReader Width", o.Width, 220)
|
|
return ui.Column(c).Width(k.D(w)).Gap(k.D(4)).Children(func() {
|
|
head := [][2]string{{k.Msg("from"), m.From}, {k.Msg("subject"), m.Subject}, {k.Msg("date"), m.At.Format("2006-01-02 15:04")}}
|
|
data.DescriptionList(c, head, data.DescriptionListOptions{TermWidth: 50})
|
|
ui.Box(c).FillWidth().Height(k.D(3)).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
g := k.Canvas(p, r)
|
|
g.HLine(0, 1, g.W, pixel.Edge)
|
|
})
|
|
para(c, k, m.Body, w, 0, pixel.Ink)
|
|
})
|
|
}
|