chore: upgrade dependencies. remove deprecated code. conform to linter style

This commit is contained in:
2025-08-11 22:51:50 +02:00
parent bfe490cd5c
commit e24201c204
15 changed files with 133 additions and 142 deletions
+3 -3
View File
@@ -45,7 +45,7 @@ type State struct {
Client *irc.Client
}
func initialUiState(client *irc.Client) UI {
func initialUIState(client *irc.Client) UI {
return UI{
Login: login.NewLogin(),
MainScreen: mainscreen.NewMainScreen(client),
@@ -57,7 +57,7 @@ func InitialState() *State {
return &State{
Client: client,
UI: initialUiState(client),
UI: initialUIState(client),
}
}
@@ -125,5 +125,5 @@ func (s State) View() string {
return s.UI.MainScreen.View()
}
return "Error: this screen shouldn't ever show"
panic("Invalid screen")
}
+8 -8
View File
@@ -44,15 +44,15 @@ func NewLogin() State {
Inputs: make([]textinput.Model, 5),
ConnectButtonBlurredStyle: BlurredDisabledButton,
ConnectButtonFocusedStyle: FocusedDisabledButton,
DialogStyle: DialogStyle.Copy(),
WelcomeMsgStyle: WelcomeMsgStyle.Copy(),
Style: ui.MainStyle.Copy(),
DialogStyle: DialogStyle,
WelcomeMsgStyle: WelcomeMsgStyle,
Style: ui.MainStyle,
}
var t textinput.Model
for i := range state.Inputs {
t = textinput.New()
t.CursorStyle = CursorStyle
t.Cursor.Style = CursorStyle
t.Prompt = ""
switch i {
@@ -160,11 +160,11 @@ func (s *State) updateInputs(msg tea.Msg) tea.Cmd {
}
func (s *State) SetSize(width, height int) {
s.DialogStyle = s.DialogStyle.Copy().Width(width - s.DialogStyle.GetHorizontalFrameSize())
s.DialogStyle = s.DialogStyle.Copy().Height(height*5/10 - s.DialogStyle.GetVerticalFrameSize())
s.DialogStyle = s.DialogStyle.Width(width - s.DialogStyle.GetHorizontalFrameSize())
s.DialogStyle = s.DialogStyle.Height(height*5/10 - s.DialogStyle.GetVerticalFrameSize())
s.WelcomeMsgStyle = s.WelcomeMsgStyle.Copy().Width(width)
s.WelcomeMsgStyle = s.WelcomeMsgStyle.Copy().Height(height * 5 / 10)
s.WelcomeMsgStyle = s.WelcomeMsgStyle.Width(width)
s.WelcomeMsgStyle = s.WelcomeMsgStyle.Height(height * 5 / 10)
}
func (s State) View() string {
+4 -4
View File
@@ -72,22 +72,22 @@ var (
FocusedCheckbox = lipgloss.NewStyle().
Foreground(ui.AccentColor).
MarginTop(1).
Render("TLS Enabled [✕]")
Render("TLS Enabled [☓]")
BlurredCheckbox = lipgloss.NewStyle().
Foreground(ui.PrimaryColor).
MarginTop(1).
Render("TLS Enabled [✕]")
Render("TLS Enabled [☓]")
FocusedCheckboxChecked = lipgloss.NewStyle().
Foreground(ui.AccentColor).
MarginTop(1).
Render("TLS Enabled [🗸]")
Render("TLS Enabled [✔]")
BlurredCheckboxChecked = lipgloss.NewStyle().
Foreground(ui.PrimaryColor).
MarginTop(1).
Render("TLS Enabled [🗸]")
Render("TLS Enabled [✔]")
DialogStyle = lipgloss.NewStyle().
Align(lipgloss.Center)
+2 -2
View File
@@ -24,7 +24,7 @@ import (
func NoSpacesValidation(input string) error {
if strings.Contains(input, " ") {
return errors.New("Field cannot contain spaces")
return errors.New("field cannot contain spaces")
}
return nil
@@ -37,7 +37,7 @@ func ValidatePort(input string) error {
}
if pNum < 1 || pNum > 65535 {
return errors.New("Invalid port number")
return errors.New("invalid port number")
}
return nil
+3 -3
View File
@@ -37,7 +37,7 @@ func NewInputBox() InputState {
return InputState{
Input: input,
Style: InputboxStyle.Copy(),
Style: InputboxStyle,
}
}
@@ -65,12 +65,12 @@ func (s InputState) Update(msg tea.Msg) (InputState, tea.Cmd) {
func (s *InputState) Focus() {
s.Input.Focus()
s.Style = s.Style.Copy().BorderForeground(ui.AccentColor)
s.Style = s.Style.BorderForeground(ui.AccentColor)
}
func (s *InputState) Blur() {
s.Input.Blur()
s.Style = s.Style.Copy().BorderForeground(ui.PrimaryColor)
s.Style = s.Style.BorderForeground(ui.PrimaryColor)
}
func (s *InputState) SetSize(width int) {
+16 -16
View File
@@ -57,7 +57,7 @@ type State struct {
func NewMainScreen(client *irc.Client) State {
newViewport := viewport.New(0, 0)
newViewport.Style = MessagesStyle.Copy()
newViewport.Style = MessagesStyle
return State{
Client: client,
@@ -204,24 +204,24 @@ func (s State) Update(msg tea.Msg) (State, tea.Cmd) {
}
func (s *State) Focus() {
s.Viewport.Style = s.Viewport.Style.Copy().BorderForeground(ui.AccentColor)
s.Viewport.Style = s.Viewport.Style.BorderForeground(ui.AccentColor)
tab = tab.Copy().BorderForeground(ui.AccentColor)
leftArrowDim = leftArrowDim.Copy().BorderForeground(ui.AccentColor)
rightArrowDim = rightArrowDim.Copy().BorderForeground(ui.AccentColor)
leftArrowLit = leftArrowLit.Copy().BorderForeground(ui.AccentColor)
rightArrowLit = rightArrowLit.Copy().BorderForeground(ui.AccentColor)
tabLine = tabLine.Copy().Foreground(ui.AccentColor)
tab = tab.BorderForeground(ui.AccentColor)
leftArrowDim = leftArrowDim.BorderForeground(ui.AccentColor)
rightArrowDim = rightArrowDim.BorderForeground(ui.AccentColor)
leftArrowLit = leftArrowLit.BorderForeground(ui.AccentColor)
rightArrowLit = rightArrowLit.BorderForeground(ui.AccentColor)
tabLine = tabLine.Foreground(ui.AccentColor)
}
func (s *State) Blur() {
s.Viewport.Style = s.Viewport.Style.Copy().BorderForeground(ui.PrimaryColor)
s.Viewport.Style = s.Viewport.Style.BorderForeground(ui.PrimaryColor)
tab = tab.Copy().BorderForeground(ui.PrimaryColor)
leftArrowDim = leftArrowDim.Copy().BorderForeground(ui.PrimaryColor)
rightArrowDim = rightArrowDim.Copy().BorderForeground(ui.PrimaryColor)
leftArrowLit = leftArrowLit.Copy().BorderForeground(ui.PrimaryColor)
rightArrowLit = rightArrowLit.Copy().BorderForeground(ui.PrimaryColor)
tabLine = tabLine.Copy().Foreground(ui.PrimaryColor)
tab = tab.BorderForeground(ui.PrimaryColor)
leftArrowDim = leftArrowDim.BorderForeground(ui.PrimaryColor)
rightArrowDim = rightArrowDim.BorderForeground(ui.PrimaryColor)
leftArrowLit = leftArrowLit.BorderForeground(ui.PrimaryColor)
rightArrowLit = rightArrowLit.BorderForeground(ui.PrimaryColor)
tabLine = tabLine.Foreground(ui.PrimaryColor)
}
func (s *State) SetSize(width, height int) {
@@ -232,7 +232,7 @@ func (s *State) SetSize(width, height int) {
// and also because we ceil the sidepanel's width
// -3 for the tab bar height
newWidth := int(math.Floor(float64(width) * 8 / 10))
newHeight := height - s.InputBox.Style.GetVerticalFrameSize() - 3
newHeight := height - s.InputBox.Style.GetVerticalFrameSize() - 3 - 1
s.Viewport.Width = newWidth
s.Viewport.Height = newHeight
+1 -1
View File
@@ -60,7 +60,7 @@ func (s *SidePanelState) getLatestNicks() []string {
func NewSidePanel(client *irc.Client) *SidePanelState {
newViewport := viewport.New(0, 0)
newViewport.Style = SidePanelStyle.Copy()
newViewport.Style = SidePanelStyle
return &SidePanelState{
Client: client,
+8 -8
View File
@@ -22,16 +22,16 @@ import (
)
var (
InputboxStyle = ui.DefaultStyle.Copy().
InputboxStyle = ui.DefaultStyle.
Border(lipgloss.NormalBorder(), true).
Padding(0, 1).
Width(ui.MainStyle.GetWidth()).
BorderForeground(ui.AccentColor)
MessagesStyle = ui.DefaultStyle.Copy().
MessagesStyle = ui.DefaultStyle.
Border(lipgloss.NormalBorder(), false, true, true, true).
Width(ui.MainStyle.GetWidth() * 8 / 10).
BorderForeground(ui.PrimaryColor)
SidePanelStyle = ui.DefaultStyle.Copy().
SidePanelStyle = ui.DefaultStyle.
Border(lipgloss.NormalBorder(), true).
Width(ui.MainStyle.GetWidth() * 2 / 10).
BorderForeground(ui.PrimaryColor)
@@ -85,26 +85,26 @@ var (
Foreground(ui.PrimaryColor).
Padding(0, 1)
activeTab = tab.Copy().
activeTab = tab.
Border(activeTabBorder, true).
BorderForeground(ui.AccentColor).
Foreground(ui.AccentColor).
Italic(true).
Bold(true)
leftArrowDim = tab.Copy().
leftArrowDim = tab.
Border(leftArrowBorder, true).
BorderForeground(ui.PrimaryColor).
Foreground(ui.DisabledColor)
rightArrowDim = tab.Copy().
rightArrowDim = tab.
Border(rightArrowBorder, true).
BorderForeground(ui.PrimaryColor).
Foreground(ui.DisabledColor)
leftArrowLit = tab.Copy().
leftArrowLit = tab.
Border(leftArrowBorder, true).
Foreground(ui.PrimaryColor)
rightArrowLit = tab.Copy().
rightArrowLit = tab.
Border(rightArrowBorder, true).
Foreground(ui.PrimaryColor)