Remove Quit button from login Modal
This commit is contained in:
parent
9bc0b94da3
commit
04e24917de
7 changed files with 31 additions and 28 deletions
|
|
@ -75,10 +75,6 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
func onLoginFormQuitButtonSelected() {
|
||||
app.Stop()
|
||||
}
|
||||
|
||||
func onMessagesTextViewChanged() {
|
||||
app.Draw()
|
||||
}
|
||||
|
|
@ -86,11 +82,11 @@ func onMessagesTextViewChanged() {
|
|||
func onLoginModalDone(buttonIndex int, buttonLabel string) {
|
||||
if buttonLabel == ui.LoginViaEmailPasswordLoginModalButton {
|
||||
loginVia = "emailpassword"
|
||||
loginForm = ui.NewLoginForm(loginVia, onLoginFormLoginButtonSelected, onLoginFormQuitButtonSelected)
|
||||
loginForm = ui.NewLoginForm(loginVia, onLoginFormLoginButtonSelected)
|
||||
app.SetRoot(loginForm, true)
|
||||
} else if buttonLabel == ui.LoginViaTokenLoginModalButton {
|
||||
loginVia = "token"
|
||||
loginForm = ui.NewLoginForm(loginVia, onLoginFormLoginButtonSelected, onLoginFormQuitButtonSelected)
|
||||
loginForm = ui.NewLoginForm(loginVia, onLoginFormLoginButtonSelected)
|
||||
app.SetRoot(loginForm, true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,10 +7,11 @@ import (
|
|||
)
|
||||
|
||||
func NewGuildsDropDown(onGuildsDropDownSelected func(text string, index int), theme *util.Theme) (guildsDropDown *tview.DropDown) {
|
||||
guildsDropDown = tview.NewDropDown().
|
||||
SetLabel("Guild: ").
|
||||
SetSelectedFunc(onGuildsDropDownSelected)
|
||||
guildsDropDown = tview.NewDropDown()
|
||||
|
||||
guildsDropDown.
|
||||
SetLabel("Guild: ").
|
||||
SetSelectedFunc(onGuildsDropDownSelected).
|
||||
SetLabelColor(tcell.GetColor(theme.DropDownForeground)).
|
||||
SetFieldBackgroundColor(tcell.GetColor(theme.DropDownBackground)).
|
||||
SetFieldTextColor(tcell.GetColor(theme.DropDownForeground)).
|
||||
|
|
|
|||
10
ui/forms.go
10
ui/forms.go
|
|
@ -5,12 +5,12 @@ import (
|
|||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
func NewLoginForm(via string, onLoginFormLoginButtonSelected func(), onLoginFormQuitButtonSelected func()) (loginForm *tview.Form) {
|
||||
loginForm = tview.NewForm().
|
||||
AddButton("Login", onLoginFormLoginButtonSelected).
|
||||
AddButton("Quit", onLoginFormQuitButtonSelected).
|
||||
SetButtonsAlign(tview.AlignCenter)
|
||||
func NewLoginForm(via string, onLoginFormLoginButtonSelected func()) (loginForm *tview.Form) {
|
||||
loginForm = tview.NewForm()
|
||||
|
||||
loginForm.
|
||||
AddButton("Login", onLoginFormLoginButtonSelected).
|
||||
SetButtonsAlign(tview.AlignCenter).
|
||||
SetButtonBackgroundColor(tcell.GetColor("#5865F2")).
|
||||
SetBorder(true).
|
||||
SetBorderPadding(0, 0, 1, 1)
|
||||
|
|
|
|||
|
|
@ -7,11 +7,12 @@ import (
|
|||
)
|
||||
|
||||
func NewMessageInputField(onMessageInputFieldDone func(key tcell.Key), theme *util.Theme) (messageInputField *tview.InputField) {
|
||||
messageInputField = tview.NewInputField().
|
||||
messageInputField = tview.NewInputField()
|
||||
|
||||
messageInputField.
|
||||
SetPlaceholder("Message...").
|
||||
SetFieldWidth(0).
|
||||
SetDoneFunc(onMessageInputFieldDone)
|
||||
messageInputField.
|
||||
SetDoneFunc(onMessageInputFieldDone).
|
||||
SetFieldBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
|
||||
SetPlaceholderTextColor(tcell.GetColor(theme.InputFieldPlaceholderForeground)).
|
||||
SetBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
|
||||
|
|
|
|||
13
ui/modals.go
13
ui/modals.go
|
|
@ -4,15 +4,18 @@ import (
|
|||
"github.com/rivo/tview"
|
||||
)
|
||||
|
||||
const LoginViaTokenLoginModalButton = "Login via token"
|
||||
const LoginViaEmailPasswordLoginModalButton = "Login via email and password"
|
||||
const (
|
||||
LoginViaTokenLoginModalButton = "Login via token"
|
||||
LoginViaEmailPasswordLoginModalButton = "Login via email and password"
|
||||
)
|
||||
|
||||
func NewLoginModal(onLoginModalDone func(buttonIndex int, buttonLabel string)) (loginModal *tview.Modal) {
|
||||
loginModal = tview.NewModal().
|
||||
loginModal = tview.NewModal()
|
||||
|
||||
loginModal.
|
||||
SetText("Choose a login method:").
|
||||
AddButtons([]string{LoginViaTokenLoginModalButton, LoginViaEmailPasswordLoginModalButton}).
|
||||
SetDoneFunc(onLoginModalDone)
|
||||
loginModal.
|
||||
SetDoneFunc(onLoginModalDone).
|
||||
SetBorder(true).
|
||||
SetBorderPadding(0, 0, 1, 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@ import (
|
|||
)
|
||||
|
||||
func NewMessagesTextView(onMessagesTextViewChanged func(), theme *util.Theme) (messagesTextView *tview.TextView) {
|
||||
messagesTextView = tview.NewTextView().
|
||||
messagesTextView = tview.NewTextView()
|
||||
|
||||
messagesTextView.
|
||||
SetDynamicColors(true).
|
||||
SetWordWrap(true).
|
||||
ScrollToEnd().
|
||||
SetChangedFunc(onMessagesTextViewChanged)
|
||||
messagesTextView.
|
||||
SetChangedFunc(onMessagesTextViewChanged).
|
||||
SetTextColor(tcell.GetColor(theme.TextViewForeground)).
|
||||
SetBackgroundColor(tcell.GetColor(theme.TextViewBackground)).
|
||||
SetBorder(true).
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@ import (
|
|||
)
|
||||
|
||||
func NewChannelsTreeView(channelsTreeNode *tview.TreeNode, onChannelsTreeViewSelected func(node *tview.TreeNode), theme *util.Theme) (channelsTreeView *tview.TreeView) {
|
||||
channelsTreeView = tview.NewTreeView().
|
||||
channelsTreeView = tview.NewTreeView()
|
||||
|
||||
channelsTreeView.
|
||||
SetTopLevel(1).
|
||||
SetRoot(channelsTreeNode).
|
||||
SetCurrentNode(channelsTreeNode).
|
||||
SetSelectedFunc(onChannelsTreeViewSelected)
|
||||
channelsTreeView.
|
||||
SetSelectedFunc(onChannelsTreeViewSelected).
|
||||
SetBackgroundColor(tcell.GetColor(theme.TreeViewBackground)).
|
||||
SetBorder(true).
|
||||
SetBorderPadding(0, 0, 1, 1)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue