From 6d5824f7d2225bdb434becd4c5afa838aa2af440 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sat, 5 Apr 2025 18:46:17 +0200 Subject: Play model --- ui/views/auth.go | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'ui/views/auth.go') diff --git a/ui/views/auth.go b/ui/views/auth.go index 9599b4a..a695466 100644 --- a/ui/views/auth.go +++ b/ui/views/auth.go @@ -63,8 +63,6 @@ func NewAuthModel(width, height int) AuthModel { // Initialize loginModel func initLoginModel(width, height int) loginModel { - inputStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("#7EE2A8")) - username := textinput.New() username.Prompt = " " username.TextStyle = inputStyle @@ -150,6 +148,11 @@ func (m AuthModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } switch msg := msg.(type) { + case tea.WindowSizeMsg: + m.width = msg.Width + m.height = msg.Height + return m, nil + case tea.KeyMsg: switch msg.String() { case "alt+1": @@ -481,11 +484,6 @@ func (m loginModel) renderContent() string { Align(lipgloss.Center). Width(formWidth - 4) // Account for padding - errorStyle := lipgloss.NewStyle(). - Foreground(lipgloss.Color("#ff0000")). - Align(lipgloss.Center). - Width(formWidth - 4) // Account for padding - statusStyle := lipgloss.NewStyle(). Align(lipgloss.Center). Bold(true). @@ -506,7 +504,7 @@ func (m loginModel) renderContent() string { form := lipgloss.JoinVertical(lipgloss.Center, titleStyle.Render("Sign in to your account"), "\n", - errorStyle.Render(formError), + errorStyle.Align(lipgloss.Center).Width(formWidth-4).Render(formError), inputWrapStyle.Render( lipgloss.JoinHorizontal(lipgloss.Left, labelStyle.Render("Username:"), @@ -545,11 +543,6 @@ func (m signupModel) renderContent() string { Align(lipgloss.Center). Width(formWidth - 4) // Account for padding - errorStyle := lipgloss.NewStyle(). - Foreground(lipgloss.Color("#ff0000")). - Align(lipgloss.Center). - Width(formWidth - 4) // Account for padding - statusStyle := lipgloss.NewStyle(). Align(lipgloss.Center). Bold(true). @@ -570,7 +563,7 @@ func (m signupModel) renderContent() string { form := lipgloss.JoinVertical(lipgloss.Center, titleStyle.Render("Create a new account"), "\n", - errorStyle.Render(formError), + errorStyle.Align(lipgloss.Center).Width(formWidth-4).Render(formError), inputWrapStyle.Render( lipgloss.JoinHorizontal(lipgloss.Left, labelStyle.Render("Username:"), -- cgit v1.2.3-18-g5258