on main help sign in
fix(tui): splash: make sure we have a margin after the logo on small
2929b21Ayman Bagabas
internal/tui/components/chat/splash/splash.go+12−2
@@ -453,9 +453,19 @@ func (s *splashCmp) Cursor() *tea.Cursor {
453 return nil
453 return nil
454}
454}
455
455
456+func (s *splashCmp) isSmallScreen() bool {
457+ // Consider a screen small if either the width is less than 40 or if the
458+ // height is less than 20
459+ return s.width < 40 || s.height < 20
460+}
461+
456func (s *splashCmp) infoSection() string {
462func (s *splashCmp) infoSection() string {
457 t := styles.CurrentTheme()
463 t := styles.CurrentTheme()
458− return t.S().Base.PaddingLeft(2).Render(
464+ infoStyle := t.S().Base.PaddingLeft(2)
465+ if s.isSmallScreen() {
466+ infoStyle = infoStyle.MarginTop(1)
467+ }
468+ return infoStyle.Render(
459 lipgloss.JoinVertical(
469 lipgloss.JoinVertical(
460 lipgloss.Left,
470 lipgloss.Left,
461 s.cwd(),
471 s.cwd(),
@@ -469,7 +479,7 @@ func (s *splashCmp) infoSection() string {
469func (s *splashCmp) logoBlock() string {
479func (s *splashCmp) logoBlock() string {
470 t := styles.CurrentTheme()
480 t := styles.CurrentTheme()
471 logoStyle := t.S().Base.Padding(0, 2).Width(s.width)
481 logoStyle := t.S().Base.Padding(0, 2).Width(s.width)
472− if s.width < 40 || s.height < 20 {
482+ if s.isSmallScreen() {
473 // If the width is too small, render a smaller version of the logo
483 // If the width is too small, render a smaller version of the logo
474 // NOTE: 20 is not correct because [splashCmp.height] is not the
484 // NOTE: 20 is not correct because [splashCmp.height] is not the
475 // *actual* window height, instead, it is the height of the splash
485 // *actual* window height, instead, it is the height of the splash