on main help sign in
chore: center permissions
1045148Kujtim Hoxha
internal/tui/components/dialogs/permissions/permissions.go+11−6
@@ -60,6 +60,9 @@ type permissionDialogCmp struct {
60 cachedContent string
60 cachedContent string
61 contentDirty bool
61 contentDirty bool
62
62
63+ positionRow int // Row position for dialog
64+ positionCol int // Column position for dialog
65+
63 keyMap KeyMap
66 keyMap KeyMap
64}
67}
65
68
@@ -446,6 +449,9 @@ func (p *permissionDialogCmp) render() string {
446 p.contentViewPort.SetHeight(contentHeight)
449 p.contentViewPort.SetHeight(contentHeight)
447 p.contentViewPort.SetContent(contentFinal)
450 p.contentViewPort.SetContent(contentFinal)
448
451
452+ p.positionRow = p.wHeight / 2
453+ p.positionRow -= (contentHeight + 9) / 2
454+
449 var contentHelp string
455 var contentHelp string
450 if p.supportsDiffView() {
456 if p.supportsDiffView() {
451 contentHelp = help.New().View(p.keyMap)
457 contentHelp = help.New().View(p.keyMap)
@@ -509,7 +515,10 @@ func (p *permissionDialogCmp) SetSize() tea.Cmd {
509 if oldWidth != p.width || oldHeight != p.height {
515 if oldWidth != p.width || oldHeight != p.height {
510 p.contentDirty = true
516 p.contentDirty = true
511 }
517 }
512−
518+ p.positionRow = p.wHeight / 2
519+ p.positionRow -= p.height / 2
520+ p.positionCol = p.wWidth / 2
521+ p.positionCol -= p.width / 2
513 return nil
522 return nil
514}
523}
515
524
@@ -529,9 +538,5 @@ func (p *permissionDialogCmp) ID() dialogs.DialogID {
529
538
530// Position implements PermissionDialogCmp.
539// Position implements PermissionDialogCmp.
531func (p *permissionDialogCmp) Position() (int, int) {
540func (p *permissionDialogCmp) Position() (int, int) {
532− row := (p.wHeight / 2) - 2 // Just a bit above the center
541+ return p.positionRow, p.positionCol
533− row -= p.height / 2
534− col := p.wWidth / 2
535− col -= p.width / 2
536− return row, col
537}
542}