Align progress action layout with confirm dialog logic

This commit is contained in:
vrubelroman 2026-04-24 09:45:27 +03:00
parent 6787a7a363
commit 3c2016eaf0

View file

@ -1802,12 +1802,12 @@ func renderProgressStatLine(label string, value string, width int, palette theme
} }
func renderProgressActions(width int, palette theme.Palette) string { func renderProgressActions(width int, palette theme.Palette) string {
const minButtonWidth = 14 const minButtonWidth = 10
const maxButtonWidth = 18 const maxButtonWidth = 14
const gapWidth = 4
labelWidth := max(lipgloss.Width("Background / b"), lipgloss.Width("Cancel / c")) labelWidth := max(lipgloss.Width("Background / b"), lipgloss.Width("Cancel / c"))
buttonWidth := min(max(labelWidth+2, minButtonWidth), maxButtonWidth) buttonWidth := min(max(labelWidth+2, minButtonWidth), maxButtonWidth)
edgePad := max(width/8, 6) buttonWidth = min(buttonWidth, max((width-gapWidth)/2, labelWidth))
buttonWidth = min(buttonWidth, max((width-(edgePad*2)-4)/2, labelWidth))
backgroundBtn := lipgloss.NewStyle(). backgroundBtn := lipgloss.NewStyle().
Width(buttonWidth). Width(buttonWidth).
@ -1816,6 +1816,7 @@ func renderProgressActions(width int, palette theme.Palette) string {
Foreground(palette.Background). Foreground(palette.Background).
Bold(true). Bold(true).
Render("Background / b") Render("Background / b")
cancelBtn := lipgloss.NewStyle(). cancelBtn := lipgloss.NewStyle().
Width(buttonWidth). Width(buttonWidth).
Align(lipgloss.Center). Align(lipgloss.Center).
@ -1824,21 +1825,25 @@ func renderProgressActions(width int, palette theme.Palette) string {
Bold(true). Bold(true).
Render("Cancel / c") Render("Cancel / c")
leftPad := lipgloss.NewStyle(). gap := lipgloss.NewStyle().
Width(edgePad). Width(gapWidth).
Background(palette.Panel). Background(palette.Panel).
Render("") Render("")
rightPadWidth := edgePad enterBias := lipgloss.NewStyle().
centerGapWidth := max(width-edgePad-rightPadWidth-(buttonWidth*2), 0) Width(9).
centerGap := lipgloss.NewStyle().
Width(centerGapWidth).
Background(palette.Panel). Background(palette.Panel).
Render("") Render("")
rightPad := lipgloss.NewStyle(). cancelTail := lipgloss.NewStyle().
Width(rightPadWidth). Width(5).
Background(palette.Panel). Background(palette.Panel).
Render("") Render("")
row := leftPad + backgroundBtn + centerGap + cancelBtn + rightPad group := lipgloss.JoinHorizontal(lipgloss.Top, backgroundBtn, enterBias, gap, cancelBtn, cancelTail)
row := lipgloss.PlaceHorizontal(
width,
lipgloss.Center,
group,
lipgloss.WithWhitespaceBackground(palette.Panel),
)
return lipgloss.NewStyle(). return lipgloss.NewStyle().
Width(width). Width(width).
Background(palette.Panel). Background(palette.Panel).