Skip to content

Polish TUI device list: lipgloss styling, window sizing, and view preview test - #1

Merged
tingkai-c merged 1 commit into
mainfrom
codex/modernize-text-based-user-interface
May 1, 2026
Merged

Polish TUI device list: lipgloss styling, window sizing, and view preview test#1
tingkai-c merged 1 commit into
mainfrom
codex/modernize-text-based-user-interface

Conversation

@tingkai-c

Copy link
Copy Markdown
Owner

Motivation

  • Improve the terminal device selection UI to be more readable and visually consistent using styling and layout constraints.
  • Make the TUI adapt to terminal width so the panel does not overflow small terminals.
  • Add a non-interactive unit test to validate the view output for CI-friendly verification.

Description

  • Added lipgloss-based styles (appStyle, titleStyle, subtitleStyle, selectedStyle, normalStyle, emptyStyle, helpStyle) and applied them in View() to render a bordered, padded panel with styled title, subtitle, selected row, and help text.
  • Added width field to the model and handle bubbletea.WindowSizeMsg in Update() to constrain panel width via MaxWidth so the UI adapts to terminal size.
  • Improved the empty-state and device-list rendering in View() using strings.Join and styled lines; replaced the plain text layout with the styled panel.
  • Added TestViewPreview to internal/tui/tui_test.go which constructs a sample model and asserts the rendered view contains the title and a selected device name; kept TestSelectDevice which will skip when no /dev/tty is available.

Testing

  • Ran go test ./internal/tui -v; the new TestViewPreview passed and produced a textual preview of the styled TUI.
  • TestSelectDevice remains present and will be skipped on CI environments with no TTY (it is skipped when /dev/tty cannot be opened).
  • No automated test failures observed for the modified package during the run.

Codex Task

@tingkai-c
tingkai-c merged commit b7794e5 into main May 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant