Add chat components 321-345; named List rows, inert scroll views
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.
This commit is contained in:
50 files changed
+2697
-34
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"github.com/egoist/mygo/ui"
|
||||
|
||||
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/display"
|
||||
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
||||
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/text"
|
||||
)
|
||||
|
||||
type SpeechBubbleOptions struct {
|
||||
// Width wraps the text; zero means 140.
|
||||
Width int
|
||||
}
|
||||
|
||||
// SpeechBubble shows who said what, when; tail their side.
|
||||
func SpeechBubble(c *ui.Context, m Message, o SpeechBubbleOptions) *ui.Element {
|
||||
k := pixel.K(c)
|
||||
w := pixel.Or("SpeechBubble Width", o.Width, 140)
|
||||
// Yours sit right on Accent, written in AccentInk.
|
||||
side, tail, fill, ink := ui.Start, display.Left, pixel.Lit, pixel.Ink
|
||||
if m.Mine {
|
||||
side, tail, fill, ink = ui.End, display.Right, pixel.Accent, pixel.AccentInk
|
||||
}
|
||||
return ui.Column(c).AlignSelf(side).AlignItems(side).Gap(k.D(1)).Children(func() {
|
||||
pixel.Text(c, line(m.From, w), pixel.TextOptions{Slot: pixel.Faint})
|
||||
display.Bubble(c, display.BubbleOptions{Tail: tail, At: 4, Fill: fill}, func() {
|
||||
para(c, k, m.Text, w, 0, ink)
|
||||
})
|
||||
text.MicroText(c, clock(m.At), text.MicroTextOptions{Slot: pixel.Faint})
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user