summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-07-09 16:35:10 +0200
committerxengineering <me@xengineering.eu>2023-07-09 16:35:10 +0200
commit4152d6e7bfe3d0fd7d099d36311c4a57f4858964 (patch)
treee7e2222e88764a371ab53791defd989709490e0a
parent4e90179c2c72f6c73f1db302b24bfa0cf75aada7 (diff)
downloadlimox-4152d6e7bfe3d0fd7d099d36311c4a57f4858964.tar
limox-4152d6e7bfe3d0fd7d099d36311c4a57f4858964.tar.zst
limox-4152d6e7bfe3d0fd7d099d36311c4a57f4858964.zip
Add second view for roster
This prepares the contact list / roster view.
-rw-r--r--gui.go37
1 files changed, 30 insertions, 7 deletions
diff --git a/gui.go b/gui.go
index d3f6b2d..c3256eb 100644
--- a/gui.go
+++ b/gui.go
@@ -11,6 +11,36 @@ import (
)
func (l *Limox) draw(e system.FrameEvent) {
+ switch l.State {
+ case Connected:
+ l.rosterView(e)
+ default:
+ l.mainView(e)
+ }
+}
+
+func (l *Limox) rosterView(e system.FrameEvent) {
+ gtx := layout.NewContext(&l.Operations, e)
+
+ flex := layout.Flex{
+ Axis: layout.Vertical,
+ Spacing: layout.SpaceStart,
+ }
+
+ flex.Layout(gtx,
+ layout.Rigid(
+ func(gtx layout.Context) layout.Dimensions {
+ btn := material.Button(l.Theme, &l.DisconnectButton,
+ "Disconnect")
+ return btn.Layout(gtx)
+ },
+ ),
+ )
+
+ e.Frame(gtx.Ops)
+}
+
+func (l *Limox) mainView(e system.FrameEvent) {
gtx := layout.NewContext(&l.Operations, e)
flex := layout.Flex{
@@ -49,13 +79,6 @@ func (l *Limox) draw(e system.FrameEvent) {
return btn.Layout(gtx)
},
),
- layout.Rigid(
- func(gtx layout.Context) layout.Dimensions {
- btn := material.Button(l.Theme, &l.DisconnectButton,
- "Disconnect")
- return btn.Layout(gtx)
- },
- ),
)
e.Frame(gtx.Ops)