MCPcopy
hub / github.com/mathaou/termdbms / View

Method View

list/list.go:942–984  ·  view source on GitHub ↗

View renders the component.

()

Source from the content-addressed store, hash-verified

940
941// View renders the component.
942func (m Model) View() string {
943 var (
944 sections []string
945 availHeight = m.height
946 )
947
948 if m.showTitle || (m.showFilter && m.filteringEnabled) {
949 v := m.titleView()
950 sections = append(sections, v)
951 availHeight -= lipgloss.Height(v)
952 }
953
954 if m.showStatusBar {
955 v := m.statusView()
956 sections = append(sections, v)
957 availHeight -= lipgloss.Height(v)
958 }
959
960 var pagination string
961 if m.showPagination {
962 pagination = m.paginationView()
963 availHeight -= lipgloss.Height(pagination)
964 }
965
966 var help string
967 if m.showHelp {
968 help = m.helpView()
969 availHeight -= lipgloss.Height(help)
970 }
971
972 content := lipgloss.NewStyle().Height(availHeight).Render(m.populatedView())
973 sections = append(sections, content)
974
975 if m.showPagination {
976 sections = append(sections, pagination)
977 }
978
979 if m.showHelp {
980 sections = append(sections, help)
981 }
982
983 return lipgloss.JoinVertical(lipgloss.Left, sections...)
984}
985
986func (m Model) titleView() string {
987 var (

Callers 4

titleViewMethod · 0.45
paginationViewMethod · 0.45
helpViewMethod · 0.45
spinnerViewMethod · 0.45

Calls 7

titleViewMethod · 0.95
statusViewMethod · 0.95
paginationViewMethod · 0.95
helpViewMethod · 0.95
populatedViewMethod · 0.95
HeightMethod · 0.65
RenderMethod · 0.65

Tested by

no test coverage detected