Skip to content

Commit be74e19

Browse files
committed
fixes
1 parent 9d12a06 commit be74e19

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

internal/tui/model.go

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,11 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
324324
m.width = msg.Width
325325
m.height = msg.Height
326326

327-
// Update viewport heights
328-
contentHeight := m.height - 10 // Reserve space for headers and margins
327+
// Reserve space for header (4 lines) + padding
328+
headerHeight := 6
329+
contentHeight := m.height - headerHeight - 2 // -2 for spacing
330+
331+
// Adjust list and viewport sizes
329332
m.requestList.SetSize(m.width/4, contentHeight)
330333
m.detailedRequestView.Height = contentHeight
331334
m.detailedResponseView.Height = contentHeight
@@ -389,19 +392,34 @@ func (m model) View() string {
389392
))
390393
}
391394

395+
// Style for the header section
392396
headerStyle := lipgloss.NewStyle().
393397
Width(m.width).
394-
Align(lipgloss.Center)
395-
396-
browserHeader := headerStyle.Render(
397-
lipgloss.JoinVertical(lipgloss.Center,
398-
boldenString("Inspecting incoming HTTP requests", true),
399-
boldenString(fmt.Sprintf("Waiting for requests on %s", m.dumpURL), true),
400-
boldenString("Press Ctrl-y to copy the url. Use ctrl-b to copy the json request body in view.", true),
401-
boldenString("You can use j,k or arrow up and down to navigate your requests", true),
402-
))
403-
404-
return m.spinner.View() + "\n" + browserHeader + "\n" + m.makeTable()
398+
Align(lipgloss.Center).
399+
BorderBottom(true).
400+
PaddingBottom(1)
401+
402+
// Create header content
403+
header := lipgloss.JoinVertical(lipgloss.Center,
404+
boldenString("Inspecting incoming HTTP requests", true),
405+
boldenString(fmt.Sprintf("Waiting for requests on %s", m.dumpURL), true),
406+
boldenString("Press Ctrl-y to copy the url. Use ctrl-b to copy the json request body in view.", true),
407+
boldenString("You can use j,k or arrow up and down to navigate your requests", true),
408+
)
409+
410+
// Render the header with style
411+
styledHeader := headerStyle.Render(header)
412+
413+
// Main content
414+
content := m.makeTable()
415+
416+
// Join everything together with proper spacing
417+
return lipgloss.JoinVertical(
418+
lipgloss.Top,
419+
styledHeader,
420+
"\n",
421+
content,
422+
)
405423
}
406424

407425
func (m model) buildView() string {
@@ -414,21 +432,21 @@ func (m model) buildView() string {
414432
// Left side with request list
415433
leftView := lipgloss.NewStyle().
416434
Width(leftWidth).
417-
Height(m.height).
435+
Height(m.height - 8). // Subtract header height
418436
Render(m.requestList.View())
419437

420438
// Right side with request and response side by side
421439
rightView := lipgloss.JoinHorizontal(lipgloss.Top,
422440
// Request section (headers + body)
423441
lipgloss.NewStyle().
424442
Width(rightHalfWidth).
425-
Height(m.height).
443+
Height(m.height-8). // Subtract header height
426444
MarginRight(2).
427445
Render(m.detailedRequestView.View()),
428446
// Response section (headers + body)
429447
lipgloss.NewStyle().
430448
Width(rightHalfWidth).
431-
Height(m.height).
449+
Height(m.height-8). // Subtract header height
432450
Render(m.detailedResponseView.View()))
433451

434452
// Join left and right sides

0 commit comments

Comments
 (0)