@@ -20,15 +20,45 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
2020 m .openJobInBrowser ()
2121 }
2222 case tea.WindowSizeMsg :
23+ // Compute right-pane width and distribute across columns to fill fully
24+ w := msg .Width - 34
25+ m .table .SetHeight (msg .Height - 7 )
26+ m .table .SetWidth (w )
27+ // Bubble table adds cell padding (default is 1 left + 1 right per column)
28+ const cols = 5
29+ const cellPad = 2 // total horizontal padding per cell (left+right)
30+ contentW := w - (cols * cellPad )
31+ if contentW < cols { // ensure non-negative widths
32+ contentW = cols
33+ }
34+ // Proportional widths based on content width; last column takes remainder
35+ w1 := contentW * 2 / 7 // Triggered by
36+ w2 := contentW * 1 / 7 // Environment
37+ w3 := contentW * 1 / 7 // pipeline
38+ w4 := contentW * 1 / 7 // status
39+ w5 := contentW - (w1 + w2 + w3 + w4 ) // created gets the rest
40+ if w1 < 1 {
41+ w1 = 1
42+ }
43+ if w2 < 1 {
44+ w2 = 1
45+ }
46+ if w3 < 1 {
47+ w3 = 1
48+ }
49+ if w4 < 1 {
50+ w4 = 1
51+ }
52+ if w5 < 1 {
53+ w5 = 1
54+ }
2355 var columns = []table.Column {
24- {Title : "Triggered by" , Width : ( msg . Width - 44 ) / 5 },
25- {Title : "Environment" , Width : ( msg . Width - 44 ) / 5 },
26- {Title : "Pipeline " , Width : ( msg . Width - 44 ) / 5 },
27- {Title : "Status " , Width : ( msg . Width - 44 ) / 5 },
28- {Title : "Created " , Width : ( msg . Width - 44 ) / 5 },
56+ {Title : "Triggered by" , Width : w1 },
57+ {Title : "Environment" , Width : w2 },
58+ {Title : "pipeline " , Width : w3 },
59+ {Title : "status " , Width : w4 },
60+ {Title : "created " , Width : w5 },
2961 }
30- m .table .SetHeight (msg .Height - 7 )
31- m .table .SetWidth (msg .Width - 34 )
3262 m .table .SetColumns (columns )
3363
3464 case commands.Application :
@@ -74,12 +104,17 @@ func (m Model) View() string {
74104 titleText := lipgloss .NewStyle ().Bold (true ).Render ("Pipeline jobs" )
75105 spin := ""
76106 if m .refreshing {
77- spin = m .spinner .View ()
107+ spin = " " + m .spinner .View ()
78108 }
79- // Reserve two columns for spinner output so the title width stays constant
80- spinBox := lipgloss .NewStyle ().Width (3 ).Render (spin )
81- header := lipgloss .JoinHorizontal (lipgloss .Left , titleText , " " , spinBox )
82- return lipgloss .JoinVertical (lipgloss .Center , header , m .table .View ())
109+ // Reserve a wider spinner slot so centering is stable across frames
110+ spinBox := lipgloss .NewStyle ().Width (4 ).Render (spin )
111+ headerLine := lipgloss .JoinHorizontal (lipgloss .Left , titleText , spinBox )
112+ // Make header exactly as wide as the table and center the content for symmetric padding
113+ header := lipgloss .NewStyle ().
114+ Width (lipgloss .Width (m .table .View ())).
115+ AlignHorizontal (lipgloss .Center ).
116+ Render (headerLine )
117+ return lipgloss .JoinVertical (lipgloss .Left , header , m .table .View ())
83118}
84119
85120// pollTick is an internal message used to schedule periodic refreshes.
0 commit comments