Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
change dot to arabic paging format
Browse files Browse the repository at this point in the history
Signed-off-by: zychen5186 <[email protected]>

change dot to arabic paging format

Signed-off-by: zychen5186 <[email protected]>
  • Loading branch information
zychen5186 committed Apr 23, 2024
1 parent 2bb1095 commit fa5d50b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/bubbletea/bubbletea_pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package bubbletea
// component library.

import (
"fmt"
"log"
"strings"

"github.com/charmbracelet/bubbles/paginator"
"github.com/charmbracelet/lipgloss"
"github.com/golang/protobuf/proto"

tea "github.com/charmbracelet/bubbletea"
Expand All @@ -21,10 +21,7 @@ type pageModel struct {

func newModel(initMsg []proto.Message) pageModel {
p := paginator.New()
p.Type = paginator.Dots
p.PerPage = defaultMsgPerPage
p.ActiveDot = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "235", Dark: "252"}).Render("•")
p.InactiveDot = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "250", Dark: "238"}).Render("•")
p.SetTotalPages(len(initMsg))

return pageModel{
Expand Down Expand Up @@ -59,7 +56,8 @@ func (m pageModel) View() string {
return ""
}
b.WriteString(table)
b.WriteString(" " + m.paginator.View())
currentPage := int(firstBatchIndex-1)*pagePerBatch + m.paginator.Page + 1
b.WriteString(fmt.Sprintf(" PAGE - %d\n", currentPage))
b.WriteString("\n\n h/l ←/→ page • q: quit\n")
return b.String()
}
Expand Down
1 change: 1 addition & 0 deletions pkg/bubbletea/bubbletea_pagination_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type PrintableProto struct{ proto.Message }
const (
defaultLimit = 100
defaultMsgPerPage = 10
pagePerBatch = defaultLimit / defaultMsgPerPage
)

var (
Expand Down

0 comments on commit fa5d50b

Please sign in to comment.