summaryrefslogtreecommitdiff
path: root/client/login_prompt.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/login_prompt.go')
-rw-r--r--client/login_prompt.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/client/login_prompt.go b/client/login_prompt.go
new file mode 100644
index 0000000..7e38d30
--- /dev/null
+++ b/client/login_prompt.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "citrons.xyz/talk/tui"
+)
+
+type loginPrompt struct {
+ input tui.TextInput
+ username string
+}
+
+func (p *loginPrompt) Input() *tui.TextInput {
+ return &p.input
+}
+
+func (p *loginPrompt) Send(text string) {
+ if p.username != "" {
+ return
+ }
+ p.username = text
+ globalApp.auth(text, func(success bool) {
+ if success {
+ globalApp.removePrompt(p)
+ } else {
+ p.username = ""
+ }
+ })
+}
+
+func (p *loginPrompt) ShowStatusLine() {
+ tui.Text("[", nil)
+ tui.Text("login", &tui.Style {
+ Bg: tui.White, Fg: tui.Blue, Bold: true,
+ })
+ tui.Text("]", nil)
+ tui.Text(" username:", nil)
+}